/* ==========================================================================
   Clave Courses - Main Stylesheet
   Design System: Clave UI | Direction: RTL (Hebrew)
   ========================================================================== */

/* ---------- Custom Properties ---------- */
:root {
    --charcoal: #3C3C3B;
    --charcoal-light: #555;
    --coral: #E8644A;
    --coral-hover: #d4553c;
    --yellow: #F4C430;
    --bg: #FAFAFA;
    --white: #FFFFFF;
    --gray-100: #F5F5F5;
    --gray-200: #EEEEEE;
    --gray-300: #E0E0E0;
    --gray-400: #BDBDBD;
    --gray-500: #9E9E9E;
    --gray-600: #757575;
    --red: #D32F2F;
    --red-light: #FFEBEE;
    --green: #2E7D32;
    --green-light: #E8F5E9;
    --shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.10);
    --radius: 8px;
}

/* ---------- Reset / Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Heebo', sans-serif;
    background: var(--bg);
    color: var(--charcoal);
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 0;
}

/* ---------- Header ---------- */
.header {
    width: 100%;
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 12px 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    gap: 4px;
}

/* ---------- Main Content ---------- */
.main {
    max-width: 900px;
    width: 100%;
    flex: 1;
    padding: 48px 24px 32px;
}

.main--narrow {
    max-width: 680px;
}

.main--lesson {
    max-width: 1140px;
    padding-top: 32px;
}

/* ---------- Footer ---------- */
.footer {
    width: 100%;
    text-align: center;
    padding: 24px;
    font-size: 13px;
    font-weight: 300;
    color: var(--gray-400);
    margin-top: auto;
}

/* ---------- Cards ---------- */
.card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 32px;
    margin-bottom: 24px;
    animation: fadeIn 0.3s ease;
}

/* ---------- Hero Section ---------- */
.hero {
    text-align: center;
    margin-bottom: 40px;
}

.hero h1 {
    font-size: 2.2em;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--charcoal);
    margin-bottom: 8px;
}

.hero p {
    font-size: 1.1em;
    font-weight: 400;
    line-height: 1.7;
    color: var(--gray-600);
}

/* ---------- Deco Bars ---------- */
.deco-bars {
    display: flex;
    justify-content: center;
    gap: 0;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.deco-bar-1 {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--yellow);
    margin-bottom: 4px;
}

.deco-bar-2 {
    width: 32px;
    height: 4px;
    border-radius: 2px;
    background: var(--coral);
    margin-bottom: 4px;
}

.deco-bar-3 {
    width: 24px;
    height: 4px;
    border-radius: 2px;
    background: var(--charcoal);
}

/* ---------- Buttons ---------- */
.btn-primary {
    padding: 14px 36px;
    background: var(--coral);
    color: var(--white);
    font-weight: 700;
    font-size: 16px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(232, 100, 74, 0.25);
    transition: 0.15s;
    font-family: 'Heebo', sans-serif;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(232, 100, 74, 0.35);
    background: var(--coral-hover);
}

.btn-primary:disabled {
    background: var(--gray-300);
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 14px 36px;
    background: var(--white);
    border: 1.5px solid var(--gray-300);
    color: var(--charcoal);
    font-weight: 700;
    font-size: 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: 0.15s;
    font-family: 'Heebo', sans-serif;
}

.btn-secondary:hover {
    border-color: var(--coral);
    color: var(--coral);
}

.btn-danger {
    padding: 14px 36px;
    background: var(--white);
    border: 1.5px solid var(--red);
    color: var(--red);
    font-weight: 700;
    font-size: 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: 0.15s;
    font-family: 'Heebo', sans-serif;
}

.btn-danger:hover {
    background: var(--red-light);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
    display: block;
}

/* ---------- Form Elements ---------- */
.form-group {
    margin-bottom: 16px;
}

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

.form-input {
    width: 100%;
    padding: 14px 18px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: 'Heebo', sans-serif;
    direction: rtl;
    background: var(--white);
    transition: 0.15s;
}

.form-input:focus {
    border-color: var(--coral);
    box-shadow: 0 0 0 3px rgba(232, 100, 74, 0.12);
    outline: none;
}

.form-input--ltr {
    direction: ltr;
    text-align: left;
}

textarea.form-input {
    min-height: 100px;
    resize: vertical;
}

.form-checkbox {
    accent-color: var(--coral);
}

