/* Reset and base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #fff;
    color: #000;
    line-height: 1.3;
    font-size: 11px;
}

.back-link.top {
    display: block;
    padding: 10px 20px;
    font-size: 11px;
    color: #000;
    text-decoration: none;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px 20px;
    border-bottom: 2px solid #000;
}

.header-title {
    flex: 1;
    text-align: left;
}

.header-title h1 {
    font-size: 22px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.header-title .subtitle {
    font-size: 12px;
    font-weight: bold;
}

.header-year {
    font-size: 32px;
    font-weight: bold;
    margin-left: 20px;
}

/* Source Note */
.source-note {
    display: flex;
    justify-content: flex-start;
    padding: 8px 20px;
    background: #f0f0f0;
    font-size: 11px;
}

.source-note a {
    color: #000;
    text-decoration: underline;
    margin-left: 5px;
}

/* Controls Panel */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 12px 20px;
    border-bottom: 2px solid #000;
    background: #f8f8f8;
    align-items: flex-end;
    position: sticky;
    top: 0;
    z-index: 100;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-group label {
    font-size: 11px;
    font-weight: bold;
}

.control-group select {
    font-family: inherit;
    font-size: 11px;
    padding: 4px;
}

/* Dual-Handle Range Sliders */
.range-container {
    position: relative;
    width: 150px;
    height: 30px;
}

.range-container input[type="range"] {
    position: absolute;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    background: none;
    z-index: 2;
    margin: 0;
}

.range-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.range-container input[type="range"]::-moz-range-thumb {
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.slider-track {
    position: absolute;
    width: 100%;
    height: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: #ddd;
    border-radius: 2px;
    z-index: 1;
}

/* Checkboxes */
.checkbox-group {
    display: flex;
    gap: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 1px solid #000;
    border-radius: 0;
    background: #fff;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '';
    width: 4px;
    height: 8px;
    border: solid #000;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.filter-summary {
    font-size: 11px;
    color: #333;
    flex: 1;
    text-align: right;
    font-weight: bold;
    white-space: nowrap;
    align-self: center;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #fff;
    gap: 1px;
    border: 2px solid #000;
}

.month {
    background: #fff;
    border: 1px solid #000;
}

.month-header {
    display: flex;
    justify-content: space-between;
    padding: 5px 8px;
    font-weight: bold;
    font-size: 12px;
    border-bottom: 1px solid #000;
    text-transform: uppercase;
    background: #fff;
    position: sticky;
    top: var(--controls-height, 75px);
    z-index: 90;
}

.month-header .col-header {
    display: flex;
    gap: 15px;
    margin-right: 10px;
}

.month-header .col-header span {
    width: 30px;
    text-align: center;
}

.month-days {
    display: flex;
}

.month-col {
    flex: 1;
}

.day-row {
    display: flex;
    padding: 4px;
    height: 85px;
    font-family: Arial, sans-serif;
}

.day-row:hover {
    background: #f9f9f9;
}

.day-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 25px;
    margin-right: 5px;
}

.day-num {
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
}

.day-abbr {
    font-size: 10px;
    font-weight: bold;
    margin-top: 2px;
}

.tides-list {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: flex-start;
}

.tide-entry {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    line-height: 1.25;
}

.tide-entry.highlighted {
    background: #ffeb3b;
    font-weight: bold;
}

.tide-entry.dimmed {
    color: #ccc;
}

.tide-height {
    font-weight: normal;
}

/* Footer */
.footer {
    padding: 20px;
    border-top: 3px solid #000;
    font-size: 11px;
    color: #000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: center;
}

.footer-section.disclaimer {
    font-style: italic;
}

.loading {
    text-align: center;
    padding: 50px;
    font-size: 16px;
}

/* Responsive */
@media (min-width: 600px) {
    .calendar-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .range-container {
        height: 40px;
    }

    .range-container input[type="range"]::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }

    .range-container input[type="range"]::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }
}