/* ============================================================
   ForeShiloh Tutor Portal -- Light Theme
   ============================================================ */

:root {
    --gold: #D4A843;
    --gold-light: #f5e6c0;
    --green: #00d4aa;
    --green-light: #e6fff7;
    --green-dark: #00a080;
    --dark: #0a0a0f;
    --text: #1a1a2e;
    --text-light: #666;
    --text-lighter: #999;
    --bg: #fafafa;
    --white: #ffffff;
    --border: #e8e8e8;
    --border-light: #f0f0f0;
    --red: #e74c3c;
    --red-light: #fef0ef;
    --blue: #3b82f6;
    --blue-light: #eff6ff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
}

.screen { display: none; }
.screen.active { display: block; }
.view { display: none; padding: 24px 32px 60px; max-width: 900px; margin: 0 auto; }
.view.active { display: block; }

/* ============================================================
   Auth Screen
   ============================================================ */

#auth-screen {
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--white) 0%, #f0f4f8 100%);
}

#auth-screen.active {
    display: flex;
}

.auth-container {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 460px;
    text-align: center;
}

.auth-logo {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.logo-fore { color: var(--dark); }
.logo-shiloh { color: var(--gold); }

.auth-tagline {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 32px;
}

.auth-form { display: none; text-align: left; }
.auth-form.active { display: block; }
.auth-form h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
    color: var(--dark);
}

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: var(--white);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.15);
}

.track-selector {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.track-option { flex: 1; cursor: pointer; }
.track-option input { display: none; }

.track-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
}

.track-option input:checked + .track-card {
    border-color: var(--gold);
    background: var(--gold-light);
    color: var(--dark);
}

.track-icon { font-size: 24px; }
.track-name { font-size: 13px; }

.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-light);
}

.auth-switch a {
    color: var(--gold);
    font-weight: 600;
    text-decoration: none;
}

.error-msg {
    color: var(--red);
    font-size: 13px;
    text-align: center;
    margin-top: 12px;
    min-height: 20px;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--dark);
    color: var(--white);
}
.btn-primary:hover { background: #1a1a2e; transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-success {
    background: var(--green-dark);
    color: var(--white);
}
.btn-success:hover { background: #008a6a; }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--text-light); background: var(--border-light); }

.btn-small { padding: 6px 14px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.back-btn { margin-bottom: 20px; }

/* ============================================================
   Top Nav
   ============================================================ */

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 32px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
}

.nav-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.nav-portal-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    letter-spacing: 0;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-user {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

/* ============================================================
   Dashboard
   ============================================================ */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 28px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.dashboard-header h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--dark);
}

.dash-subtitle {
    font-size: 15px;
    color: var(--text-light);
    margin-top: 4px;
}

.progress-ring-container {
    position: relative;
    width: 100px;
    height: 100px;
}

.progress-ring { transform: rotate(-90deg); }

.progress-ring-bg {
    fill: none;
    stroke: var(--border-light);
    stroke-width: 6;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--green);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 263.89;
    stroke-dashoffset: 263.89;
    transition: stroke-dashoffset 0.8s ease;
}

.progress-pct {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
}

.pathway-section h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--dark);
}

/* ============================================================
   Module Pathway (Duolingo-style)
   ============================================================ */

.module-pathway {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.pathway-connector {
    width: 2px;
    height: 20px;
    background: var(--border);
    margin: 0 auto;
}

.pathway-connector.completed { background: var(--green); }

.module-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.module-card:hover:not(.locked) {
    border-color: var(--gold);
    box-shadow: var(--shadow);
    transform: translateX(4px);
}

.module-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.module-card.completed {
    border-color: var(--green);
    background: var(--green-light);
}

.module-card.in_progress,
.module-card.available {
    border-color: var(--gold);
    border-width: 2px;
}

.module-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.module-card.locked .module-icon { background: var(--border-light); color: var(--text-lighter); }
.module-card.available .module-icon,
.module-card.in_progress .module-icon { background: var(--gold-light); color: var(--gold); }
.module-card.completed .module-icon { background: var(--green); color: var(--white); }

.module-info { flex: 1; }
.module-info h3 { font-size: 15px; font-weight: 700; color: var(--dark); }
.module-info p { font-size: 13px; color: var(--text-light); margin-top: 2px; }

.module-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-lighter);
    margin-top: 4px;
}