/* ---------- Tables ---------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    direction: rtl;
}

.data-table th {
    padding: 12px 16px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
    background: var(--gray-100);
}

.data-table td {
    padding: 12px 16px;
    text-align: right;
    font-size: 14px;
    border-bottom: 1px solid var(--gray-200);
}

.data-table tr:hover td {
    background: rgba(232, 100, 74, 0.04);
}

.data-table th:first-child,
.data-table td:first-child {
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--white);
}

.data-table th:first-child {
    background: var(--gray-100);
}

/* ---------- Course Cards ---------- */
.course-card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 16px;
    transition: 0.15s;
    cursor: pointer;
    border-inline-start: 4px solid var(--coral);
    animation: fadeIn 0.3s ease;
}

.course-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.course-card__title {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--charcoal);
    margin-bottom: 4px;
}

.course-card__desc {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 12px;
}

.course-card__meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--gray-500);
}

.course-card__actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ---------- Lesson List ---------- */
.lesson-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--white);
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: 0.15s;
    border-inline-start: 4px solid var(--gray-300);
    animation: fadeIn 0.3s ease;
}

.lesson-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.lesson-item--completed {
    border-inline-start-color: var(--green);
}

.lesson-item--active {
    border-inline-start-color: var(--coral);
}

.lesson-item__number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    background: var(--gray-100);
    color: var(--gray-500);
    flex-shrink: 0;
}

.lesson-item__number--completed {
    background: var(--green-light);
    color: var(--green);
}

.lesson-item__number--active {
    background: rgba(232, 100, 74, 0.12);
    color: var(--coral);
}

.lesson-item__content {
    flex: 1;
}

.lesson-item__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--charcoal);
}

.lesson-item__subtitle {
    font-size: 13px;
    color: var(--gray-500);
}

.lesson-item__actions {
    display: flex;
    gap: 8px;
}

/* ---------- Progress Bar ---------- */
.progress-bar__container {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-bar__fill {
    height: 100%;
    background: var(--coral);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.progress-bar__text {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
}

/* ---------- Lesson View ---------- */
.lesson-view__title {
    font-size: 1.6em;
    font-weight: 800;
    color: var(--charcoal);
    margin-bottom: 16px;
    text-align: center;
}

.lesson-view__text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--charcoal-light);
    margin-bottom: 24px;
    white-space: pre-wrap;
}

.lesson-view__video {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.lesson-view__video iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.lesson-view__nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
    gap: 16px;
}

.lesson-view__complete-btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------- Login Page ---------- */
.login-card {
    max-width: 420px;
    margin: 0 auto;
}

.login-card__title {
    text-align: center;
    font-size: 1.6em;
    font-weight: 800;
    margin-bottom: 24px;
}

/* ---------- Flash Messages ---------- */
.flash-message {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

.flash-message--success {
    background: var(--green-light);
    color: var(--green);
    border: 1px solid rgba(46, 125, 50, 0.2);
}

.flash-message--error {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid rgba(211, 47, 47, 0.2);
}

.flash-message--info {
    background: rgba(232, 100, 74, 0.08);
    color: var(--coral);
    border: 1px solid rgba(232, 100, 74, 0.2);
}

/* ---------- WhatsApp Floating Button ---------- */
.whatsapp-fab {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 1000;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #25D366;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    cursor: pointer;
    transition: 0.2s;
    border: none;
    text-decoration: none;
}

.whatsapp-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

.whatsapp-fab svg {
    width: 28px;
    height: 28px;
    fill: var(--white);
}

/* ---------- Admin Toolbar ---------- */
.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge--coral {
    background: rgba(232, 100, 74, 0.12);
    color: var(--coral);
}

.badge--green {
    background: var(--green-light);
    color: var(--green);
}

.badge--gray {
    background: var(--gray-100);
    color: var(--gray-500);
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-400);
}

.empty-state__icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state__text {
    font-size: 15px;
    margin-bottom: 8px;
}

.empty-state__hint {
    font-size: 13px;
    color: var(--gray-500);
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay--active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    max-width: 480px;
    width: 90%;
    background: var(--white);
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.modal__close {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-100);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.15s;
}

.modal__close:hover {
    background: var(--gray-200);
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 13px;
}

.breadcrumb a {
    color: var(--gray-500);
    text-decoration: none;
    transition: 0.15s;
}

.breadcrumb a:hover {
    color: var(--coral);
}

