/* ============================================================
   VERLOF PLANNER 2026 — Mobile & Sidebar Styles
   ============================================================ */

/* ==================== SIDEBAR SCROLL NAVIGATOR ====================
   Always visible at all viewport widths.
   Replaces the native scrollbar as a custom page navigator.
   ================================================================ */

.page-sidebar {
    position: fixed;
    right: 0;
    top: var(--header-height, 0px);
    bottom: 0;
    width: 36px;
    z-index: 90;
    background: #fff;
    border-left: 1px solid rgba(15, 23, 42, 0.08);
    user-select: none;
    cursor: pointer;
    overflow: hidden;
}

.sidebar-labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.sidebar-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    line-height: 1;
    color: rgba(15, 23, 42, 0.4);
    white-space: nowrap;
    pointer-events: none;
}

.sidebar-label-icon {
    font-size: 13px;
    color: rgba(15, 23, 42, 0.5);
}

.sidebar-label-icon svg {
    width: 13px;
    height: 13px;
    display: block;
}

.sidebar-divider {
    width: 14px;
    height: 1px;
    background: rgba(15, 23, 42, 0.15);
}

.sidebar-label-wk {
    font-size: 7px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(15, 23, 42, 0.35);
    text-transform: uppercase;
}

.sidebar-label-week {
    font-size: 11px;
    font-weight: 600;
    color: rgba(15, 23, 42, 0.55);
}

.sidebar-thumb {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 44px;
    background: rgba(15, 23, 42, 0.12);
    border-radius: 9px;
    transition: background 0.15s;
    pointer-events: none;
}

.page-sidebar:hover .sidebar-thumb {
    background: rgba(15, 23, 42, 0.2);
}

/* Hide native scrollbar to avoid duplication with the sidebar */
html {
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    display: none;
}

/* Ensure content doesn't scroll under the sidebar */
.container {
    padding-right: calc(1.5rem + 44px);
}

.header-content {
    padding-right: 44px;
}

/* ==================== ELEMENTS HIDDEN ON DESKTOP ====================
   These are mobile-only elements that should not appear on desktop.
   ================================================================ */

#headerMenuBtn {
    display: none;
}

#headerMenu {
    display: none;
}

#mobileTimeline {
    display: none;
}

/* ==================== MOBILE LAYOUT (≤ 1025px) ==================== */