.module-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.badge-locked { background: var(--border-light); color: var(--text-lighter); }
.badge-available { background: var(--gold-light); color: #b08a20; }
.badge-progress { background: var(--blue-light); color: var(--blue); }
.badge-completed { background: var(--green-light); color: var(--green-dark); }
.badge-quiz-passed { background: var(--green); color: var(--white); }

.track-divider {
    padding: 12px 0;
    margin-top: 8px;
}

.track-divider-label {
    display: inline-block;
    padding: 4px 14px;
    background: var(--gold-light);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: #b08a20;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ============================================================
   Module Content View
   ============================================================ */

.module-header {
    padding: 28px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.module-header h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--dark);
}

.module-header p {
    font-size: 15px;
    color: var(--text-light);
    margin-top: 4px;
}

.module-content {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
}

.module-content h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
    margin-top: 32px;
    margin-bottom: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.module-content h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.module-content h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--dark);
    margin-top: 20px;
    margin-bottom: 8px;
}

.module-content h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-top: 16px;
    margin-bottom: 6px;
}

.module-content p { margin-bottom: 12px; }
.module-content ul, .module-content ol { margin: 8px 0 16px 20px; }
.module-content li { margin-bottom: 6px; }

/* Interactive content elements */
.info-box {
    background: var(--blue-light);
    border-left: 4px solid var(--blue);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 16px 20px;
    margin: 16px 0;
}

.tip-box {
    background: var(--gold-light);
    border-left: 4px solid var(--gold);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 16px 20px;
    margin: 16px 0;
}

.warning-box {
    background: var(--red-light);
    border-left: 4px solid var(--red);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 16px 20px;
    margin: 16px 0;
}

.info-box strong, .tip-box strong, .warning-box strong {
    display: block;
    margin-bottom: 4px;
}

.checklist { margin: 12px 0; }
.checklist label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
}
.checklist label:hover { background: var(--border-light); }
.checklist input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    accent-color: var(--green);
    flex-shrink: 0;
}

.expandable {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin: 12px 0;
    overflow: hidden;
}

.expandable summary {
    padding: 12px 16px;
    font-weight: 600;
    cursor: pointer;
    background: var(--border-light);
    transition: background 0.2s;
    font-size: 14px;
}
.expandable summary:hover { background: var(--border); }
.expandable > p, .expandable > div { padding: 16px; }

.highlight-card {
    background: var(--white);
    border: 2px solid var(--gold);
    border-radius: var(--radius);
    padding: 20px;
    margin: 16px 0;
}
.highlight-card h4 { color: var(--gold); margin-top: 0; }

.content-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
}

.content-table th {
    background: var(--dark);
    color: var(--white);
    padding: 10px 14px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
}

.content-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
}

.content-table tr:hover { background: var(--border-light); }

.key-takeaways {
    background: var(--green-light);
    border: 1px solid #c0e8dd;
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 24px;
}

.key-takeaways h3 {
    color: var(--green-dark);
    margin-top: 0;
    margin-bottom: 8px;
}

.key-takeaways ul { margin-left: 16px; }
.key-takeaways li { color: var(--text); }

.module-footer {
    margin-top: 24px;
    text-align: center;
}

/* ============================================================
   Quiz View
   ============================================================ */

.quiz-header {
    padding: 24px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    text-align: center;
}

.quiz-header h1 { font-size: 22px; font-weight: 700; color: var(--dark); }
.quiz-header p { font-size: 14px; color: var(--text-light); margin-top: 4px; }

.quiz-form {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
}

.quiz-question {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-light);
}

.quiz-question:last-of-type { border-bottom: none; }

.q-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--green-dark);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.q-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 12px;
}

.mc-options { display: flex; flex-direction: column; gap: 8px; }

.mc-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.mc-option:hover { border-color: var(--gold); background: var(--gold-light); }

.mc-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--gold);
    flex-shrink: 0;
}

.mc-option.selected { border-color: var(--gold); background: var(--gold-light); }

.sa-textarea {
    width: 100%;
    min-height: 100px;
    padding: 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    resize: vertical;
    transition: border-color 0.2s;
}

.sa-textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.15);
}

.quiz-submit {
    margin-top: 24px;
    text-align: center;
}

.quiz-results {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-top: 20px;
    display: none;
}

