/* ══════════════════════════════════════════════════════
   Theory Express — מערכת עיצוב (רידיזיין 13.8.2026, אחד-לאחד עם
   theory-express-app). מקור-אמת: docs/DESIGN_SPEC_v5_mockups.md +
   docs/mockups/*.png ב-theory-express-app. פלטה כהה + glow-spots,
   כרטיסים לבנים צפים, מסקוט-מכונית+מדריך, CTA כתום-גרדיאנט.
   מחליף לגמרי את style.css הישן (פלטת "Drive" הבהירה) - לא במקביל אליו.
══════════════════════════════════════════════════════ */
:root {
    /* רקע/glow */
    --bg-navy-deep:   #0A1230;
    --bg-navy-mid:    #0E1A45;
    --bg-navy-card:   #13245C;
    --glow-blue:      #2E63FF;
    --glow-pink:      #FF4FA3;

    /* accents */
    --accent-cyan:    #33C9F2;
    --accent-gold:    #FFC94A;
    --accent-orange-1:#FF8A2B;
    --accent-orange-2:#FF5A1F;
    --accent-purple:  #7B5CFA;
    --accent-teal:    #21C7B8;

    --success:  #2ECC71;
    --error:    #FF4757;
    --warning:  #FF9F43;

    /* משטחים בהירים (כרטיסים) */
    --surface-white:   #FFFFFF;
    --surface-offwhite:#F4F6FB;
    --text-on-dark:       #FFFFFF;
    --text-on-dark-muted: #B9C2E0;
    --text-on-light-dark: #1A2340;
    --text-on-light-muted:#6B7590;

    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --radius-pill: 999px;

    --shadow-card: 0 10px 30px rgba(6,12,35,.35);
    --shadow-cta:  0 10px 24px rgba(255,90,31,.35);
    --transition:  .18s cubic-bezier(.2,.8,.2,1);

    /* פריסה */
    --tabbar-height: 68px;
    --sidebar-width: 220px;
    --content-max: 720px;
}

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

html, body { height: 100%; }

