/* ── alibiai shared mobile styles ─────────────────────────────────
 * Loaded on all pages. Complements rtl.css.
 * iOS Safari + Android Chrome focus.
 */

/* ── 1. Touch & tap resets ─────────────────────────────────────── */
*, *::before, *::after {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}
input, textarea, select, button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* ── 2. iOS safe-area support ──────────────────────────────────── */
body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── 3. Smooth momentum scrolling everywhere ───────────────────── */
.chat-area,
.sessions-section,
.courts-scroll,
#sidebarCasesWrap,
.sidebar-nav {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* ── 4. Prevent zoom on form inputs (iOS) ─────────────────────── */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ── 5. Modal bottom-sheet on small phones ─────────────────────── */
@media (max-width: 480px) {
    .modal {
        align-items: flex-end !important;
    }
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 16px 16px 0 0 !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
}

/* ── 6. Left-panel collapse / expand toggle ─────────────────────── */

/* Toggle row: always a visible colored bar on mobile */
.panel-toggle-row {
    display: none; /* hidden by default — shown only on mobile below */
}

@media (max-width: 768px) {
    .panel-toggle-row {
        display: flex !important;
        flex-shrink: 0;
        width: 100%;
    }
    .panel-toggle-btn {
        width: 100%;
        min-height: 36px;
        border: none;
        background: #1a56a0;
        color: #fff;
        cursor: pointer;
        font-size: 0.78rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        touch-action: manipulation;
        letter-spacing: 0.02em;
    }
    .panel-toggle-btn:active {
        background: #1e429f;
    }

    /* Collapsed state — .page/.panel-left (legal_precedents, context_cache)
       AND .layout/.left-panel (voice_analysis) */
    .page.panel-collapsed .panel-left,
    .layout.panel-collapsed .left-panel {
        width: 38px !important;
        min-width: 38px !important;
        height: 100vh !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        cursor: pointer !important;
        background: #1a56a0 !important;
        display: block !important;
        padding-top: 48vh !important;
        text-align: center !important;
    }
    /* Hide every child — the panel itself is the click zone */
    .page.panel-collapsed .panel-left > *,
    .layout.panel-collapsed .left-panel > * {
        display: none !important;
    }
    /* Arrow appears at 48vh from top — visually centred */
    .page.panel-collapsed .panel-left::after,
    .layout.panel-collapsed .left-panel::after {
        content: '\00AB';
        display: block;
        color: #fff;
        font-size: 1.6rem;
        line-height: 1;
        text-align: center;
        pointer-events: none;
    }
}
