/* LS Mail — Outlook Web inspired design system */

:root {
    --bg-body: #141414;
    --bg-topbar: #141414;
    --bg-rail: #141414;
    --bg-sidebar: #212121;
    --bg-main: #141414;
    --bg-list: #1f1f1f;
    --bg-reading: #141414;
    --bg-card: #292929;
    --bg-card-hover: #333333;
    --bg-input: #292929;
    --bg-hover: rgba(255, 255, 255, 0.06);
    --bg-hover-light: rgba(255, 255, 255, 0.10);
    --border-primary: #383838;
    --border-secondary: #434343;
    --border-tertiary: #5a5a5a;
    --text-primary: #ffffff;
    --text-secondary: #d2d0ce;
    --text-muted: #a19f9d;
    --text-muted-2: #8a8886;
    --accent: #479ef5;
    --accent-hover: #62abf5;
    --accent-bg: rgba(71, 158, 245, 0.14);
    --accent-bg-hover: rgba(71, 158, 245, 0.22);
    --accent-border: #479ef5;
    --unread-dot: #479ef5;
    --scrollbar: #404040;
    --scrollbar-hover: #505050;
    --shadow-color: rgba(0, 0, 0, 0.45);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.32);
    --topbar-text: #ffffff;
    --command-bar-bg: #292929;
    --search-bg: rgba(255, 255, 255, 0.08);
    --search-border: rgba(255, 255, 255, 0.12);
    --search-focus-bg: rgba(255, 255, 255, 0.12);
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-pill: 9999px;
}

:root[data-theme="light"] {
    --bg-body: #faf9f8;
    --bg-topbar: #0f6cbd;
    --bg-rail: #0f6cbd;
    --bg-sidebar: #ffffff;
    --bg-main: #faf9f8;
    --bg-list: #ffffff;
    --bg-reading: #faf9f8;
    --bg-card: #ffffff;
    --bg-card-hover: #f5f5f5;
    --bg-input: #ffffff;
    --bg-hover: rgba(0, 0, 0, 0.04);
    --bg-hover-light: rgba(0, 0, 0, 0.07);
    --border-primary: #edebe9;
    --border-secondary: #e1dfdd;
    --border-tertiary: #c8c6c4;
    --text-primary: #242424;
    --text-secondary: #424242;
    --text-muted: #616161;
    --text-muted-2: #757575;
    --accent: #0f6cbd;
    --accent-hover: #115ea3;
    --accent-bg: rgba(15, 108, 189, 0.08);
    --accent-bg-hover: rgba(15, 108, 189, 0.14);
    --accent-border: #0f6cbd;
    --unread-dot: #0f6cbd;
    --scrollbar: #c8c6c4;
    --scrollbar-hover: #a19f9d;
    --shadow-color: rgba(0, 0, 0, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --topbar-text: #ffffff;
    --command-bar-bg: #ffffff;
    --search-bg: rgba(255, 255, 255, 0.18);
    --search-border: rgba(255, 255, 255, 0.28);
    --search-focus-bg: rgba(255, 255, 255, 0.28);
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.4286;
    -webkit-font-smoothing: antialiased;
}

/* ── Shell ── */
.ls-mail-topbar {
    background: var(--bg-topbar);
    flex-shrink: 0;
    height: 48px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.ls-mail-rail {
    background: var(--bg-rail);
    width: 48px;
    flex-shrink: 0;
}

.ls-mail-sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-primary);
    width: 220px;
    flex-shrink: 0;
}

.ls-mail-main {
    background: var(--bg-main);
}

/* ── Topbar ── */
.ls-mail-search-bar {
    background: var(--search-bg);
    border: 1px solid var(--search-border);
    color: var(--topbar-text);
    border-radius: var(--radius-sm);
    transition: background 0.12s ease, border-color 0.12s ease;
}

.ls-mail-search-bar:focus {
    background: var(--search-focus-bg);
    border-color: rgba(255, 255, 255, 0.45);
    outline: none;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.ls-mail-search-bar::placeholder {
    color: rgba(255, 255, 255, 0.72);
}

.ls-topbar-brand {
    color: var(--topbar-text);
    letter-spacing: -0.01em;
}

.ls-topbar-icon-btn {
    color: rgba(255, 255, 255, 0.85);
    border-radius: var(--radius-sm);
    transition: background 0.1s ease, color 0.1s ease;
}

.ls-topbar-icon-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.ls-topbar-icon-btn.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.18);
}

.ls-topbar-avatar {
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.12s ease, transform 0.12s ease;
}

.ls-topbar-avatar:hover {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35), 0 1px 4px rgba(0, 0, 0, 0.24);
}

/* ── App rail ── */
.ls-mail-rail-item {
    color: rgba(255, 255, 255, 0.78);
    border-radius: var(--radius-sm);
    transition: background 0.1s ease, color 0.1s ease;
}

.ls-mail-rail-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.ls-mail-rail-item.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
}

