/* ============================================================
   AKAMANO AI — CORE STYLESHEET
   Mobile-first, dark app theme. No framework dependency — pure CSS3.
   Every existing component (cards, buttons, inputs, badges, tables)
   already reads these variables, so this palette flip re-themes the
   whole app without touching component rules below.
   ============================================================ */

:root {
    --color-primary: #2ECC71;      /* app-wide accent default (Home/Lesson Plan/Scheme = green) */
    --color-primary-dark: #24A85D;
    --color-accent: #2ECC71;
    --color-accent-dark: #24A85D;
    --color-success: #2ECC71;
    --color-danger: #E0554F;
    --color-warning: #E8A93B;
    --color-bg: #0B0F17;           /* app background — near-black navy */
    --color-surface: #141B27;      /* card / row surface */
    --color-surface-2: #1C2531;    /* nested surface, hover states */
    --color-border: #232D3B;
    --color-text: #F5F7FA;
    --color-text-muted: #8B96A5;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
    --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* Per-feature accent colors — matches the reference app's convention of
       color-coding each generator (set via style="--feature-accent:..." on
       the mobile shell wrapper, read by .step-progress-fill / .step-context-card / etc). */
    --accent-lesson-plan: #2ECC71;
    --accent-teaching-notes: #14B8A6;
    --accent-examination: #8B5CF6;
    --accent-scheme: #2ECC71;
    --accent-weekly: #E67E22;
    --accent-onboarding: #3B82F6;
    --feature-accent: var(--color-primary);
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }

body {
    margin: 0;
    font-family: var(--font-base);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
}

