/* Date Selector Styles */
:root {
    --dashboard-max-width: 1200px;
}

.controls-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-evenly;
    gap: 25px;
    flex-wrap: wrap;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
    justify-content: flex-start;
}

.control-group-no-label {
    padding-top: 25px; /* Push down to align with input elements below labels */
}

.control-group label {
    font-weight: 600;
    font-size: 14px;
    color: #24292e;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-group select,
.control-group input[type="date"],
.control-group input[type="text"],
.control-group .animate-button {
    padding: 10px 14px;
    border: 2px solid #e1e4e8;
    border-radius: 6px;
    font-size: 14px;
    background-color: white;
    min-width: 150px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.control-group select:focus,
.control-group input[type="date"]:focus,
.control-group input[type="text"]:focus,
.control-group .animate-button:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 3px rgba(0, 122, 204, 0.15), 0 2px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.control-group select:hover,
.control-group input[type="date"]:hover,
.control-group input[type="text"]:hover,
.control-group .animate-button:hover {
    border-color: #b3d9ff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Date input container with navigation buttons */
.date-input-container {
    display: flex;
    align-items: center;
    gap: 4px;
}

.date-input-container input[type="date"] {
    flex: 1;
    min-width: 150px;
}

.year-nav-button {
    padding: 8px 10px;
    border: 2px solid #e1e4e8;
    border-radius: 4px;
    font-size: 12px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-width: 32px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #586069;
}

.year-nav-button:hover {
    border-color: #b3d9ff;
    background-color: #f8f9fa;
    color: #24292e;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.year-nav-button:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 3px rgba(0, 122, 204, 0.15);
}

.year-nav-button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.year-nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f6f8fa;
}

.year-nav-button:disabled:hover {
    border-color: #e1e4e8;
    background-color: #f6f8fa;
    color: #586069;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transform: none;
}

/* Sensor selection specific styles */
.sensor-selection {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 300px;
    max-width: 300px;
}

.sensor-selection input[type="text"] {
    min-width: unset;
    padding: 8px 12px;
    font-size: 13px;
}

.sensor-selection select {
    min-width: unset;
    min-height: 100px;
    max-height: 100px;
    cursor: pointer;
    font-size: 13px;
    padding: 6px 10px;
}

.sensor-selection select option {
    padding: 4px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Custom dropdown styles */
.dropdown-container {
    position: relative;
    width: 100%;
}

.dropdown-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 2px solid #e1e4e8;
    border-radius: 6px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 42px;
    box-sizing: border-box;
}

.dropdown-selected:hover {
    border-color: #b3d9ff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.dropdown-selected:focus,
.dropdown-selected.open {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 3px rgba(0, 122, 204, 0.15), 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dropdown-arrow {
    transition: transform 0.2s ease;
    font-size: 12px;
    color: #586069;
}

.dropdown-selected.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #007acc;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    max-height: 200px;
    overflow: hidden;
}

.dropdown-content.open {
    display: block;
}

.dropdown-content input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid #e1e4e8;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.dropdown-content input[type="text"]:focus {
    border-bottom-color: #007acc;
}

.dropdown-options {
    max-height: 150px;
    overflow-y: auto;
}

.dropdown-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f6f8fa;
    transition: background-color 0.15s ease;
}

.dropdown-option:hover {
    background-color: #f6f8fa;
}

.dropdown-option:last-child {
    border-bottom: none;
}

.dropdown-option.selected {
    background-color: #007acc;
    color: white;
}

.dropdown-option.no-results {
    color: #586069;
    font-style: italic;
    cursor: default;
}

.dropdown-option.no-results:hover {
    background-color: transparent;
}

/* Animate button specific styles */
.animate-button {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #24292e;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-width: 50px;
    width: 50px;
    height: 42px;
    font-size: 16px;
}

.animate-button .animate-text {
    display: flex;
    align-items: center;
    justify-content: center;
}

.animate-button.animating {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-color: #28a745;
}

.animate-button.animating:hover {
    border-color: #1e7e34;
    background: linear-gradient(135deg, #1e7e34 0%, #17a2b8 100%);
}

.data-indicator {
    font-size: 12px;
    text-align: center;
    margin-bottom: 20px;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.data-indicator.loading {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.data-indicator.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.data-indicator.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.data-indicator.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(53, 11px);
    grid-template-rows: repeat(7, 11px);
    gap: 3px;
    background-color: #fafbfc;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e1e4e8;
    grid-auto-flow: column;
}

.calendar-day {
    width: 11px;
    height: 11px;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid rgba(27, 31, 35, 0.06);
    opacity: 0.8;
}

.calendar-day:hover {
    border-color: rgba(27, 31, 35, 0.15);
    transform: scale(1.1);
    z-index: 1;
    position: relative;
    opacity: 1;
}

.calendar-day.selected-date {
    border: 2px solid #007acc;
    transform: scale(1.05);
    z-index: 2;
    position: relative;
    box-shadow: 0 0 6px rgba(0, 122, 204, 0.4);
    opacity: 1;
}



/* Tooltip Styles */
.tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.tooltip.visible {
    opacity: 1;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

/* Legend */
.legend {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 12px;
    color: #586069;
    justify-content: center;
    flex-wrap: wrap;
    padding: 15px;
    background-color: #f6f8fa;
    border-radius: 6px;
}

.legend > span {
    font-weight: 600;
    margin-right: 5px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* Month labels */
.month-labels {
    display: grid;
    grid-template-columns: repeat(53, 12px);
    grid-template-rows: 15px;
    gap: 2px;
    margin-bottom: 5px;
    font-size: 10px;
    color: #586069;
}

.month-label {
    font-size: 10px;
    font-weight: 500;
    display: flex;
    align-items: center;
}

/* Weekday labels */
.weekday-labels {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-right: 8px;
    font-size: 10px;
    color: #586069;
    justify-content: flex-start;
    height: calc(7 * 12px + 6 * 2px);
    margin-top: 20px; /* Align with calendar grid which has month labels above it */
    padding-top: 15px; /* Match the calendar grid padding */
}

.weekday-labels div {
    height: 12px;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.calendar-wrapper {
    display: flex;
    align-items: flex-start;
    margin: 0 auto;
    width: fit-content;
    overflow: visible;
    max-width: 100%;
}


.graph-title {
    font-size: 18px;
    font-weight: 600;
    color: #24292e;
    margin: 0 0 10px 0;
    text-align: center;
}
h1.graph-title {
    font-size: 24px;
    font-weight: 700;
}

.graph-subtitle {
    font-size: 16px;
    color: #586069;
    margin: 0;
    text-align: center;
}
.graph-footer {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    margin-top: 20px;
}

.graph-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    height: 400px;
    color: #586069;
    font-size: 16px;
}

.graph-loading::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e1e4e8;
    border-radius: 50%;
    border-top-color: #0366d6;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.graph-no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #586069;
    font-size: 16px;
    flex-direction: column;
    gap: 10px;
}

.graph-no-data-icon {
    font-size: 48px;
    opacity: 0.5;
}

/* Graph SVG Styles */
.water-level-graph svg {
    width: 100%;
    height: 350px;
    overflow: visible;
}

.water-level-line {
    fill: none;
    stroke: #0366d6;
    stroke-width: 2;
}

.water-level-area {
    fill: url(#waterGradient);
    opacity: 0.3;
}

.water-level-dots .dot {
    fill: #0366d6;
    stroke: white;
    stroke-width: 2;
    cursor: pointer;
    transition: all 0.2s ease;
}

.water-level-dots .dot:hover {
    fill: #0256cc;
    r: 6;
}

.axis {
    font-size: 12px;
}

.axis .domain {
    stroke: #d1d5da;
}

.axis .tick line {
    stroke: #d1d5da;
}

.axis .tick text {
    fill: #586069;
}

.axis-label {
    font-size: 14px;
    font-weight: 600;
    fill: #24292e;
}

.grid-line {
    stroke: #e1e4e8;
    stroke-dasharray: 3,3;
    opacity: 0.7;
}

.warning-levels {
    opacity: 0.6;
}

.warning-level-1 {
    fill: #ffa500;
    stroke: #ff8c00;
    stroke-width: 1;
    stroke-dasharray: 5,5;
}

.warning-level-2 {
    fill: #ff6347;
    stroke: #ff4500;
    stroke-width: 1;
    stroke-dasharray: 5,5;
}

.warning-level-3 {
    fill: #dc143c;
    stroke: #b22222;
    stroke-width: 1;
    stroke-dasharray: 5,5;
}

.graph-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.graph-tooltip.visible {
    opacity: 1;
}

.graph-tooltip strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.graph-stats {
    display: flex;
    justify-content: space-evenly;
    margin-top: 5px;
    padding: 15px;
    background: #f6f8fa;
    border-radius: 6px;
    font-size: 14px;
}
.graph-stats.legend {
    justify-content: center;
    gap: 20px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #0366d6;
    display: block;
}

.stat-label {
    color: #586069;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Interactive hover line styles */
.hover-line {
    stroke: #666;
    stroke-width: 1px;
    stroke-dasharray: 3,3;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s ease;
}

.hover-line.visible {
    opacity: 0.7;
}

.hover-point {
    fill: #0366d6;
    stroke: white;
    stroke-width: 3;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s ease;
}

.hover-point.visible {
    opacity: 1;
}

.hover-point.average {
    fill: #86909c;
}

/* Selected date marker styles */
.selected-date-line {
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.selected-point {
    pointer-events: none;
    transition: all 0.2s ease;
}

.selected-point.current {
    fill: #007acc;
}

.selected-point.average {
    fill: #007acc;
}

.graph-overlay {
    fill: transparent;
    cursor: crosshair;
}

/* Two Week Water Level Graph Styles */
.two-week-water-level-graph-container {
    background: transparent;
    border: none;
    border-radius: 0;
    margin: 0;
    padding: 0;
    box-shadow: none;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Fixed height for two-week graph container to prevent layout shifts */
#two-week-graph-container {
    min-height: 510px;
}


/* Two week graph specific styles */
.two-week-water-level-graph {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: flex;
    justify-content: center;
    align-items: center;
}

.two-week-water-level-graph svg {
    max-width: 100%;
    max-height: 100%;
}

.two-week-water-line {
    stroke-linecap: round;
    stroke-linejoin: round;
}

.data-point {
    transition: all 0.2s ease;
}

.data-point:hover {
    r: 5;
    stroke-width: 2;
}

.selected-date-line {
    pointer-events: none;
}

/* Two week graph tooltip */
.two-week-graph-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.two-week-graph-tooltip.visible {
    opacity: 1;
}

.two-week-graph-tooltip strong {
    display: block;
    margin-bottom: 4px;
    color: #fff;
}

/* Two week graph legend */
.two-week-graph-legend text {
    font-size: 12px;
    fill: #24292f;
}

.two-week-graph-legend line {
    stroke-linecap: round;
}

.two-week-graph-legend circle {
    stroke-linecap: round;
}

/* Ensure proper spacing between graphs */
#two-week-water-level-graph {
    margin-top: 15px;
    margin-bottom: 20px;
}

/* Warning level styles for two week graph */
#two-week-water-level-graph .warning-level-line {
    pointer-events: none;
}

#two-week-water-level-graph .warning-level-label {
    pointer-events: none;
    font-size: 11px;
    font-weight: bold;
}

#two-week-water-level-graph .warning-level-label-bg {
    pointer-events: none;
}


#two-week-graph-stats {
    margin-top: 40px;
}

#calendar-legend {
    margin-top: 20px;
}