body.te-body {
    font-family: 'Heebo', sans-serif;
    direction: rtl;
    color: var(--text-on-dark);
    background:
        radial-gradient(700px 500px at 12% 0%,   rgba(46,99,255,.28), transparent 60%),
        radial-gradient(600px 450px at 100% 15%, rgba(255,79,163,.20), transparent 55%),
        linear-gradient(180deg, var(--bg-navy-deep) 0%, var(--bg-navy-mid) 100%);
    background-attachment: fixed;
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
ul { list-style: none; }
input, select, textarea { font-family: inherit; }

/* ── מסגרת-אפליקציה: תוכן ממורכז ברוחב-נייד, עם ריווח לתחתית ה-tab bar ── */
.te-app {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 1rem 1rem calc(var(--tabbar-height) + 1.5rem);
    min-height: 100vh;
}

.te-app--no-nav { padding-bottom: 1.5rem; }

/* ── טיפוגרפיה ── */
.te-display  { font-size: 2.4rem; font-weight: 800; line-height: 1.1; }
.te-h1       { font-size: 1.5rem; font-weight: 800; line-height: 1.3; }
.te-h2       { font-size: 1.15rem; font-weight: 700; }
.te-body     { font-size: .95rem; color: var(--text-on-dark-muted); }
.te-caption  { font-size: .78rem; color: var(--text-on-dark-muted); }
.te-metric   { font-size: 1.3rem; font-weight: 800; }
.te-gold  { color: var(--accent-gold); }
.te-cyan  { color: var(--accent-cyan); }
.te-green { color: var(--success); }

/* ── לוגו (14.8.2026: מיתוג-מחדש XDrive - תמונה אמיתית, לא לוגו-טקסט-CSS) ── */
/* 14.8.2026: רוני בדק על מכשיר אמיתי וביקש הגדלה משמעותית - עוד יותר בדפים
   הפנימיים (שהיו הכי קטנים יחסית עד עכשיו) מאשר בדפי-הכניסה.
   16.8.2026: עדיין נראה זעיר בדסקטופ (1920px) - הגדלה נוספת + מדרגה ייעודית
   לדסקטופ (לא רק scale יחסי, גודל-פיקסלים אמיתי גדול יותר). */
.te-logo-img { height: 56px; width: auto; display: block; }
.te-logo-img--hero { height: 190px; margin: 0 auto 1rem; filter: drop-shadow(0 8px 24px rgba(46,99,255,.35)); }
.te-logo-img--page { height: 76px; width: auto; }
@media (min-width: 900px) {
    /* רוני: "עדיין לוגו קטן, צריך להיות לפחות פי 3" (16.8.2026, אחרי 84px) */
    .te-logo-img { height: 260px; }
    .te-logo-img--hero { height: 320px; }
    .te-logo-img--page { height: 280px; }
}

/* ── כרטיסים ── */
.te-card {
    background: var(--surface-white);
    color: var(--text-on-light-dark);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
}
.te-card-navy {
    background: var(--bg-navy-card);
    color: var(--text-on-dark);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
}
.te-card-hero {
    background: linear-gradient(135deg, var(--glow-blue), #1740C4);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

/* ── כפתורים ── */
.te-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border-radius: var(--radius-pill);
    padding: .85rem 1.5rem;
    font-weight: 700;
    font-size: .95rem;
    transition: transform var(--transition), box-shadow var(--transition);
    width: 100%;
}
.te-btn:active { transform: scale(.98); }
.te-btn-cta {
    background: linear-gradient(90deg, var(--accent-orange-1), var(--accent-orange-2));
    color: #fff;
    box-shadow: var(--shadow-cta);
}
.te-btn-secondary {
    background: rgba(255,255,255,.10);
    color: #fff;
    border: 1px solid rgba(255,255,255,.18);
}
.te-btn-purple { background: var(--accent-purple); color: #fff; }
.te-btn-link {
    background: none;
    color: var(--text-on-dark-muted);
    font-size: .85rem;
    text-decoration: underline;
    width: auto;
    padding: .4rem;
}
.te-btn[disabled] { opacity: .5; pointer-events: none; }

/* ── גריד פעולות 2x2 (דשבורד) ── */
/* מקביל 1:1 ל-ActionTile ב-app_ui.dart: כרטיס כולו בצבע (לא כרטיס-לבן עם
   ריבוע-אייקון-קטן), תמונת-מסקוט אמיתית 46px בצד שמאל, טקסט לבן מיושר-ימין
   מפנה מקום לאייקון, תג-מספר ליד ראש-האייקון, עיגול-חץ שקוף בפינה השמאלית-
   תחתונה. left/top כאן הם פיזיים בכוונה (לא RTL-mirrored) - כמו ב-Positioned
   של Flutter, שלא מתהפך אוטומטית תחת Directionality. */
.te-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin: 1rem 0; }
.te-action-tile {
    color: #fff;
    border-radius: 20px;
    padding: 12px 12px 10px;
    box-shadow: var(--shadow-card);
    position: relative;
    display: block;
    min-height: 118px;
}
.te-action-tile .te-tile-icon-img {
    position: absolute; left: 12px; top: 18px;
    width: 46px; height: 46px; object-fit: contain;
}
.te-action-tile .te-tile-text { padding-left: 58px; }
.te-action-tile h3 { font-size: .92rem; font-weight: 800; margin-bottom: .2rem; color: #fff; }
.te-action-tile p { font-size: .68rem; color: rgba(255,255,255,.88); line-height: 1.3; }
.te-tile-purple { background: var(--accent-purple); }
.te-tile-teal   { background: var(--accent-teal); }
.te-tile-orange { background: linear-gradient(135deg, var(--accent-orange-1), var(--accent-orange-2)); }
.te-tile-blue   { background: var(--glow-blue); }
.te-tile-badge {
    position: absolute; left: 46px; top: 0;
    background: var(--error); color: #fff; font-size: .68rem; font-weight: 700;
    border-radius: 10px; min-width: 18px; height: 18px; padding: 0 6px;
    display: flex; align-items: center; justify-content: center;
}
.te-tile-chevron {
    position: absolute; left: 12px; bottom: 10px;
    width: 24px; height: 24px; border-radius: 999px;
    background: rgba(255,255,255,.28);
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem; color: #fff;
}

/* ── Progress ring (donut) ── */
.te-ring { position: relative; width: 84px; height: 84px; }
.te-ring svg { transform: rotate(-90deg); }
.te-ring circle { fill: none; stroke-width: 9; }
.te-ring .te-ring-bg { stroke: #EDEFF7; }
.te-ring .te-ring-fill { stroke: url(#te-ring-gradient); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.te-ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.te-ring-label .pct { font-size: 1.15rem; font-weight: 800; color: var(--text-on-light-dark); }
.te-ring-label .pct-sign { font-size: .7rem; }

/* ── Tab bar תחתון (מובייל) ── */
.te-tabbar {
    position: fixed; bottom: 0; right: 0; left: 0;
    height: var(--tabbar-height);
    background: var(--bg-navy-card);
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}
.te-tab {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .2rem;
    color: var(--text-on-dark-muted);
    font-size: .68rem;
    position: relative;
}
.te-tab i { font-size: 1.05rem; }
.te-tab.active { color: var(--accent-cyan); }
.te-tab .te-tab-badge {
    position: absolute; top: 2px; left: calc(50% + 6px);
    background: var(--error); color: #fff; font-size: .62rem; font-weight: 800;
    border-radius: 999px; min-width: 16px; height: 16px; padding: 0 .3rem;
    display: flex; align-items: center; justify-content: center;
}

/* ── דסקטופ: sidebar אנכי בצד ימין (RTL) במקום tab bar תחתון ── */
@media (min-width: 900px) {
    /* ה-sidebar יושב מימין (RTL נכון) - הריפוד-המפצה חייב להיות מימין (padding-right),
       לא משמאל, אחרת התוכן נחתך מתחת ל-sidebar (בדיוק הבאג שנתפס בצילום-מסך). */
    .te-app { max-width: 1400px; padding: 2.5rem calc(var(--sidebar-width) + 2.5rem) 2.5rem 2.5rem; }
    .te-tabbar {
        top: 0; bottom: 0; right: 0; left: auto;
        width: var(--sidebar-width); height: 100vh;
        flex-direction: column; justify-content: flex-start;
        gap: .3rem; padding: 2rem 1rem;
        border-top: none; border-left: 1px solid rgba(255,255,255,.08);
    }
    .te-tab { flex: none; flex-direction: row; justify-content: flex-start; gap: .7rem; padding: .8rem 1rem; border-radius: var(--radius-md); font-size: .9rem; }
    .te-tab.active { background: rgba(51,201,242,.12); }
    .te-tab i { font-size: 1.1rem; width: 20px; text-align: center; }
    .te-tab .te-tab-badge { top: 6px; left: 10px; }
    .te-actions-grid { grid-template-columns: repeat(4, 1fr); }
    .te-weekly-tiles { grid-template-columns: repeat(3, 1fr) !important; }
    .te-question-card { max-width: 640px; margin: 0 auto; }

    /* דשבורד-בית: פריסה אמיתית דו-טורית (לא עוד עמודה יחידה ממורכזת ומתוחה) -
       עמודה ראשית (ברכה+כרטיס-אימון) + עמודת-צד (מד-מוכנות + מסקוט-איור
       דקורטיבי, ריק ורוני ציין שאין שם שום אלמנט גרפי בדסקטופ). מוסתר לגמרי
       ב-mobile (display:none) - נשאר sidebar דקורטיבי-בלבד, לא תוכן. */
    .te-dash-top {
        display: grid;
        grid-template-columns: 1fr 340px;
        grid-template-areas: "greet side" "hero side";
        column-gap: 2rem; row-gap: 0;
        align-items: start;
    }
    .te-dash-greet { grid-area: greet; }
    .te-dash-hero { grid-area: hero; margin-bottom: 0 !important; }
    .te-dash-side { grid-area: side; display: flex; flex-direction: column; gap: 1.2rem; }
    .te-dash-mascot { display: block; max-width: 100%; margin: 0 auto; filter: drop-shadow(0 16px 28px rgba(0,0,0,.4)); }

    /* התקדמות השבוע: כרטיס-גרף + עמודת-הישגים זו-לצד-זו, לא כרטיס יחיד צר */
    .te-dash-bottom { display: grid; grid-template-columns: 1fr 300px; gap: 1.5rem; align-items: stretch; }
    .te-dash-bottom > .te-card-hero { display: flex !important; flex-direction: column; justify-content: center; }
}

@media (max-width: 899.98px) {
    .te-dash-mascot { display: none; }
}

/* ── Onboarding / Auth: מסך מלא בלי ניווט ── */
.te-fullscreen {
    min-height: 100vh;
    display: flex; flex-direction: column;
    max-width: 480px; margin: 0 auto;
    padding: 1.5rem;
}
.te-fullscreen-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.te-skip { color: var(--text-on-dark-muted); font-size: .85rem; }
.te-onb-art { flex: 1; display: flex; align-items: center; justify-content: center; padding: 1rem 0; }
.te-onb-art img { max-height: 260px; }
.te-dots { display: flex; justify-content: center; gap: .4rem; margin: 1rem 0; }

/* מקביל ל-ChoiceChip ב-license_type_screen.dart (onboarding) */
.te-chip-group { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.te-chip {
    background: var(--bg-navy-card); color: var(--text-on-dark);
    border: none; border-radius: 999px; padding: .6rem 1.1rem;
    font-size: .88rem; font-weight: 700; cursor: pointer;
}
.te-chip.active { background: var(--glow-blue); color: #fff; }
.te-dot { width: 7px; height: 7px; border-radius: 999px; background: rgba(255,255,255,.25); }
.te-dot.active { width: 20px; background: var(--accent-cyan); }

/* ── שאלה/תרגול ── */
.te-progress-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin: .8rem 0; font-size: .8rem; color: var(--text-on-dark-muted); }
.te-dots-progress { display: flex; gap: 3px; flex: 1; overflow: hidden; }
.te-dots-progress span { height: 4px; flex: 1; border-radius: 999px; background: rgba(255,255,255,.15); }
.te-dots-progress span.done { background: linear-gradient(90deg, var(--accent-cyan), var(--glow-blue)); }

.te-topic-pill {
    display: inline-flex; align-items: center; gap: .4rem;
    background: var(--bg-navy-card); color: var(--text-on-dark);
    border-radius: var(--radius-pill); padding: .4rem 1rem; font-size: .82rem;
    margin: 0 auto 1rem; width: fit-content;
}

.te-question-bubble {
    background: var(--bg-navy-card);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    font-size: 1.05rem; font-weight: 700;
    text-align: right;
    margin-bottom: 1rem;
}

.te-question-image {
    background: var(--surface-offwhite);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1rem;
}
.te-question-image img { max-height: 220px; }

.te-answer {
    display: flex; align-items: center; gap: .8rem;
    width: 100%;
    background: var(--surface-offwhite);
    border: 2px solid transparent;
    border-radius: var(--radius-pill);
    padding: .9rem 1.1rem;
    margin-bottom: .6rem;
    color: var(--text-on-light-dark);
    font-size: .92rem;
    text-align: right;
}
.te-answer .te-answer-badge {
    width: 26px; height: 26px; border-radius: 999px;
    background: #E3E7F2; color: var(--text-on-light-muted);
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 800; flex-shrink: 0;
}
.te-answer-text { flex: 1; }
.te-answer.correct { background: #E9FBF1; border-color: var(--success); }
.te-answer.correct .te-answer-badge { background: var(--success); color: #fff; }
.te-answer.wrong { background: #FFEEF0; border-color: var(--error); }
.te-answer.wrong .te-answer-badge { background: var(--error); color: #fff; }

.te-explain-panel {
    background: var(--bg-navy-card);
    border-radius: var(--radius-lg);
    padding: 1.1rem;
    margin: 1rem 0;
    position: relative;
}
.te-explain-badge {
    position: absolute; top: -12px; right: 1.1rem;
    background: var(--success); color: #fff; font-weight: 800; font-size: .78rem;
    border-radius: 999px; padding: .3rem .8rem;
}
.te-explain-badge.wrong { background: var(--error); }
.te-explain-panel p { font-size: .88rem; color: var(--text-on-dark-muted); margin-top: .5rem; }

.te-needs-review-row {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(255,255,255,.06); border-radius: var(--radius-pill);
    padding: .6rem 1rem; font-size: .82rem; margin: .8rem 0;
}

.te-q-actions { display: flex; gap: .6rem; margin-top: .8rem; }
.te-q-actions .te-btn-purple { flex: 0 0 auto; width: auto; padding: .85rem 1.1rem; }
.te-q-actions .te-btn-cta { flex: 1; }

/* ── טפסים (auth) ── */
.te-field { margin-bottom: 1rem; }
.te-field label { display: block; font-size: .82rem; color: var(--text-on-dark-muted); margin-bottom: .4rem; }
.te-field input {
    width: 100%; padding: .8rem 1rem; border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.06);
    color: #fff; font-size: .95rem;
}
.te-field input:focus { outline: none; border-color: var(--accent-cyan); }
.te-error-msg { background: rgba(255,71,87,.15); color: #FF8A93; border-radius: var(--radius-sm); padding: .7rem 1rem; font-size: .85rem; margin-bottom: 1rem; }
.te-btn-google {
    background: #fff; color: #3C4043; border: 1px solid #DADCE0;
    font-weight: 600; display: flex; align-items: center; justify-content: center; gap: .6rem;
}
.te-divider { display: flex; align-items: center; gap: .8rem; margin: 1.2rem 0; color: var(--text-on-dark-muted); font-size: .8rem; }
.te-divider::before, .te-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.15); }
.te-flash-ok { background: rgba(46,204,113,.15); color: var(--success); border-radius: var(--radius-sm); padding: .7rem 1rem; font-size: .85rem; margin-bottom: 1rem; }

/* ── רשימות (נושאים/תמרורים/טעויות) ── */
.te-list-item {
    display: flex; align-items: center; justify-content: space-between; gap: .8rem;
    background: var(--surface-white); color: var(--text-on-light-dark);
    border-radius: var(--radius-md); padding: 1rem; margin-bottom: .6rem;
    box-shadow: var(--shadow-card);
}

/* מקביל 1:1 ל-ListActionTile ב-app_ui.dart (topic_select_screen.dart) - שורה
   כולה בצבע, אייקון-מסקוט אמיתי בריבוע לבן-שקוף 44px. */
.te-topic-row {
    display: flex; align-items: center; justify-content: space-between; gap: .8rem;
    color: #fff; border-radius: 20px; padding: 14px; margin-bottom: .6rem;
}
.te-topic-row .te-topic-icon-wrap {
    width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
    background: rgba(255,255,255,.22); padding: 6px;
    display: flex; align-items: center; justify-content: center;
}
.te-topic-row .te-topic-icon-wrap img { width: 100%; height: 100%; object-fit: contain; }
.te-topic-row .te-topic-text { font-weight: 800; color: #fff; }
.te-topic-row .te-progress-bar-track { background: rgba(255,255,255,.28); }
.te-topic-row .te-topic-pct { color: rgba(255,255,255,.9); font-size: .85rem; }
.te-progress-bar-track { background: #EDEFF7; border-radius: 999px; height: 8px; overflow: hidden; margin-top: .4rem; }
.te-progress-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-cyan), var(--glow-blue)); }

.te-weekly-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-top: 1rem; }
.te-weekly-tiles .tile { text-align: center; }
.te-weekly-tiles .tile .n { font-size: 1.1rem; font-weight: 800; color: var(--text-on-light-dark); }
.te-weekly-tiles .tile .l { font-size: .72rem; color: var(--text-on-light-muted); }

.te-bar-chart { display: flex; align-items: flex-end; gap: .5rem; height: 90px; margin: 1rem 0; }
.te-bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: .3rem; height: 100%; }
.te-bar-chart .bar { width: 100%; border-radius: 6px 6px 0 0; min-height: 4px; }
.te-bar-chart .lbl { font-size: .68rem; color: var(--text-on-light-muted); }

.te-empty-state { text-align: center; padding: 2rem 1rem; color: var(--text-on-dark-muted); }
.te-empty-state img { max-width: 140px; margin: 0 auto 1rem; }

.te-signs-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; margin-top: 1rem; }
.te-signs-grid .te-sign-tile { background: var(--surface-white); border-radius: var(--radius-md); padding: .8rem; text-align: center; box-shadow: var(--shadow-card); color: var(--text-on-light-dark); }
.te-signs-grid img { max-height: 80px; margin: 0 auto .5rem; }

/* ── Timer/exam ── */
.te-timer { font-variant-numeric: tabular-nums; font-weight: 800; }
.te-exam-nav { display: flex; gap: .6rem; margin-top: 1rem; }
.te-exam-nav .te-btn { flex: 1; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