.result-banner {
    text-align: center;
    padding: 24px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.result-banner.passed { background: var(--green-light); border: 2px solid var(--green); }
.result-banner.failed { background: var(--red-light); border: 2px solid var(--red); }

.result-banner h2 { font-size: 28px; margin-bottom: 4px; }
.result-banner p { font-size: 15px; color: var(--text-light); }

.result-item {
    padding: 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}

.result-item.correct { background: var(--green-light); border-left: 4px solid var(--green); }
.result-item.incorrect { background: var(--red-light); border-left: 4px solid var(--red); }

.result-item .q-label { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.result-item .explanation { font-size: 13px; color: var(--text-light); margin-top: 6px; }

/* ============================================================
   Admin Dashboard
   ============================================================ */

.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--dark);
}

.stat-label {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
}

.admin-tutors h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.tutor-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.tutor-table th {
    background: var(--dark);
    color: var(--white);
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
}

.tutor-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

.tutor-table tr:hover { background: var(--border-light); cursor: pointer; }

.progress-bar-container {
    background: var(--border-light);
    border-radius: 10px;
    height: 8px;
    width: 100%;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-training { background: var(--blue-light); color: var(--blue); }
.status-awaiting_shadowing { background: var(--gold-light); color: #b08a20; }
.status-certified { background: var(--green-light); color: var(--green-dark); }
.status-active { background: var(--green); color: var(--white); }

.admin-detail {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-top: 20px;
}

.signoff-form {
    margin-top: 20px;
    padding: 20px;
    background: var(--gold-light);
    border-radius: var(--radius);
    border: 2px solid var(--gold);
}

.signoff-form h3 { margin-bottom: 12px; color: var(--dark); }

.signoff-form textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 12px;
    resize: vertical;
}

/* ============================================================
   Certificate View
   ============================================================ */

.certificate-container {
    background: var(--dark);
    border-radius: var(--radius);
    padding: 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
    max-width: 700px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
}

.certificate-container::before {
    content: '';
    position: absolute;
    inset: 16px;
    border: 2px solid var(--gold);
    border-radius: 4px;
}

.cert-brand {
    font-size: 14px;
    color: var(--gold);
    letter-spacing: 6px;
    text-transform: uppercase;
    font-weight: 300;
    margin-bottom: 8px;
    position: relative;
}

.cert-title {
    font-size: 16px;
    color: #888;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 24px;
    position: relative;
}

.cert-name {
    font-size: 36px;
    font-weight: 700;
    color: var(--white);
    border-bottom: 2px solid var(--gold);
    padding-bottom: 8px;
    display: inline-block;
    margin-bottom: 20px;
    position: relative;
}

.cert-desc {
    color: #aaa;
    font-size: 14px;
    line-height: 1.8;
    max-width: 500px;
    margin: 0 auto 24px;
    position: relative;
}

.cert-track { color: var(--green); font-weight: 700; }

.cert-details {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 24px;
    position: relative;
}

.cert-detail { text-align: center; }
.cert-detail-value { color: #ccc; font-size: 14px; border-bottom: 1px solid #444; padding-bottom: 8px; min-width: 120px; display: inline-block; }
.cert-detail-label { font-size: 10px; color: #666; letter-spacing: 2px; text-transform: uppercase; margin-top: 6px; }

.cert-badge {
    display: inline-block;
    margin-top: 24px;
    padding: 6px 18px;
    border: 1px solid rgba(0, 212, 170, 0.3);
    border-radius: 20px;
    font-size: 11px;
    color: var(--green);
    letter-spacing: 2px;
    text-transform: uppercase;
    position: relative;
}

.cert-actions {
    margin-top: 24px;
    text-align: center;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
    .view { padding: 16px; }
    .top-nav { padding: 12px 16px; }
    .nav-portal-label, .nav-divider { display: none; }
    .nav-left { font-size: 16px; }
    .dashboard-header { flex-direction: column; gap: 16px; text-align: center; padding: 20px; }
    .dashboard-header h1 { font-size: 22px; }
    .admin-stats { grid-template-columns: repeat(2, 1fr); }
    .cert-details { flex-direction: column; gap: 16px; }
    .certificate-container { padding: 40px 24px; }
    .cert-name { font-size: 26px; }
    .auth-container { padding: 32px 24px; margin: 16px; }
    .track-selector { flex-direction: column; }
    .tutor-table { font-size: 13px; }
    .tutor-table th, .tutor-table td { padding: 8px 10px; }
    .module-content { padding: 20px; }
    .module-content h2 { font-size: 18px; }
    .module-header { padding: 20px; }
    .module-header h1 { font-size: 20px; }
    .quiz-header { padding: 16px; }
    .quiz-form { padding: 16px; }
    .q-text { font-size: 15px; }
    .mc-option { padding: 10px 12px; font-size: 13px; }
    .result-banner h2 { font-size: 24px; }
    .daani-panel { width: calc(100vw - 32px); right: -8px; }
    .analytics-bar-label { width: 100px; font-size: 11px; }
    .inactive-card { flex-direction: column; gap: 8px; text-align: left; }
}

@media (max-width: 480px) {
    .admin-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-value { font-size: 26px; }
    .module-card { flex-direction: column; text-align: center; padding: 16px; }
    .module-meta { justify-content: center; }
    .module-badge { position: static; margin-top: 8px; }
    .nav-right { gap: 6px; }
    .nav-user { font-size: 12px; }
    .btn-small { padding: 5px 10px; font-size: 12px; }
    .daani-chat { bottom: 16px; right: 16px; }
    .daani-toggle { width: 48px; height: 48px; }
    .daani-icon { font-size: 18px; }
    .progress-ring-container { width: 80px; height: 80px; }
    .progress-ring { width: 80px; height: 80px; }
    .progress-pct { font-size: 16px; }
}

/* ============================================================
   Utilities
   ============================================================ */

.hidden { display: none !important; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.text-small { font-size: 13px; }

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Daani Chat Bubble
   ============================================================ */

.daani-chat {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    font-family: 'Inter', -apple-system, sans-serif;
}

.daani-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--dark);
    border: 2px solid var(--gold);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.daani-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}

.daani-icon {
    font-size: 22px;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: -1px;
}

.daani-panel {
    display: none;
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 360px;
    max-height: 480px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    border: 1px solid var(--border);
    flex-direction: column;
    overflow: hidden;
}

.daani-panel.open {
    display: flex;
}

.daani-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--dark);
    color: var(--white);
}