.breadcrumb__separator {
    color: var(--gray-300);
}

.breadcrumb__current {
    color: var(--charcoal);
    font-weight: 600;
}

/* ---------- User Nav ---------- */
.user-nav {
    position: absolute;
    top: 12px;
    left: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-nav__name {
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 500;
}

.user-nav__logout {
    color: var(--coral);
    font-size: 13px;
    text-decoration: none;
    font-weight: 600;
}

.user-nav__logout:hover {
    text-decoration: underline;
}

.user-nav__link {
    color: var(--coral);
    font-size: 13px;
    text-decoration: none;
    font-weight: 600;
}

.user-nav__link:hover {
    text-decoration: underline;
}

/* ---------- Header Logo ---------- */
.header__logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

/* ---------- Profile Button (mobile) ---------- */
.header-profile {
    display: none;
    position: relative;
}

.profile-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-100);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.15s;
    color: var(--gray-600);
    padding: 0;
}

.profile-btn:hover {
    background: var(--gray-200);
}

.profile-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 12px 16px;
    min-width: 160px;
    z-index: 200;
    text-align: right;
}

.profile-dropdown--open {
    display: block;
}

.profile-dropdown__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.profile-dropdown__link {
    display: block;
    font-size: 13px;
    color: var(--charcoal);
    text-decoration: none;
    padding: 6px 0;
    transition: 0.15s;
}

.profile-dropdown__link:hover {
    color: var(--coral);
}

.profile-dropdown__logout {
    display: block;
    width: 100%;
    text-align: right;
    background: none;
    border: none;
    font-family: 'Heebo', sans-serif;
    font-size: 13px;
    color: var(--coral);
    cursor: pointer;
    padding: 6px 0;
    font-weight: 600;
    transition: 0.15s;
}

.profile-dropdown__logout:hover {
    opacity: 0.8;
}

/* ---------- Hamburger Button (lesson pages, mobile) ---------- */
.header-hamburger {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--yellow);
    border: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.15s;
    flex-shrink: 0;
    padding: 0;
}

.header-hamburger:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

/* ---------- Checkbox / Remember Me ---------- */
.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0;
}

.remember-me input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    cursor: pointer;
    transition: 0.15s;
    flex-shrink: 0;
    position: relative;
}

.remember-me input[type="checkbox"]:checked {
    background: var(--coral);
    border-color: var(--coral);
}

.remember-me input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 6px;
    height: 10px;
    border: solid var(--white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.remember-me label {
    font-size: 14px;
    color: var(--gray-600);
    cursor: pointer;
}

/* ---------- Lesson Layout with Sidebar ---------- */
.lesson-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.lesson-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lesson-sidebar__header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--gray-200);
}

.lesson-sidebar__back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--gray-500);
    text-decoration: none;
    margin-bottom: 8px;
    transition: 0.15s;
}

.lesson-sidebar__back:hover {
    color: var(--coral);
}

.lesson-sidebar__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--charcoal);
    margin: 0 0 12px;
    line-height: 1.4;
}

.lesson-sidebar__progress {
    margin-top: 4px;
}

.lesson-sidebar__nav {
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
}

/* Sidebar lesson items */
.sidebar-lesson {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    text-decoration: none;
    color: var(--charcoal);
    transition: 0.15s;
    border-inline-start: 3px solid transparent;
}

.sidebar-lesson:hover {
    background: var(--gray-100);
}

.sidebar-lesson--active {
    background: rgba(232, 100, 74, 0.06);
    border-inline-start-color: var(--coral);
}

.sidebar-lesson--completed:not(.sidebar-lesson--active) {
    opacity: 0.75;
}

.sidebar-lesson--completed:not(.sidebar-lesson--active):hover {
    opacity: 1;
}

.sidebar-lesson__icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    background: var(--gray-100);
    color: var(--gray-500);
    flex-shrink: 0;
}

.sidebar-lesson__icon--completed {
    background: var(--green-light);
    color: var(--green);
}

.sidebar-lesson__icon--active {
    background: rgba(232, 100, 74, 0.12);
    color: var(--coral);
}

.sidebar-lesson__title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.sidebar-lesson--active .sidebar-lesson__title {
    font-weight: 700;
    color: var(--coral);
}

/* Lesson content area */
.lesson-content {
    flex: 1;
    min-width: 0;
    max-width: 720px;
}

/* Mobile lesson bar (full-width progress bar) */
.mobile-lesson-bar {
    display: none;
    margin-bottom: 12px;
}

