/* ============================================
   PAGE LAYOUT
   Two-column grid: main content + quick-info
   sidebar, at 1300px+. Below that the sidebar
   becomes an off-canvas drawer (see below)
   instead of taking up its own row.
   ============================================ */

.page-layout {
    display: grid;
    grid-template-columns: 1fr;
}

@media screen and (min-width: 1300px) {
    .page-layout {
        grid-template-columns: var(--sidebar-width) 1fr;
        align-items: start;
        gap: 0;
    }

    /* HTML order keeps <main> first for accessibility/reading order;
       reorder visually so the sidebar renders on the left, as before. */
    .page-layout main {
        order: 2;
    }

    .quick-info-sidebar {
        order: 1;
    }
}

/* ============================================
   QUICK INFO SIDEBAR
   Below 1300px this is an off-canvas drawer,
   toggled via the edge tab (.sidebar-toggle)
   and closed by its backdrop, Escape, or the
   tab itself. At 1300px+ it's a normal sticky
   column again (media query further down).
   ============================================ */

.quick-info-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(85vw, 340px);
    height: 100vh;
    background: var(--color-cream);
    border-right: 4px solid var(--color-red);
    box-shadow: var(--shadow-brand);
    overflow-y: auto;
    z-index: 9100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.quick-info-sidebar.open {
    transform: translateX(0);
}

@media screen and (min-width: 1300px) {
    .quick-info-sidebar {
        position: sticky;
        top: var(--header-height);
        left: auto;
        width: auto;
        height: calc(100vh - var(--header-height));
        transform: none;
        transition: none;
        z-index: auto;
    }
}

/* Edge tab that opens/closes the drawer below 1300px. Tracks the drawer's
   open/closed edge (matching the original site's same left-edge-tab
   pattern) so it's always reachable to close, even while the drawer
   is open and would otherwise sit underneath it. */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 32px;
    height: 64px;
    background: var(--color-red);
    border: none;
    border-radius: 0 8px 8px 0;
    color: var(--color-white);
    cursor: pointer;
    z-index: 9200;
    box-shadow: var(--shadow-brand);
    transition: left 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-toggle-icon {
    font-size: 1.1rem;
    line-height: 1;
    transition: transform 0.3s ease;
}

.sidebar-toggle[aria-expanded="true"] {
    left: min(85vw, 340px);
}

.sidebar-toggle[aria-expanded="true"] .sidebar-toggle-icon {
    transform: rotate(180deg);
}

@media screen and (min-width: 1300px) {
    .sidebar-toggle {
        display: none;
    }
}

.mobile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
    z-index: 9000;
}

.mobile-backdrop.active {
    display: block;
}

.sidebar-panel {
    padding: 0.5rem 1.5rem 1.5rem;
}

.sidebar-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    /* Dark orange (not red) so it doesn't compete with the red frequency text below it. */
    color: var(--color-brown);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0;
}

.sidebar-section-title:not(:first-child) {
    margin-top: 1rem;
}

.upcoming-nets-title {
    margin-bottom: 0.3rem;
}

.quick-repeater,
.quick-net {
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--border-color);
}

.quick-repeater:last-of-type,
.quick-net:last-of-type {
    border-bottom: none;
}

.repeater-header,
.net-header {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.repeater-freq {
    color: var(--color-red);
    font-weight: 700;
    white-space: nowrap;
}

.net-freq {
    color: var(--color-red);
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
}

.net-freq-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    margin-top: -0.3rem;
}

/* Shared "secondary detail" text: repeater offset/CTCSS, and (matching
   that same treatment) each net's date and its USB/offset/season label. */
.repeater-details-line,
.net-date,
.net-extra {
    font-size: 0.83rem;
    color: var(--text-primary);
    font-weight: 600;
}

.repeater-details-line {
    margin-top: 0.2rem;
}

.net-calendar-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 260px;
    overflow-y: auto;
    border: 2px solid var(--color-red);
    border-radius: 6px;
    padding: 0.3rem;
    background: rgba(255, 255, 255, 0.5);
    /* Bleed slightly past .sidebar-panel's side padding — some dates were
       just barely getting clipped/wrapped at the panel's normal width. */
    margin: 0 -0.5rem;
}

.calendar-item {
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s ease;
}

.calendar-item:last-child {
    border-bottom: none;
}

.calendar-item:hover {
    background: rgba(255, 255, 255, 0.95);
}

.calendar-loading,
.calendar-empty,
.calendar-error {
    padding: 0.5rem 0.6rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

.calendar-error {
    color: var(--color-red);
}

/* Three left-aligned lines: name, date/time, frequency — plus any further
   stacked lines (extra frequencies, or a split-off mode/offset) below that. */
.calendar-net-name {
    display: block;
    font-weight: 700;
    color: var(--text-primary);
}

/* Same "date/time" treatment as the Club Nets list above. */
.calendar-datetime {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.83rem;
    color: var(--text-primary);
    font-weight: 600;
}

.calendar-freq {
    display: block;
    margin-top: 0.15rem;
    color: var(--color-red);
    font-weight: 700;
    font-size: 0.9rem;
}

.calendar-freq-list {
    margin-top: 0.15rem;
}

.calendar-freq-line {
    color: var(--color-red);
    font-weight: 700;
    font-size: 0.85rem;
}

.sidebar-show-more {
    margin-top: 1rem;
    text-align: center;
}

.show-more-link {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-red);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================
   CALENDAR ENTRY DETAIL MODAL
   Shared by the "Upcoming Nets" sidebar list and the home page's
   "Upcoming Events" feed — both are calendar entries with the same shape,
   so "see more info" means showing the same kind of detail either way.
   ============================================ */

.calendar-detail-modal {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 9500;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(17, 24, 39, 0.65);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.calendar-detail-modal.active {
    opacity: 1;
    visibility: visible;
}

.calendar-detail-modal-content {
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--color-cream);
    border: 3px solid var(--color-red);
    border-radius: 16px;
    box-shadow: var(--shadow-brand);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.2s ease;
}

.calendar-detail-modal.active .calendar-detail-modal-content {
    transform: scale(1) translateY(0);
}

.calendar-detail-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.5rem;
    background: linear-gradient(135deg, var(--color-red), var(--color-red-dark));
    border-radius: 13px 13px 0 0;
}

.calendar-detail-modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-white);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-detail-modal-close {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--color-white);
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.calendar-detail-modal-close:hover {
    opacity: 1;
}

.calendar-detail-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 1.5rem;
}

.calendar-detail-modal-row {
    display: flex;
    gap: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.5;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.calendar-detail-modal-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.calendar-detail-modal-label {
    flex-shrink: 0;
    min-width: 85px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-brown);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-detail-modal-value {
    color: var(--text-primary);
    /* Preserves real line breaks typed into a field (e.g. a multi-line
       Notes/Description) instead of collapsing them to a single line. */
    white-space: pre-line;
}

.calendar-detail-modal-value.calendar-detail-modal-freq {
    color: var(--color-red);
    font-weight: 700;
}
