/* ── LANI Agency Brand ── */
:root {
    --purple: #702585;
    --purple-dark: #581a6a;
    --purple-light: #ac7caf;
    --teal: #3f9eb6;
    --teal-dark: #338292;
    --pink: #c65784;
    --white: #ffffff;
    --bg: #0b0b10;
    --bg-elevated: #131318;
    --bg-card: #18181f;
    --bg-input: #1e1e28;
    --text: #dcdce5;
    --text-muted: #6b6b80;
    --border: #222233;
    --border-light: #2a2a3e;
    --radius: 10px;
    --radius-lg: 16px;
    --transition: 0.15s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Muli', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    letter-spacing: 0.01em;
}

h1, h2, h3 {
    font-family: 'Muli', sans-serif;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.02em;
}

a { color: var(--purple-light); text-decoration: none; }
a:hover { color: var(--white); }

/* ── Navbar ── */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    background: var(--bg);
    border-bottom: none;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Muli', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 0.02em;
    opacity: 0.9;
}
.logo:hover { text-decoration: none; opacity: 1; }
.logo-img { height: 36px; width: auto; }
.nav-brand-title { height: 28px; width: auto; position: absolute; left: 50%; transform: translateX(-50%); opacity: 0.85; }

.nav-right { display: flex; align-items: center; gap: 14px; }
.nav-user { color: var(--text-muted); font-size: 0.8rem; letter-spacing: 0.03em; text-transform: uppercase; }

.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    transition: color var(--transition);
}
.btn-link:hover { color: var(--white); }

.inline { display: inline; }

/* ── Container ── */
.container {
    max-width: 560px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ── Auth pages ── */
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 44px 40px;
    margin-top: 80px;
}

.auth-card h1 {
    font-size: 1.6rem;
    margin-bottom: 6px;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 0.9rem;
}

.auth-card label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    margin-top: 18px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.auth-card input {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: 'Muli', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition);
}
.auth-card input:focus { border-color: var(--purple); }
.auth-card input::placeholder { color: var(--text-muted); opacity: 0.6; }

.btn-primary {
    width: 100%;
    padding: 12px;
    margin-top: 28px;
    background: var(--purple);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-family: 'Muli', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-primary:hover { background: var(--purple-dark); transform: translateY(-1px); }

.auth-switch {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.error {
    background: rgba(198, 87, 132, 0.1);
    border: 1px solid rgba(198, 87, 132, 0.25);
    color: var(--pink);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.85rem;
}

/* ── Sessions page ── */
.sessions-page { margin-top: 24px; }

.sessions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.sessions-header h1 { font-size: 1.3rem; }

.sessions-header .btn-primary {
    width: auto;
    padding: 10px 20px;
    margin-top: 0;
    font-size: 0.8rem;
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.session-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    transition: all var(--transition);
}
.session-card:hover {
    border-color: var(--purple);
    background: var(--bg-elevated);
    text-decoration: none;
}
.session-card h3 { font-size: 0.95rem; font-weight: 600; }
.session-date { color: var(--text-muted); font-size: 0.75rem; }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 80px 20px;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ── Chat page ── */
.chat-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 53px);
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.back-link {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: color var(--transition);
}
.back-link:hover { color: var(--white); }

.chat-header h2 { font-size: 1rem; font-weight: 600; flex: 1; }


.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    display: flex;
    max-width: 75%;
}

.message.user { align-self: flex-end; }
.message.assistant { align-self: flex-start; }

.message-bubble {
    padding: 10px 16px;
    border-radius: 14px;
    line-height: 1.55;
    font-size: 0.88rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message.user .message-bubble {
    background: var(--purple);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

/* ── Chat input ── */
.chat-input {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 0 14px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-input textarea {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'Muli', sans-serif;
    font-size: 0.88rem;
    resize: none;
    outline: none;
    max-height: 100px;
    transition: border-color var(--transition);
}
.chat-input textarea:focus { border-color: var(--purple-light); }
.chat-input textarea::placeholder { color: var(--text-muted); opacity: 0.5; }

.btn-send {
    padding: 10px 18px;
    background: var(--purple);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-family: 'Muli', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-send:hover { background: var(--purple-dark); }
.btn-send:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Scrollbar ── */
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* ── Sidebar Navigation ── */
.sidebar {
    width: 56px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 4px;
    flex-shrink: 0;
    z-index: 10;
}

.sidebar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 48px;
    padding: 8px 0 6px;
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.sidebar-btn:hover:not(.disabled) {
    background: var(--bg-card);
    color: var(--white);
}

.sidebar-btn.active {
    background: var(--bg-card);
    color: var(--purple-light);
    border: 1px solid var(--border-light);
}

.sidebar-btn.disabled {
    opacity: 0.35;
    cursor: default;
}

.sidebar-label {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
}

.sidebar-badge {
    position: absolute;
    top: 2px;
    right: 0;
    font-size: 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--border-light);
    color: var(--text-muted);
    padding: 1px 4px;
    border-radius: 4px;
    line-height: 1.2;
}

/* ── Workspace (split-screen) ── */
.workspace {
    display: flex;
    height: calc(100vh - 53px);
    overflow: hidden;
}

.workbook-panel {
    width: 380px;
    min-width: 380px;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: min-width 0.2s ease, width 0.2s ease;
}

.workbook-panel.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    border-right: none;
}

.workbook-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.workbook-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* Divider hidden when workbook collapsed */
.workbook-panel.collapsed + .panel-divider {
    display: none;
}

/* ── Progress Bar ── */
.workbook-progress-bar {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.progress-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.progress-pct {
    font-size: 0.7rem;
    color: var(--purple-light);
    font-weight: 600;
}

.progress-track {
    height: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--purple), var(--purple-light));
    border-radius: 2px;
    transition: width 0.5s ease;
}

.workbook-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    overflow-y: auto;
    flex-shrink: 0;
    max-height: 45vh;
    border-bottom: 1px solid var(--border);
}

