@import url('https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wght@8..144,400;8..144,500;8..144,600;8..144,700;8..144,900&display=swap');

/* CSS Custom Properties */
:root {
    /* Colors */
    --color-primary: #0EBCEC;
    --color-danger: #dc2626;
    --color-navy: #00172D;
    --color-slate: rgb(15, 23, 42);
    --color-gray-light: #f8fafc;
    --color-gray-medium: #64748b;
    --color-gray-border: #ecf0f1;
    --color-gray-icon: #95a5a6;

    /* Stripe pattern for unavailable state */
    --pattern-stripes: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        rgba(255,255,255,0.2) 2px,
        rgba(255,255,255,0.2) 4px
    );
}

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

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}


body {
    font-family: 'Roboto Flex', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    color: var(--color-navy);
    background-color: white;
}

/* Header */
header {
    text-align: center;
    padding: 2rem 1rem 1rem;
}

header h1 {
    font-size: 3rem;
    font-weight: 900;
    color: var(--color-navy);
    margin-bottom: 1rem;
    letter-spacing: -0.05em;
    text-transform: uppercase;
}

#official-selector {
    font-size: 3rem;
    font-weight: 900;
    border: none;
    background: transparent;
    color: var(--color-navy);
    cursor: pointer;
    letter-spacing: -0.05em;
    text-transform: uppercase;
    vertical-align: baseline;
    margin: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300172D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: calc(100% - 0.1em) center;
    background-size: 0.4em;
    padding-right: 0.6em;
    /* Default width sized to ERIC (approximately 120px with padding) */
    width: 120px;
}

#official-selector:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.pre-intro, .intro, .post-intro {
    font-size: 0.9rem;
    color: var(--color-slate);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;

    b a {
        color: inherit;
    }
}

/* Politician links */
.politician-links {
    text-align: center;
    margin: 1rem auto 0.5rem;
    max-width: 600px;
    padding: 0 1rem;
    font-size: 0.8rem;
    color: var(--color-slate);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.politician-links-label {
    margin: 0;
}

.politician-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0;
}

.politician-list li {
    display: inline;
}

.politician-list li:not(:last-child)::after {
    content: ",\00a0";
}

.politician-link {
    color: inherit;
    text-decoration: underline;
}

/* Hide politician links based on current selection */
.current-eric #link-eric,
.current-kathy #link-kathy,
.current-andrew #link-andrew,
.current-bill #link-bill {
    display: none;
}

/* Hide trailing comma when Andrew is selected (Bill becomes last item) */
.current-andrew #link-bill::after {
    display: none;
}

/* Show/hide intro text based on current selection */
.intro {
    display: none;
}

.current-eric #intro-eric,
.current-kathy #intro-kathy,
.current-andrew #intro-andrew,
.current-bill #intro-bill {
    display: block;
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1rem auto;
    max-width: 600px;
    padding: 0 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--color-slate);
}

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

.legend-color.available {
    background-color: var(--color-primary);
}

.legend-color.unavailable {
    background-color: var(--color-danger);
    background-image: var(--pattern-stripes);
}

.legend-color.no-data {
    background-color: var(--color-gray-light);
    border: 1px solid var(--color-gray-medium);
}

/* Main calendar container */
#calendar-container {
    padding: 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
}

footer a {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-slate);
    text-decoration: none;
    margin: 0 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

footer a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.loading {
    text-align: center;
    padding: 4rem;
    font-size: 1.1rem;
    color: var(--color-slate);
    font-weight: 500;
}

/* Months grid */
.months-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
    justify-items: center;
}

/* Individual month */
.month {
    width: 100%;
    max-width: 240px;
}

.month-header {
    text-align: center;
    font-weight: 600;
    color: var(--color-navy);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Calendar grid for each month */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
}

/* Day headers removed for minimal design */

.day-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    min-height: 20px;
}

.day-cell:hover {
    transform: scale(1.1);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.day-cell.other-month {
    visibility: hidden;
}

.day-cell.available {
    background-color: var(--color-primary);
    color: white;
    font-weight: 600;
}

.day-cell.unavailable {
    background-color: var(--color-danger);
    background-image: var(--pattern-stripes);
    color: white;
    font-weight: 600;
}

.day-cell.no-data {
    background-color: var(--color-gray-light);
    color: var(--color-slate);
    opacity: 0.6;
}


/* Popup styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.popup-overlay.hidden {
    display: none;
}

.popup-content {
    background: white;
    max-width: 500px;
    width: 90%;
    max-height: 70vh;
    overflow-y: auto;
    position: relative;
}

.popup-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--color-gray-icon);
    z-index: 1001;
}

.popup-close:hover {
    color: var(--color-primary);
}

.popup-header {
    padding: 1rem;
    border-bottom: 1px solid var(--color-gray-border);
}

.popup-header h3 {
    color: var(--color-navy);
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.popup-header a {
    color: var(--color-slate);
    font-weight: 500;
}

.popup-header a:hover {
    color: var(--color-primary);
}

#popup-body {
    padding: 1rem;
}

.official-schedule {
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-gray-border);
}

.official-name {
    font-weight: 600;
    color: var(--color-navy);
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.official-name a {
    color: inherit;
    text-decoration: none;
}

.official-name a:hover {
    color: var(--color-primary);
}

.external-icon {
    font-size: 0.7rem;
    color: var(--color-gray-icon);
    transition: color 0.2s;
}

.official-name:hover .external-icon {
    color: var(--color-primary);
}

.schedule-status {
    font-size: 0.7rem;
    margin-bottom: 0.3rem;
}


.schedule-status.unavailable {
    color: var(--color-danger);
    font-weight: 600;
}

.schedule-text {
    line-height: 1.5;
    color: var(--color-slate);
    font-size: 0.85rem;
}

/* Responsive design */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

    .legend {
        gap: 1rem;
    }

    #calendar-container {
        padding: 1rem;
    }

    .months-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .popup-content {
        width: 95%;
        margin: 1rem;
    }

}

@media (max-width: 480px) {
    .day-cell {
        font-size: 0.7rem;
    }
}
