/* New style for input groups on the Ventilation Humidity page */
.input-group {
    margin-bottom: 10px;
    display: flex; /* Use flexbox for alignment */
    align-items: center; /* Vertically align items */
    gap: 10px; /* Space between label/span/input */
}

.input-group label {
    flex-basis: 200px; /* Give labels a fixed width */
    min-width: 150px;
    text-align: right; /* Align label text to the right */
    font-weight: bold;
}

.input-group span,
.input-group input[type="number"] {
    flex-grow: 1; /* Allow content to grow */
    max-width: 200px; /* Limit width of input/display */
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
}

.input-group input[type="number"] {
    width: auto; /* Override max-width for input numbers */
}

body {
    font-family: sans-serif;
    margin: 0; /* Reset default body margin */
}

nav {
    background-color: #333;
    overflow: hidden;
}

nav ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

nav li {
    float: left;
}

nav li a {
    display: block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}

nav li a:hover {
    background-color: #ddd;
    color: black;
}

nav li a.active {
    background-color: #4CAF50; /* Green color for active link */
    color: white;
}

.content {
    margin: 20px; /* Add margin to content below navbar */
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f9f9f9;
}


.station-selector, .metadata-display, .data-display {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f9f9f9;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table, th, td {
    border: 1px solid #ddd;
}

th, td {
    padding: 8px;
    text-align: left;
}

th {
    background-color: #f2f2f2;
}

pre {
    white-space: pre-wrap; /* Since CSS 2.1 */
    word-wrap: break-word; /* Internet Explorer 5.5+ */
}

.login-container {
    width: 400px;
    margin: 50px auto;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.login-form .form-group {
    margin-bottom: 15px;
}

.login-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box; /* Important to include padding and border in width */
}

.login-button {
    background-color: #4CAF50;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.login-button:hover {
    background-color: #45a049;
}

.login-error {
    color: red;
    margin-bottom: 15px;
}

/* ... (previous CSS styles) ... */

.dashboard-station-selector {
    margin-bottom: 20px;
}

.dashboard-data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.dashboard-data-table, .dashboard-data-table th, .dashboard-data-table td {
    border: 1px solid #ddd;
}

.dashboard-data-table th, .dashboard-data-table td {
    padding: 8px;
    text-align: left;
}

.dashboard-data-table th {
    background-color: #f2f2f2;
}

.wsi-label {
    font-size: 0.8em;
    color: #777;
}

/* ... (previous CSS styles) ... */

.settings-section {
    margin-bottom: 25px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.settings-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
}

.settings-button {
    background-color: #008CBA; /* Blue color */
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 10px;
}

.settings-button:hover {
    background-color: #0077a3;
}

.webcam-order-button {
    padding: 6px 10px;
    min-width: auto;
}

/* Toggle status button styles */
.toggle-status-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    transition: background-color 0.3s, color 0.3s;
    min-width: 80px;
}

.toggle-status-btn.active {
    background-color: #28a745;
    color: white;
}

.toggle-status-btn.active:hover {
    background-color: #218838;
}

.toggle-status-btn.inactive {
    background-color: #dc3545;
    color: white;
}

.toggle-status-btn.inactive:hover {
    background-color: #c82333;
}

.confirmation-message {
    margin-top: 10px;
    font-style: italic;
    color: #555;
}

.log-textarea {
    width: 100%;
    margin-top: 10px;
    font-family: monospace; /* Fixed-width font for logs */
    font-size: 0.9em;
    padding: 8px;
    border: 1px solid #ddd;
    box-sizing: border-box;
    resize: vertical; /* Allow vertical resizing */
}

.hover-value {
    cursor: help; /* Change cursor to help pointer on hover */
    /* You can add other styling for hover effect if needed */
}

/* ... (previous CSS styles) ... */

.record-highlight-high {
    background-color: #ffe0e0; /* Light red for max high */
}

.record-highlight-low {
    background-color: #e0e0ff; /* Light blue for min low */
}

.record-highlight-today {
    background-color: #c8f7c8; /* Light green for today's date */
}

.rain-highlight-above-1 {
    background-color: #e0e0ff; /* Light blue for rain values above 1.0 mm */
}

.element-order-item {
    padding: 10px;
    border: 1px solid #ddd;
    margin-bottom: 5px;
    background-color: white;
    cursor: grab; /* Change cursor to grab icon */
}

.element-order-item:hover {
    background-color: #f0f0f0;
}

.element-handle {
    cursor: grab; /* Change cursor to grab icon */
    margin-right: 10px;
    opacity: 0.6; /* Make handle slightly less visible */
}

.webcam-order-item {
    cursor: grab; /* Change cursor to grab icon */
}

.webcam-order-item:hover {
    background-color: #f0f0f0;
}

.sortable-ghost {
    opacity: 0.5;
    background: #c8c8c8;
    border: 1px dashed #999;
}
.sortable-chosen {
    border: 1px solid blue;
}
.sortable-drag {
  opacity: 0.8;
}

.chart-container {
    margin-bottom: 30px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #fff;
}

.chart-container h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.chart-container canvas {
    width: 100%;
    height: 300px; /* Adjust chart height as needed */
}

.chart-container {
    margin-bottom: 30px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #fff;
}

.chart-container h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.chart-container canvas {
    width: 100%;
    height: 300px; /* Adjust chart height as needed */
}

.graph-controls { /* New style for button container */
    text-align: center; /* Center buttons */
    margin-top: 10px; /* Add some space above buttons */
}

.rain-controls {
    margin: 20px 0;
    display: flex;
    gap: 20px;
    justify-content: center;
}

.rain-controls .settings-button {
    padding: 8px 16px;
    min-width: 120px;
}

/* Webcams page */
.webcams-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.webcams-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 800px) {
    .webcams-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .webcams-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.webcam-card {
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.webcam-title {
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #0066cc;
    text-decoration: none;
}

.webcam-title:hover {
    text-decoration: underline;
    color: #0052a3;
}

.webcam-refresh-btn {
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.webcam-refresh-btn:hover {
    background: #f7f7f7;
}

.webcam-image-wrap {
    position: relative;
    background: #000;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.webcam-image {
    width: 100%;
    height: auto;
    display: block;
    cursor: zoom-in;
}

.webcam-placeholder,
.webcam-disabled {
    color: #fff;
    font-weight: bold;
    padding: 18px;
    text-align: center;
    opacity: 0.85;
}

.webcam-disabled {
    opacity: 0.6;
}

.webcam-meta {
    padding: 10px 12px;
    font-size: 0.9em;
    color: #555;
}

.webcam-info {
    padding: 10px 12px;
}

.webcam-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.webcam-info .webcam-meta {
    padding: 8px 0 0 0;
}

/* Webcam modal (overlay) */
.webcam-modal.hidden {
    display: none;
}

.webcam-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.webcam-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
}

.webcam-modal-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 20px;
    box-sizing: border-box;
}

.webcam-modal-img.fit {
    max-width: 90vw;
    max-height: 90vh;
    cursor: zoom-in;
    object-fit: contain;
    margin: auto;
}

.webcam-modal-img.original {
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    cursor: zoom-out;
    object-fit: none;
    margin: auto;
    min-width: 0;
    min-height: 0;
    /* Ensure image can be scrolled to show all parts */
    flex-shrink: 0;
}

.webcam-modal-img.original.scaled {
    width: 80vw !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    min-width: 0 !important;
    object-fit: contain !important;
}

body.modal-open {
    overflow: hidden;
}