a { color: var(--color-primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 700; line-height: 1.25; }
p { margin: 0 0 1em; color: var(--color-text-muted); }

/* ---------- Layout shell ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--color-primary-dark);
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    overflow-y: auto;
    z-index: 40;
    transition: transform .25s ease;
}
.sidebar .brand {
    font-size: 1.25rem;
    font-weight: 800;
    padding: 8px 10px 20px;
    color: #fff;
    display: flex;
    align-items: center;
}
.sidebar .brand span { color: var(--color-accent); }
.brand-logo-img { max-height: 34px; width: auto; display: block; }
.brand-logo-text { font-weight: 800; color: #fff; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,.78);
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    font-size: .93rem;
    font-weight: 500;
    margin-bottom: 2px;
}
.sidebar nav a:hover, .sidebar nav a.active {
    background: rgba(255,255,255,.1);
    color: #fff;
}
.sidebar nav .section-label {
    text-transform: uppercase;
    font-size: .7rem;
    letter-spacing: .06em;
    color: rgba(255,255,255,.45);
    margin: 16px 12px 6px;
}

.main-content {
    margin-left: 250px;
    flex: 1;
    padding: 24px 28px 60px;
    width: 100%;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    gap: 12px;
}
.topbar h1 { font-size: 1.4rem; margin: 0; }
.mobile-menu-btn {
    display: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 1.1rem;
    cursor: pointer;
}

/* ---------- Cards ---------- */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 20px;
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: 18px;
}
.stat-card .stat-value { font-size: 1.7rem; font-weight: 800; color: var(--color-primary); }
.stat-card .stat-label { color: var(--color-text-muted); font-size: .85rem; }

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}
.quick-action {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 18px;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
    text-align: left;
}
.quick-action:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.quick-action .icon { font-size: 1.6rem; }
.quick-action .title { font-weight: 700; font-size: .95rem; color: var(--color-text); }
.quick-action .desc { font-size: .8rem; color: var(--color-text-muted); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .92rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-align: center;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-accent { background: var(--color-accent); color: #fff; }
.btn-accent:hover { background: var(--color-accent-dark); }
.btn-outline { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-outline:hover { background: var(--color-bg); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 6px; }
input, select, textarea {
    width: 100%;
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    font-size: .93rem;
    font-family: inherit;
    background: var(--color-surface-2);
    color: var(--color-text);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(30,75,143,.12);
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}
.help-text { font-size: .78rem; color: var(--color-text-muted); margin-top: 4px; }
.field-error { color: var(--color-danger); font-size: .8rem; margin-top: 4px; }

/* ---------- Alerts / toasts ---------- */
.alert {
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    margin-bottom: 16px;
}
.alert-error { background: #3A1F1E; color: #F5A9A4; border: 1px solid #5A2C29; }
.alert-success { background: #123A28; color: #6FE0AC; border: 1px solid #1E5A3E; }
.alert-info { background: #10233D; color: #7FB2F0; border: 1px solid #1B3A61; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
th { color: var(--color-text-muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    background: var(--color-bg);
    color: var(--color-text-muted);
}
.badge-success { background: #123A28; color: #6FE0AC; }
.badge-warning { background: #3D2F10; color: #F0C265; }

/* ---------- Chat ---------- */
.chat-shell { display: flex; height: calc(100vh - 100px); border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; background: var(--color-surface); }
.chat-sidebar { width: 260px; border-right: 1px solid var(--color-border); overflow-y: auto; flex-shrink: 0; background: var(--color-bg); }
.chat-sidebar-item { padding: 12px 14px; border-bottom: 1px solid var(--color-border); cursor: pointer; font-size: .85rem; }
.chat-sidebar-item:hover, .chat-sidebar-item.active { background: var(--color-surface-2); }
.chat-main { flex: 1; display: flex; flex-direction: column; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; }
.chat-bubble { max-width: 75%; padding: 12px 16px; border-radius: 16px; margin-bottom: 12px; font-size: .92rem; white-space: pre-wrap; }
.chat-bubble.user { background: var(--color-primary); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.chat-bubble.assistant { background: var(--color-bg); color: var(--color-text); margin-right: auto; border-bottom-left-radius: 4px; }
.chat-input-bar { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--color-border); }
.chat-input-bar textarea { resize: none; height: 46px; }

/* ---------- Landing page ---------- */
.landing-hero {
    text-align: center;
    padding: 90px 20px 60px;
    background: var(--color-primary-dark);
    color: #fff;
}
.landing-hero h1 { font-size: 2.4rem; margin-bottom: .3em; }
.landing-hero p { color: rgba(255,255,255,.85); font-size: 1.1rem; max-width: 600px; margin: 0 auto 1.6em; }
.landing-section { max-width: 1080px; margin: 0 auto; padding: 60px 20px; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.pricing-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 28px; text-align: center; }
.pricing-card.featured { border: 2px solid var(--color-accent); }
.pricing-card .price { font-size: 2rem; font-weight: 800; color: var(--color-primary); margin: 10px 0; }

/* ============================================================
   MOBILE APP SHELL — bottom tab nav, step wizard, home list rows
   ============================================================ */

.app-body { padding-bottom: 78px; background: var(--color-bg); min-height: 100vh; }

/* ---------- Mobile top bar ---------- */
.mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px 10px;
}
.mobile-topbar .back-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--color-surface); border: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: center;
    color: var(--color-text); flex-shrink: 0; cursor: pointer;
}
.mobile-topbar .titles { flex: 1; }
.mobile-topbar h1 { font-size: 1.4rem; margin: 0; }
.mobile-topbar .subtitle { color: var(--color-text-muted); font-size: .85rem; margin-top: 2px; }
.coins-pill {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--color-surface-2); border: 1px solid var(--color-border);
    border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: .85rem;
    color: var(--feature-accent); flex-shrink: 0; white-space: nowrap;
}

/* ---------- Step wizard ---------- */
.wizard-page { padding: 0 18px 100px; }
.step-progress-row { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--color-text-muted); margin-bottom: 8px; }
.step-progress-track { height: 6px; border-radius: 999px; background: var(--color-surface-2); overflow: hidden; margin-bottom: 18px; }
.step-progress-fill { height: 100%; background: var(--feature-accent); border-radius: 999px; transition: width .3s ease; }

.step-context-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--color-surface-2);
    background: color-mix(in srgb, var(--feature-accent) 14%, var(--color-bg));
    border: 1px solid var(--color-border);
    border: 1px solid color-mix(in srgb, var(--feature-accent) 40%, var(--color-border));
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 20px;
}
.step-context-card .icon-box {
    width: 40px; height: 40px; border-radius: var(--radius-sm); flex-shrink: 0;
    background: var(--color-surface-2);
    background: color-mix(in srgb, var(--feature-accent) 25%, var(--color-bg));
    display: flex; align-items: center; justify-content: center; color: var(--feature-accent);
}
.step-context-card > div:last-child { flex: 1; min-width: 0; }
.step-context-card .name { color: var(--feature-accent); font-weight: 700; font-size: .95rem; overflow-wrap: break-word; }
.step-context-card .desc { color: var(--color-text-muted); font-size: .82rem; margin-top: 1px; overflow-wrap: break-word; }

.step-heading { font-size: 1.5rem; font-weight: 800; margin-bottom: 4px; }
.step-subheading { color: var(--color-text-muted); margin-bottom: 20px; font-size: .92rem; }

/* Option tiles — 2-column icon grid (grade/level/subject pickers) */
.option-tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.option-tile {
    background: var(--color-surface); border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md); padding: 20px 14px; text-align: center;
    cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.option-tile:hover { border-color: var(--feature-accent); }
.option-tile.selected {
    border-color: var(--feature-accent);
    background: var(--color-surface-2);
    background: color-mix(in srgb, var(--feature-accent) 10%, var(--color-surface));
}
.option-tile .icon-box {
    width: 48px; height: 48px; margin: 0 auto 12px; border-radius: var(--radius-sm);
    background: var(--color-surface-2); display: flex; align-items: center; justify-content: center;
    color: var(--feature-accent);
}
.option-tile .tile-title { font-weight: 700; font-size: .95rem; }
.option-tile .tile-meta { font-size: .78rem; color: var(--color-text-muted); margin-top: 4px; }

/* Option list — single-column radio-style rows (topic pickers) */
.option-list { display: flex; flex-direction: column; gap: 10px; }
.option-row {
    display: flex; align-items: center; gap: 14px;
    background: var(--color-surface); border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md); padding: 16px 18px; cursor: pointer;
}
.option-row.selected { border-color: var(--feature-accent); }
.option-row .radio-dot {
    width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--color-text-muted);
    flex-shrink: 0; position: relative;
}
.option-row.selected .radio-dot { border-color: var(--feature-accent); }
.option-row.selected .radio-dot::after {
    content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--feature-accent);
}
.option-row .row-label { font-size: .95rem; }