.daani-header-info { display: flex; flex-direction: column; }
.daani-name { font-size: 15px; font-weight: 700; color: var(--gold); }
.daani-status { font-size: 11px; color: #999; }

.daani-close {
    background: none;
    border: none;
    color: #888;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.daani-close:hover { color: var(--white); }

.daani-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 340px;
    min-height: 200px;
}

.daani-msg {
    display: flex;
    max-width: 85%;
}

.daani-msg-bot { align-self: flex-start; }
.daani-msg-user { align-self: flex-end; }

.daani-msg-content {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
}

.daani-msg-bot .daani-msg-content {
    background: var(--border-light);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.daani-msg-user .daani-msg-content {
    background: var(--dark);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.daani-typing .daani-msg-content {
    color: var(--text-lighter);
    font-style: italic;
}

.daani-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.daani-input-area input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.daani-input-area input:focus {
    border-color: var(--gold);
}

.daani-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--dark);
    border: none;
    color: var(--gold);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.daani-send:hover { background: #1a1a2e; }

/* ============================================================
   Analytics Dashboard
   ============================================================ */

.analytics-section {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.analytics-section h2 {
    font-size: 17px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 16px;
}

.analytics-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.analytics-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.analytics-bar-label {
    width: 180px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.analytics-bar-track {
    flex: 1;
    height: 24px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.analytics-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    padding-left: 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--white);
    min-width: 32px;
}

.analytics-bar-fill.green { background: var(--green-dark); }
.analytics-bar-fill.gold { background: var(--gold); }
.analytics-bar-fill.blue { background: var(--blue); }
.analytics-bar-fill.red { background: var(--red); }

.analytics-bar-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    width: 50px;
    text-align: right;
    flex-shrink: 0;
}

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

.inactive-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--red-light);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--red);
}

.inactive-card .inactive-info { flex: 1; }
.inactive-card .inactive-name { font-weight: 600; font-size: 14px; }
.inactive-card .inactive-detail { font-size: 12px; color: var(--text-light); }
.inactive-card .inactive-days { font-size: 13px; font-weight: 700; color: var(--red); }

@media (max-width: 768px) {
    .daani-panel { width: calc(100vw - 32px); right: -8px; }
    .analytics-bar-label { width: 120px; font-size: 12px; }
}