/* Mobile promo (below lesson content) */
.mobile-promo {
    display: none;
    margin-top: 24px;
}

.mobile-promo .sidebar-promo {
    max-width: 400px;
    margin: 0 auto;
}

/* Sidebar custom scrollbar */
.lesson-sidebar__nav::-webkit-scrollbar {
    width: 4px;
}

.lesson-sidebar__nav::-webkit-scrollbar-track {
    background: transparent;
}

.lesson-sidebar__nav::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 2px;
}

.lesson-sidebar__nav::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Sidebar consultation promo */
.sidebar-promo {
    margin: 0 12px 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(232,100,74,0.04) 0%, rgba(232,100,74,0.08) 100%);
    border-radius: 10px;
    border: 1px solid rgba(232,100,74,0.12);
    text-align: center;
}

.sidebar-promo__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(232,100,74,0.1);
    color: var(--coral);
    margin-bottom: 8px;
}

.sidebar-promo__title {
    font-size: 13px;
    font-weight: 700;
    color: var(--charcoal);
    margin-bottom: 4px;
}

.sidebar-promo__desc {
    font-size: 11px;
    color: var(--gray-500);
    line-height: 1.5;
    margin-bottom: 10px;
}

.sidebar-promo__link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--coral);
    text-decoration: none;
    transition: 0.15s;
}

.sidebar-promo__link:hover {
    opacity: 0.8;
}

/* ---------- Template Editor ---------- */
.tmpl-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.tmpl-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    font-family: 'Heebo', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: 0.15s;
}

.tmpl-tab:hover {
    border-color: var(--coral);
    color: var(--coral);
}

.tmpl-tab--active {
    background: var(--coral);
    color: var(--white);
    border-color: var(--coral);
}

.tmpl-tab--active:hover {
    color: var(--white);
}

.tmpl-editor {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.tmpl-editor__form {
    flex: 1;
    min-width: 0;
}

.tmpl-editor__preview {
    width: 380px;
    flex-shrink: 0;
}

.tmpl-vars {
    margin: 16px 0 8px;
}

.tmpl-vars__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.tmpl-vars__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.var-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 16px;
    border: 1px solid var(--gray-200);
    background: var(--gray-100);
    font-size: 12px;
    font-family: 'Heebo', sans-serif;
    color: var(--charcoal);
    cursor: pointer;
    transition: 0.15s;
}

.var-chip:hover {
    border-color: var(--coral);
    background: rgba(232, 100, 74, 0.08);
    color: var(--coral);
}

.var-chip code {
    font-weight: 700;
    font-size: 11px;
    color: var(--coral);
}

.tmpl-tip {
    font-size: 12px;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-top: 8px;
    line-height: 1.6;
}

/* WhatsApp Phone Preview */
.wa-phone {
    background: #E5DDD5;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.wa-phone__header {
    background: #075E54;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wa-phone__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #128C7E;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.wa-phone__name {
    color: var(--white);
    font-weight: 600;
    font-size: 15px;
}

.wa-phone__chat {
    padding: 16px;
    min-height: 200px;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h60v60H0z' fill='%23E5DDD5'/%3E%3Cpath d='M30 30m-1 0a1 1 0 102 0 1 1 0 10-2 0' fill='%23D4CCB3' opacity='.3'/%3E%3C/svg%3E");
}

.wa-bubble {
    background: #DCF8C6;
    border-radius: 8px 0 8px 8px;
    padding: 10px 14px;
    max-width: 100%;
    font-size: 14px;
    line-height: 1.7;
    color: #303030;
    direction: rtl;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: relative;
}

.wa-bubble a {
    color: #53bdeb;
    text-decoration: none;
}

.wa-time {
    text-align: left;
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding-left: 8px;
}

/* Email Preview Frame */
.email-preview-frame {
    width: 100%;
    height: 520px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--white);
}

/* Template editor responsive */
@media (max-width: 900px) {
    .tmpl-editor {
        flex-direction: column;
    }

    .tmpl-editor__preview {
        width: 100%;
    }

    .email-preview-frame {
        height: 450px;
    }
}

@media (max-width: 600px) {
    .tmpl-tabs {
        flex-direction: column;
    }

    .tmpl-tab {
        justify-content: center;
    }
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Utility Classes ---------- */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--gray-500);
}