/* ── Sidebar nav ── */
.ls-mail-btn {
    background: var(--accent);
    color: #ffffff;
    border-radius: var(--radius-pill);
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    box-shadow: var(--shadow-sm);
    border: none;
    font-weight: 600;
}

.ls-mail-btn:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md);
}

.ls-mail-btn:active {
    transform: scale(0.98);
}

.ls-mail-nav-item {
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    margin: 1px 8px;
    padding-left: 12px !important;
    padding-right: 12px !important;
    transition: background 0.1s ease, color 0.1s ease;
}

.ls-mail-nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.ls-mail-nav-item.active {
    color: var(--accent);
    background: var(--accent-bg);
    font-weight: 600;
}

.ls-mail-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
}

.ls-mail-nav-item {
    position: relative;
}

/* ── Command bar ── */
.ol-command-bar {
    background: var(--command-bar-bg);
    border-bottom: 1px solid var(--border-primary);
    min-height: 44px;
}

.ol-command-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background 0.1s ease, color 0.1s ease;
}

.ol-command-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.ol-command-btn-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background 0.1s ease, color 0.1s ease;
    text-decoration: none;
}

.ol-command-btn-text:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.ol-command-divider {
    width: 1px;
    height: 20px;
    background: var(--border-primary);
    margin: 0 4px;
}

.ol-folder-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Message list ── */
.ol-mail-list-pane {
    background: var(--bg-list);
    border-right: 1px solid var(--border-primary);
    width: 100%;
    max-width: 380px;
    flex-shrink: 0;
}

.ls-mail-msg-item {
    border-bottom: 1px solid var(--border-primary);
    transition: background 0.1s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    position: relative;
    min-height: 72px;
}

.ls-mail-msg-item:hover {
    background: var(--bg-hover);
}

.ls-mail-msg-item.unread {
    background: var(--accent-bg);
}

.ls-mail-msg-item.unread:hover {
    background: var(--accent-bg-hover);
}

.ls-mail-msg-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-border);
}

.ls-mail-msg-item.selected,
.ls-mail-msg-item.active {
    background: var(--accent-bg);
}

.ls-mail-msg-item.selected::before,
.ls-mail-msg-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-border);
}

/* ── Reading pane ── */
.ol-reading-pane {
    background: var(--bg-reading);
}

.ol-reading-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.ol-reading-empty {
    color: var(--text-muted);
}

/* ── Compose ── */
.ol-compose-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin: 16px;
}

.ol-compose-field {
    border-bottom: 1px solid var(--border-primary);
}

.ol-compose-field label {
    color: var(--text-muted);
    font-size: 13px;
    width: 56px;
    flex-shrink: 0;
}

/* ── Cards & inputs ── */
.ls-mail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
}

.ls-mail-card:hover {
    border-color: var(--border-tertiary);
}

.ls-mail-input {
    background: var(--bg-input);
    border: 1px solid var(--border-secondary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
}

.ls-mail-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.ls-mail-input::placeholder {
    color: var(--text-muted);
}

/* ── Avatar ── */
.ol-avatar {
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--unread-dot);
    flex-shrink: 0;
}

/* ── Scrollbar ── */
.ls-mail-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.ls-mail-scrollbar::-webkit-scrollbar-track { background: transparent; }
.ls-mail-scrollbar::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }
.ls-mail-scrollbar::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

/* ── Modal ── */
.ol-modal-bg { background: var(--bg-card); border-color: var(--border-secondary); }
.ol-modal-header { border-color: var(--border-primary); }

/* ── Animations ── */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fade-in 0.18s ease-out; }