.workbook-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-family: 'Muli', sans-serif;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
    width: 100%;
}

.workbook-tab:hover {
    background: var(--bg-card);
    color: var(--text);
}

.workbook-tab.active {
    background: var(--bg-card);
    color: var(--white);
    border: 1px solid var(--border-light);
}

.tab-icon { font-size: 0.85rem; flex-shrink: 0; }
.tab-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tab-progress {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 1px 6px;
    border-radius: 8px;
    flex-shrink: 0;
}

.tab-progress.complete {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

.workbook-tab.done {
    opacity: 0.7;
}

.workbook-tab.done .tab-label {
    text-decoration: line-through;
    text-decoration-color: var(--text-muted);
}

/* ── Module Complete Banner ── */
.module-complete-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    margin-bottom: 14px;
    background: rgba(74, 222, 128, 0.08);
    border: 1px solid rgba(74, 222, 128, 0.2);
    border-radius: 8px;
    color: #4ade80;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.workbook-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.module-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--white);
}

.workbook-field {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.workbook-field.filled {
    border-color: var(--border-light);
}

.workbook-field.just-filled {
    border-color: var(--purple);
    box-shadow: 0 0 12px rgba(112, 37, 133, 0.35), 0 0 24px rgba(112, 37, 133, 0.15);
    animation: workbookGlow 2s ease-out;
}

@keyframes workbookGlow {
    0% { box-shadow: 0 0 16px rgba(112, 37, 133, 0.5), 0 0 32px rgba(112, 37, 133, 0.25); border-color: var(--purple); }
    100% { box-shadow: none; border-color: var(--border-light); }
}

.field-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.field-value {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text);
}

.field-empty {
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.5;
    font-size: 0.78rem;
}

.field-text {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.field-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-list li {
    padding: 4px 0;
    padding-left: 14px;
    position: relative;
    font-size: 0.82rem;
}

.field-list li::before {
    content: "\2022";
    position: absolute;
    left: 0;
    color: var(--purple-light);
}

/* ── Panel Divider ── */
.panel-divider {
    width: 6px;
    cursor: col-resize;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--transition);
}

.panel-divider:hover { background: var(--border); }

.divider-grip {
    width: 2px;
    height: 32px;
    background: var(--border-light);
    border-radius: 1px;
}

.panel-divider:hover .divider-grip { background: var(--purple-light); }

/* ── Chat Panel ── */
.chat-panel {
    flex: 1;
    min-width: 0;
    padding: 0 20px;
    overflow: hidden;
}

/* ── Workbook scrollbar ── */
.workbook-nav::-webkit-scrollbar,
.workbook-content::-webkit-scrollbar { width: 3px; }
.workbook-nav::-webkit-scrollbar-track,
.workbook-content::-webkit-scrollbar-track { background: transparent; }
.workbook-nav::-webkit-scrollbar-thumb,
.workbook-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .workspace { flex-direction: column; position: relative; }
    .sidebar {
        order: 99;
        width: 100%;
        flex-direction: row;
        justify-content: center;
        padding: 0 8px;
        gap: 0;
        border-right: none;
        border-top: 1px solid var(--border);
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 20;
        height: 52px;
    }
    .sidebar-btn { width: auto; padding: 6px 12px 4px; flex-direction: column; }
    .sidebar-badge { display: none; }
    .workbook-panel {
        width: 100% !important;
        min-width: 100% !important;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .workbook-panel.collapsed { max-height: 0; overflow: hidden; border-bottom: none; }
    .workbook-nav { max-height: 15vh; flex-direction: row; flex-wrap: wrap; }
    .workbook-tab { width: auto; }
    .panel-divider { display: none; }
    .chat-panel { padding: 0 16px; padding-bottom: 56px; }
    .chat-page { height: calc(100vh - 53px - 52px); }
}

@media (max-width: 600px) {
    .container { padding: 20px 16px; }
    .auth-card { padding: 28px 20px; margin-top: 40px; }
    .message { max-width: 88%; }
    .logo-img { height: 28px; }
    .nav-brand-title { height: 22px; }
}