/* Fixed wizard footer (Back / Next) */
.wizard-footer {
    position: fixed; left: 0; right: 0; bottom: 0;
    display: flex; gap: 12px; padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
    background: var(--color-bg); border-top: 1px solid var(--color-border); z-index: 50;
}
.wizard-footer .btn-back { flex: 0 0 100px; }
.wizard-footer .btn-next { flex: 1; background: var(--feature-accent); color: #fff; border: none; }
.wizard-footer .btn-next:disabled { opacity: .4; }

/* ---------- Bottom tab bar ---------- */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: flex; background: var(--color-surface); border-top: 1px solid var(--color-border);
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 10px 4px 8px; color: var(--color-text-muted); font-size: .7rem; font-weight: 600;
}
.bottom-nav a.active { color: var(--color-primary); }
.bottom-nav a .nav-icon { width: 22px; height: 22px; }

/* ---------- Home screen ---------- */
.home-header { padding: 18px 18px 4px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.home-header .greeting-block { flex: 1; min-width: 0; }
.home-header .greeting { color: var(--color-text-muted); font-size: .9rem; }
.home-header .name { font-size: 1.3rem; font-weight: 800; overflow-wrap: break-word; }
.home-header .country-tag { color: var(--color-primary); font-size: .85rem; margin-top: 2px; font-weight: 600; overflow-wrap: break-word; }
.home-header .header-icons { display: flex; gap: 10px; flex-shrink: 0; }
.home-header .icon-btn {
    width: 40px; height: 40px; border-radius: 50%; background: var(--color-surface);
    border: 1px solid var(--color-border); display: flex; align-items: center; justify-content: center;
    color: var(--color-text); flex-shrink: 0;
}
.home-header .avatar {
    width: 40px; height: 40px; border-radius: 50%; background: var(--color-surface-2);
    display: flex; align-items: center; justify-content: center; color: var(--color-text-muted); font-weight: 700;
    flex-shrink: 0;
}

.home-stat-bar {
    display: flex; margin: 14px 18px; background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); overflow: hidden;
}
.home-stat-bar .stat { flex: 1; text-align: center; padding: 16px 8px; }
.home-stat-bar .stat + .stat { border-left: 1px solid var(--color-border); }
.home-stat-bar .stat-num { font-size: 1.3rem; font-weight: 800; color: var(--color-primary); }
.home-stat-bar .stat-label { font-size: .74rem; color: var(--color-text-muted); margin-top: 2px; }

.home-list { padding: 4px 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.home-list-row {
    display: flex; align-items: center; gap: 14px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); padding: 14px 16px;
}
.home-list-row .icon-box {
    width: 44px; height: 44px; border-radius: var(--radius-sm); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.home-list-row .row-body { flex: 1; min-width: 0; }
.home-list-row .row-title { font-weight: 700; font-size: .95rem; }
.home-list-row .row-desc { font-size: .8rem; color: var(--color-text-muted); margin-top: 2px; }
.home-list-row .row-chevron { color: var(--color-text-muted); flex-shrink: 0; }

/* Profile page quick-action row of circular icon buttons */
.profile-quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 0 18px; }
.profile-quick-actions .qa-item { text-align: center; }
.profile-quick-actions .qa-circle {
    width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 6px;
    display: flex; align-items: center; justify-content: center; color: #fff;
}
.profile-quick-actions .qa-label { font-size: .74rem; color: var(--color-text-muted); }

/* ---------- Mobile responsive ---------- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 16px; }
    .mobile-menu-btn { display: inline-flex; }
    .chat-shell { flex-direction: column; height: auto; }
    .chat-sidebar { width: 100%; max-height: 160px; }
    table, thead, tbody, th, td, tr { display: block; }
    thead { display: none; }
    tr { border: 1px solid var(--color-border); border-radius: var(--radius-sm); margin-bottom: 10px; padding: 8px; }
    td { border: none; white-space: normal; display: flex; justify-content: space-between; gap: 10px; }
    td::before { content: attr(data-label); font-weight: 600; color: var(--color-text-muted); }
}

@media (max-width: 360px) {
    .profile-quick-actions { gap: 8px; }
    .profile-quick-actions .qa-circle { width: 46px; height: 46px; }
    .profile-quick-actions .qa-label { font-size: .68rem; }
    .option-tile-grid { gap: 8px; }
    .option-tile { padding: 16px 10px; }
    .home-header .name { font-size: 1.15rem; }
    .mobile-topbar h1 { font-size: 1.2rem; }
}