@keyframes fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-up { animation: fade-up 0.25s cubic-bezier(0.16, 1, 0.3, 1) both; }

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.97) translateY(6px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-enter { animation: modal-in 0.18s cubic-bezier(0.16, 1, 0.3, 1) both; }

.stagger-1 { animation-delay: 0.04s; }
.stagger-2 { animation-delay: 0.08s; }
.stagger-3 { animation-delay: 0.12s; }
.stagger-4 { animation-delay: 0.16s; }

.hover-scale { transition: box-shadow 0.15s ease; }
.hover-scale:hover { box-shadow: var(--shadow-md); }

a, button {
    transition: color 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}

/* ── Landing / auth ── */
.ol-login-page {
    background: var(--bg-body);
    min-height: 100vh;
}

.ol-login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.ol-login-icon {
    background: var(--accent);
    color: #ffffff;
    border-radius: var(--radius-md);
}

.ol-login-btn {
    background: var(--accent);
    color: #ffffff;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.ol-login-btn:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md);
}

/* ── Light theme utility overrides ── */
:root[data-theme="light"] .bg-\[\#1c1c1c\],
:root[data-theme="light"] .bg-\[\#1c1c1a\],
:root[data-theme="light"] .bg-\[\#292929\] { background-color: var(--bg-card) !important; }
:root[data-theme="light"] .bg-\[\#333333\],
:root[data-theme="light"] .bg-\[\#2a2a28\],
:root[data-theme="light"] .bg-\[\#2a2a2a\],
:root[data-theme="light"] .bg-\[\#232320\],
:root[data-theme="light"] .bg-\[\#2f2f2c\] { background-color: var(--bg-card-hover) !important; }
:root[data-theme="light"] .bg-\[\#1f1f1f\] { background-color: var(--bg-body) !important; }

:root[data-theme="light"] .text-white { color: var(--text-primary) !important; }
:root[data-theme="light"] .hover\:text-white:hover { color: var(--text-primary) !important; }
:root[data-theme="light"] .text-neutral-300 { color: var(--text-secondary) !important; }
:root[data-theme="light"] .text-neutral-400 { color: var(--text-secondary) !important; }
:root[data-theme="light"] .text-neutral-500 { color: var(--text-muted) !important; }
:root[data-theme="light"] .text-neutral-600 { color: var(--text-muted-2) !important; }

:root[data-theme="light"] .border-\[\#383838\],
:root[data-theme="light"] .border-\[\#1f1f1f\] { border-color: var(--border-primary) !important; }
:root[data-theme="light"] .border-\[\#434343\],
:root[data-theme="light"] .border-\[\#2a2a2a\],
:root[data-theme="light"] .border-\[\#2a2a28\],
:root[data-theme="light"] .border-\[\#2f2f2c\] { border-color: var(--border-secondary) !important; }
:root[data-theme="light"] .border-\[\#5a5a5a\],
:root[data-theme="light"] .border-\[\#3f3f3c\] { border-color: var(--border-tertiary) !important; }

:root[data-theme="light"] .bg-white\/5,
:root[data-theme="light"] .hover\:bg-white\/5:hover { background-color: rgba(0, 0, 0, 0.04) !important; }
:root[data-theme="light"] .bg-white\/10,
:root[data-theme="light"] .hover\:bg-white\/10:hover { background-color: rgba(0, 0, 0, 0.07) !important; }

:root[data-theme="light"] .bg-\[\#2899f5\],
:root[data-theme="light"] .bg-\[\#2899f5\].text-white { background-color: var(--accent) !important; }
:root[data-theme="light"] .text-\[\#2899f5\] { color: var(--accent) !important; }
:root[data-theme="light"] .border-\[\#2899f5\] { border-color: var(--accent) !important; }

@media (max-width: 1023px) {
    .ls-mail-sidebar {
        width: 260px;
    }

    .ls-settings-nav {
        width: 100%;
        max-width: none;
        border-right: none;
        border-bottom: 1px solid var(--border-primary);
    }

    .ls-settings-shell {
        flex-direction: column;
    }

    .ls-settings-nav-list {
        display: flex;
        overflow-x: auto;
        padding: 8px 12px;
        gap: 4px;
    }

    .ls-settings-nav-item {
        white-space: nowrap;
        margin: 0;
        flex-shrink: 0;
    }

    .ls-settings-nav-item.active::before {
        display: none;
    }

    .ls-settings-nav-item.active {
        background: var(--accent-bg);
    }
}

/* ── Settings (Outlook-style) ── */
.ls-settings-shell {
    display: flex;
    height: 100%;
    min-height: 0;
}

.ls-settings-nav {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-list);
    border-right: 1px solid var(--border-primary);
    overflow-y: auto;
}

.ls-settings-nav-title {
    padding: 16px 20px 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ls-settings-nav-list {
    padding: 4px 0 16px;
}

.ls-settings-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: calc(100% - 16px);
    margin: 1px 8px;
    padding: 9px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    position: relative;
    text-decoration: none;
}

.ls-settings-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.ls-settings-nav-item.active {
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 600;
}

.ls-settings-nav-item.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
}

.ls-settings-content {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-reading);
}

.ls-settings-panel {
    display: none;
    max-width: 720px;
    padding: 24px 28px 40px;
    animation: fade-in 0.18s ease-out;
}

.ls-settings-panel.active {
    display: block;
}

.ls-settings-panel h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.ls-settings-panel .ls-settings-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.ls-settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    overflow: hidden;
}

.ls-settings-section-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-primary);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.ls-settings-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-primary);
}

.ls-settings-row:last-child {
    border-bottom: none;
}

.ls-settings-row-label {
    flex: 0 0 180px;
    min-width: 0;
}

.ls-settings-row-label p:first-child {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.ls-settings-row-label p:last-child {
    font-size: 12px;
    color: var(--text-muted);
    margin: 4px 0 0;
    line-height: 1.45;
}

.ls-settings-row-control {
    flex: 1;
    min-width: 0;
}

.ls-settings-actions {
    display: flex;
    justify-content: flex-start;
    padding-top: 8px;
}

.ls-settings-account-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    margin-bottom: 8px;
}

.ls-settings-account-card.active {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.ls-settings-theme-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: border-color 0.12s ease, background 0.12s ease;
}

.ls-settings-theme-option:hover {
    border-color: var(--accent);
}

.ls-settings-theme-option.selected {
    border-color: var(--accent);
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 600;
}

.ls-settings-template-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-primary);
}

.ls-settings-template-row:last-child {
    border-bottom: none;
}