@media (max-width: 1025px) {

    /* ----- Header ----- */

    .subtitle {
        display: none;
    }

    .header-content {
        flex-wrap: nowrap;
        align-items: center;
        padding: 0.25rem 0.5rem 0.25rem 0.5rem;
        padding-right: 0px;
        gap: 0.5rem;
    }

    .header-left h1 {
        font-size: 1.1rem;
    }

    .header-right {
        flex-direction: row;
        align-items: center;
        gap: 0.4rem;
        flex-shrink: 0;
    }

    /* Hide desktop-only action buttons */
    #printBtn,
    #saveBtn,
    #loadBtn,
    #resetBtn {
        display: none;
    }

    /* Move lang toggle into the ... menu on mobile */
    #langToggle {
        display: none;
    }

    /* Show the ... menu button */
    #headerMenuBtn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.4);
        color: #fff;
        border-radius: 6px;
        padding: 0.3rem 0.6rem;
        font-size: 1rem;
        line-height: 1;
        cursor: pointer;
        font-family: inherit;
        letter-spacing: 0.1em;
    }

    #headerMenuBtn:hover {
        background: rgba(255, 255, 255, 0.3);
    }

    /* Floating dropdown card — anchored to top-right */
    #headerMenu {
        position: fixed;
        right: 44px;
        width: 180px;
        flex-direction: column;
        gap: 0;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 10px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
        z-index: 150;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease, transform 0.2s ease;
        transform: translateY(-4px);
        overflow: hidden;
    }

    #headerMenu.open {
        display: flex;
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    /* Language row inside the floating menu */
    #headerMenu .header-menu-lang {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.7rem 1rem;
        border-bottom: 1px solid var(--border-light);
        background: var(--bg);
    }

    #headerMenu .header-menu-lang .lang-btn {
        background: #fff;
        color: var(--text);
        border: 1px solid var(--border);
        padding: 0.25rem 0.65rem;
        border-radius: 4px;
        font-size: 0.8rem;
        font-weight: 600;
        cursor: pointer;
        font-family: inherit;
        transition: background 0.15s, color 0.15s;
    }

    #headerMenu .header-menu-lang .lang-btn.active {
        background: var(--primary);
        color: #fff;
        border-color: var(--primary);
    }

    #headerMenu .header-menu-lang .lang-sep {
        opacity: 0.4;
        font-size: 0.8rem;
        color: var(--text-muted);
    }

    #headerMenu .btn {
        width: 100%;
        padding: 0.75rem 1.1rem;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid var(--border-light);
        background: transparent;
        color: var(--text);
        text-align: left;
        font-size: 0.9rem;
        font-weight: 500;
        justify-content: flex-start;
    }

    #headerMenu .btn:last-child {
        border-bottom: none;
    }

    #headerMenu .btn:hover {
        background: var(--bg);
    }

    #headerMenu .btn-reset {
        color: var(--color-accent-dark);
    }

    /* ----- Container ----- */

    .container {
        padding: 0.75rem 0.75rem 3rem;
        padding-right: calc(0.75rem + 44px);
        gap: 0.75rem;
    }

    /* ----- Timeline table: hide on mobile ----- */

    #timelineWrapper {
        display: none;
    }

    /* ----- Mobile timeline cards: show on mobile ----- */

    #mobileTimeline {
        display: block;
        padding: 0.5rem 0;
    }

    /* ----- Week Cards ----- */

    .mobile-week-card {
        background: var(--card);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow);
        margin-bottom: 0.75rem;
        overflow: hidden;
        border: 1px solid var(--border);
    }

    .mobile-week-card.due-date-card {
        position: relative;
        border-color: var(--color-accent-dark);
        box-shadow: 0 0 0 2px rgba(230, 154, 141, 0.3);
    }

    .mobile-week-header {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.6rem 0.75rem;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        flex-wrap: wrap;
    }

    .mobile-week-num {
        font-weight: 700;
        font-size: 0.85rem;
        color: var(--text);
    }

    .mobile-week-dates {
        font-size: 0.8rem;
        color: var(--text-secondary);
    }

    /* ----- Partner Rows ----- */

    .mobile-partner-row {
        padding: 0.6rem 0.75rem;
        border-left: 3px solid var(--color-muted, #B8B5C3);
        border-bottom: 1px solid var(--border-light);
    }

    .mobile-partner-row:last-of-type {
        border-bottom: 1px solid var(--border);
    }

    .mobile-partner-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 0.4rem;
        gap: 0.5rem;
    }

    .mobile-partner-name-row {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex: 1;
        min-width: 0;
    }

    .mobile-partner-name {
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--text);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Larger copy/paste tap targets */
    .mobile-partner-header .btn-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
        border-radius: 8px;
    }

    .mobile-partner-header .btn-icon svg {
        width: 18px;
        height: 18px;
    }

    .mobile-partner-header .pc-actions {
        gap: 0.25rem;
        flex-shrink: 0;
    }

    /* ----- Day Button Row (5 days) ----- */

    .mobile-day-row {
        display: flex;
        gap: 0.3rem;
        margin-bottom: 0.35rem;
        justify-content: flex-start;
    }

    .mobile-day-row .day-col {
        flex: none;
        width: 44px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
    }

    /* Square 44×44 day buttons for touch */
    .mobile-day-row .day-btn,
    .mobile-day-row .day-btn.clickable,
    .mobile-day-row .day-btn.off {
        width: 44px;
        height: 44px;
        min-width: unset;
        min-height: unset;
        border-radius: 8px;
    }

    /* Disable scale-up hover on mobile (causes layout shift) */
    .mobile-day-row .day-btn.clickable:hover {
        transform: none;
    }

    .mobile-hours-text {
        font-size: 0.72rem;
        color: var(--text-secondary);
        margin-top: 0.1rem;
    }

    /* ----- Childcare Row ----- */

    .mobile-childcare-row {
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
        padding: 0.5rem 0.75rem;
        border-bottom: 1px solid var(--border-light);
    }

    .mobile-section-label {
        font-size: 0.72rem;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .mobile-childcare-row .cc-days {
        display: flex;
        gap: 0.3rem;
        justify-content: flex-start;
    }

    /* Childcare dots: same width as day buttons so they align vertically */
    .mobile-childcare-row .cc-dot {
        width: 44px;
        height: 36px;
        flex: none;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
        font-size: 0.85rem;
    }

    /* ----- Notes ----- */

    .mobile-notes {
        padding: 0.5rem 0.75rem;
    }

    .mobile-notes .td-notes-holiday {
        font-size: 0.78rem;
        color: var(--color-accent-dark);
        background: var(--color-accent-light);
        border-radius: 4px;
        padding: 0.2rem 0.4rem;
        margin-bottom: 0.35rem;
        display: inline-block;
    }

    .mobile-notes .week-note-input {
        width: 100%;
        font-size: 0.8rem;
        padding: 0.4rem 0.5rem;
        border: 1px solid var(--border);
        border-radius: 6px;
        resize: vertical;
        min-height: 48px;
        font-family: inherit;
        background: var(--bg);
        color: var(--text);
    }

    .mobile-notes .week-note-input:focus {
        outline: none;
        border-color: var(--primary);
        background: var(--card);
    }

    .mobile-notes .expired-leave-widget {
        margin-bottom: 0.35rem;
    }

    /* ----- Full-width action buttons ----- */

    .timeline-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
    }

    .timeline-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* ----- Settings spacing ----- */

    .settings-section .card-body {
        padding: 0.75rem;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    /* ----- Collapsible sections: tighter on mobile ----- */

    .card {
        border-radius: var(--radius);
    }

    /* ----- Bottom sheet day popover ----- */

    .day-popover-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
    }

    .day-popover-backdrop.visible {
        display: block;
    }

    .day-popover {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 36px !important;
        top: auto !important;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
        transform: translateY(110%) !important;
        min-width: unset !important;
        width: auto !important;
        opacity: 1 !important;
        transition: transform 0.28s ease !important;
        z-index: 1000;
        padding: 1rem;
    }

    .day-popover.visible {
        transform: translateY(0) !important;
        opacity: 1 !important;
    }

    /* 2-column grid but bigger tap targets */
    .day-popover-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.65rem;
    }

    .popover-option {
        min-height: 64px;
        border-radius: 10px;
        padding: 0.6rem 0.4rem;
    }

    .popover-option svg {
        width: 22px;
        height: 22px;
    }

    .popover-label {
        font-size: 0.72rem;
    }
}