/* Base CSS for LiteIM - Dark Minimal Theme */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent: #6366f1;
    --accent-dark: #4f46e5;
    --border: #333333;
    --error: #ef4444;
    --success: #22c55e;
}

html,
body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.mobile-only {
    display: none;
}

.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: flex;
}

#chat-page.page.active {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* 认证页面样式 */
#auth-page {
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.logo {
    font-size: 3rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-size: 0.9rem;
}

.auth-form {
    display: none;
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.auth-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.auth-form button {
    width: 100%;
    padding: 0.75rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-form button:hover {
    background: var(--accent-dark);
}

.switch-form {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-secondary);
}

.switch-form a {
    color: var(--accent);
    text-decoration: none;
}

.switch-form a:hover {
    text-decoration: underline;
}

.error-message {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: 4px;
    color: var(--error);
    display: none;
}

.error-message.show {
    display: block;
}

/* 聊天页面样式 */
.chat-container {
    display: flex;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.sidebar {
    width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sidebar-backdrop {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 80;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    margin-bottom: 1rem;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.user-info span {
    color: var(--text-secondary);
}

.user-info button {
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
}

.user-info button:hover {
    background: var(--bg-primary);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 1rem;
}

.chat-list .placeholder {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.welcome h1 {
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
}

.welcome>p {
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.phase-info {
    max-width: 600px;
    text-align: left;
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.phase-info h3 {
    margin: 1.5rem 0 0.75rem 0;
    font-size: 1.1rem;
}

.phase-info h3:first-child {
    margin-top: 0;
}

.phase-info ul {
    list-style: none;
    padding-left: 0;
}

.phase-info li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
}

.phase-info li:before {
    content: "• ";
    color: var(--accent);
    font-weight: bold;
    margin-right: 0.5rem;
}

@media (max-width: 768px) {
    .mobile-only {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .auth-container {
        padding: 1.25rem;
    }

    .auth-form {
        padding: 1.25rem;
    }

    .auth-form input {
        font-size: 16px;
    }

    .sidebar {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(360px, 86vw);
        max-width: 100%;
        z-index: 90;
        transform: translateX(-110%);
        transition: transform 0.2s ease-out;
        will-change: transform;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    .sidebar-header {
        padding: 1rem;
    }

    .user-info {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.5rem;
    }

    .user-info span {
        width: 100%;
    }
}

/* Export Dialog Styles */
.export-options {
    margin: 1.5rem 0;
}

.export-options h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.export-option {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.export-option:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}

.export-option input[type="radio"] {
    margin-right: 0.75rem;
    cursor: pointer;
}

.export-option span {
    color: var(--text-primary);
}

.export-info {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 1rem 0;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-small {
    padding: 0.35rem 0.6rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.btn-small:hover {
    background: var(--bg-primary);
}

/* ── 图片灯箱 Lightbox ──────────────────────────────────────── */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: lb-fadein 0.18s ease;
}
@keyframes lb-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.lightbox-overlay.open {
    display: flex;
}
.lightbox-img-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 95vw;
    max-height: 95vh;
    cursor: default;
}
.lightbox-img-wrap img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.7);
    animation: lb-scalein 0.18s ease;
    user-select: none;
    -webkit-user-drag: none;
}
@keyframes lb-scalein {
    from { transform: scale(0.92); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}
.lightbox-close {
    position: fixed;
    top: 16px;
    right: 20px;
    font-size: 2rem;
    color: rgba(255,255,255,0.8);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 4px 10px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    z-index: 10001;
}
.lightbox-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.12);
}
.lightbox-prev,
.lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.2rem;
    color: rgba(255,255,255,0.7);
    background: rgba(0,0,0,0.35);
    border: none;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: 8px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
    z-index: 10001;
    min-width: 52px;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox-prev:hover,
.lightbox-next:hover {
    color: #fff;
    background: rgba(0,0,0,0.7);
}
.lightbox-prev[hidden],
.lightbox-next[hidden] {
    display: none;
}
.lightbox-counter {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.65);
    font-size: 0.85rem;
    pointer-events: none;
}
/* 聊天图片可点击提示 */
.message-image {
    cursor: zoom-in;
    border-radius: 6px;
    max-width: min(340px, 72vw);
    display: block;
}