.mt-16 {
    margin-top: 16px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.gap-8 {
    gap: 8px;
}

.gap-16 {
    gap: 16px;
}

/* ---------- Responsive ---------- */

/* Tablet: sidebar collapses, mobile header */
@media (max-width: 900px) {
    /* --- Mobile header layout --- */
    .header {
        position: relative;
        justify-content: center;
        flex-wrap: nowrap;
        min-height: 56px;
    }

    .user-nav {
        display: none;
    }

    .header-profile {
        display: block;
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
    }

    .header-hamburger {
        display: flex;
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
    }

    /* --- Lesson layout --- */
    .lesson-layout {
        flex-direction: column;
    }

    .mobile-lesson-bar {
        display: block;
        margin-bottom: 16px;
    }

    .mobile-promo {
        display: block;
    }

    .lesson-sidebar {
        width: 100%;
        position: static;
        max-height: none;
        display: none;
        margin-bottom: 16px;
    }

    .lesson-sidebar.sidebar--open {
        display: flex;
    }

    .lesson-sidebar__nav {
        max-height: 50vh;
    }

    .lesson-content {
        max-width: 100%;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .header {
        padding: 8px 12px;
    }

    .header img {
        height: 36px;
    }

    .main {
        padding: 16px;
    }

    .main--lesson {
        padding-top: 12px;
    }

    .card {
        padding: 20px;
    }

    .hero h1 {
        font-size: 1.7em;
    }

    .course-card {
        padding: 16px;
    }

    /* Breadcrumb: compact, wraps naturally */
    .breadcrumb {
        font-size: 12px;
        gap: 4px;
        margin-bottom: 12px;
        flex-wrap: wrap;
        line-height: 1.6;
    }

    .lesson-view__title {
        font-size: 1.3em;
    }

    .lesson-view__nav {
        flex-direction: column;
        width: 100%;
    }

    .lesson-view__nav .btn-primary,
    .lesson-view__nav .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .admin-toolbar {
        flex-direction: column;
    }

    .data-table {
        font-size: 12px;
    }

    .modal {
        padding: 20px;
    }
}

/* ==========================================================================
   Progress tracking (admin)
   ========================================================================== */

.progress-matrix th,
.progress-matrix td {
    white-space: nowrap;
}

.progress-matrix__sticky {
    position: sticky;
    right: 0;
    background: var(--white);
    z-index: 2;
    box-shadow: -1px 0 0 var(--gray-200);
    min-width: 140px;
    text-align: right;
}

.progress-matrix thead .progress-matrix__sticky {
    z-index: 3;
    background: var(--gray-100);
}

.prog-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 24px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 0 6px;
}

.prog-cell--done {
    background: rgba(46, 125, 50, 0.12);
    color: var(--green);
}

.prog-cell--video {
    background: rgba(244, 196, 48, 0.18);
    color: #8a6d00;
}

.prog-cell--none {
    color: var(--gray-300);
}

.prog-legend {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    vertical-align: middle;
}

.prog-legend--done {
    background: rgba(46, 125, 50, 0.5);
}

.prog-legend--video {
    background: rgba(244, 196, 48, 0.6);
}

/* ==========================================================================
   Lesson analytics (admin)
   ========================================================================== */

.analytics-tabs {
    display: inline-flex;
    gap: 4px;
    background: var(--gray-100);
    padding: 4px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.analytics-tab {
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-600);
    text-decoration: none;
    transition: 0.15s;
}

.analytics-tab:hover {
    color: var(--charcoal);
}

.analytics-tab--active {
    background: var(--white);
    color: var(--coral);
    box-shadow: var(--shadow);
}

.stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.stat-tile {
    flex: 1;
    min-width: 110px;
    background: var(--gray-100);
    border-radius: var(--radius);
    padding: 14px 16px;
    text-align: center;
}

.stat-tile--big {
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 20px 16px;
}

.stat-tile--muted {
    opacity: 0.6;
}

.stat-tile__value {
    font-size: 24px;
    font-weight: 800;
    color: var(--charcoal);
    line-height: 1.1;
}

.stat-tile__sub {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-400);
}

.stat-tile__label {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 6px;
}

.lesson-analytics-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
    border-inline-start: 4px solid var(--coral);
}

.lesson-analytics-card__head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.lesson-analytics-card__num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.lesson-analytics-card__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--charcoal);
    flex: 1;
    min-width: 150px;
}

.lesson-analytics-card__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
}
