/**
 * Holos AI - Modals, Dialogs & Mobile Drawer Stylesheet
 * Architecture: Modular Engine (< 500 lines)
 */

/* ── 2-Column Settings Modal (Screenshot 3 Exact Match) ── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    padding: 24px;
    width: 420px;
    max-width: 90vw;
    position: relative;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.15);
}

/* ── Auth Modal Refined Styles ── */
.auth-modal-box {
    max-width: 380px;
    padding: 30px 24px;
    border-radius: 26px;
}

.auth-btn-google {
    width: 100%;
    height: 44px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.auth-btn-google:hover {
    background: var(--bg-elevated);
    border-color: var(--border-card);
}

.auth-divider-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
}

.auth-divider-line {
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

.auth-divider-text {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.auth-email-form-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-pill-input {
    width: 100%;
    height: 44px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    padding: 0 18px;
    font-size: 0.9rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.auth-pill-input:focus {
    border-color: var(--border-card);
}

.auth-otp-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.auth-otp-row .auth-pill-input {
    flex: 1;
    min-width: 0;
}

.auth-btn-send-code {
    height: 44px;
    padding: 0 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 0.86rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    flex-shrink: 0;
    outline: none;
}

.auth-btn-send-code:hover {
    background: var(--bg-secondary);
    border-color: var(--border-card);
}

.auth-btn-send-code:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-btn-submit {
    width: 100%;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
    transition: opacity 0.18s ease, transform 0.15s ease;
    outline: none;
}

.auth-btn-submit:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}


/* ── Mobile Responsive ── */
@media (max-width: 768px) {
    .app-layout {
        height: 100%;
        height: 100dvh;
        min-height: -webkit-fill-available;
    }

    .chat-main {
        height: 100%;
        height: 100dvh;
        min-height: -webkit-fill-available;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        height: 100dvh;
        min-height: -webkit-fill-available;
        padding-bottom: max(20px, env(safe-area-inset-bottom));
        box-sizing: border-box;
        z-index: 100;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
        pointer-events: none;
    }

    .sidebar-bottom {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        flex-shrink: 0;
    }

    /* 移动端输入框浮层与防遮挡 */
    .chat-input-wrapper {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        padding: 8px 12px max(12px, env(safe-area-inset-bottom));
        z-index: 50;
    }

    .chat-viewport {
        padding-bottom: 160px !important; /* 给底部留出足够滚动空间 */
    }

    .bottom-input-container {
        border-radius: 14px;
        padding: 10px 12px;
    }

    .settings-dialog-card {
        flex-direction: column;
        height: 85vh;
        height: 85dvh;
    }

    .settings-left-col {
        width: 100%;
        height: 180px;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }
}

/* ── Global Image Lightbox Preview ── */
.image-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: zoom-out;
}

.image-lightbox-overlay.show {
    opacity: 1;
}

.image-lightbox-container {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: default;
}

.image-lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    user-select: none;
}

.image-lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease;
    z-index: 2010;
}

.image-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.38);
    transform: scale(1.08);
}

