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

body {
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
    text-align: right;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Layout */
.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 24px 18px;
}

.container-narrow {
    max-width: 560px;
    margin: 0 auto;
    padding: 28px 20px;
}

.container-landing {
    max-width: 640px;
    margin: 0 auto;
    padding: 56px 20px;
}

/* Center layout (for onboarding) */
.center-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.center-box {
    width: 100%;
    max-width: 380px;
    text-align: center;
}

/* Navigation */
.nav {
    position: sticky;
    top: 0;
    z-index: 99;
    background: var(--nav-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    padding: 9px 18px;
}

.nav-inner {
    max-width: 820px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
}

.nav-logo {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #0d9488, #2563eb);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.nav-title {
    font-weight: 900;
    font-size: 17px;
    background: linear-gradient(135deg, #0d9488, #2563eb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 700;
}

/* Theme toggle */
.theme-toggle {
    width: 32px;
    height: 18px;
    border-radius: 9px;
    background: var(--elevated);
    border: 1px solid var(--border);
    cursor: pointer;
    position: relative;
    padding: 0;
}

.theme-toggle-knob {
    position: absolute;
    top: 1px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--card);
    box-shadow: 0 1px 2px rgba(0,0,0,.1);
    transition: right .3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
}

.theme-light .theme-toggle-knob {
    right: 1px;
}

.theme-dark .theme-toggle-knob {
    right: 14px;
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, #0d9488, #2563eb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Grid layouts */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

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

/* Large tablets and small laptops */
@media (max-width: 900px) {
    .container {
        max-width: 100%;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .container {
        padding: 20px 16px;
    }

    .container-landing {
        padding: 36px 16px;
    }

    .grid-2 {
        gap: 8px;
    }

    /* 4-column inline grids on landing → 2 columns */
    .stats-grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .nav-actions {
        gap: 6px;
        font-size: 11px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .stats-grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .container {
        padding: 16px 14px;
    }

    .container-narrow {
        padding: 20px 14px;
    }

    .container-landing {
        padding: 28px 14px;
    }

    .nav {
        padding: 7px 12px;
    }

    .nav-actions {
        gap: 5px;
        font-size: 10px;
    }

    .nav-actions .pill {
        font-size: 9px;
        padding: 2px 6px;
    }

    .nav-title {
        font-size: 15px;
    }

    .nav-logo {
        width: 26px;
        height: 26px;
        font-size: 13px;
    }

    /* Touch-friendly minimum sizes */
    .btn-primary, .btn-secondary {
        min-height: 44px;
    }

    .option-btn {
        min-height: 48px;
        padding: 14px 14px;
    }

    .section-card {
        padding: 18px;
    }

    /* Pricing grids stay 2 columns but shrink */
    .pricing-grid {
        gap: 8px !important;
    }

    /* Step indicator compacts on small screens */
    .step-indicator {
        gap: 5px;
        font-size: 10px;
    }

    .step-dot {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }

    .step-line {
        width: 16px;
    }

    /* CTA card */
    .cta-card {
        padding: 16px;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .stats-grid-4 {
        grid-template-columns: 1fr 1fr !important;
        gap: 6px !important;
    }

    .container-narrow {
        padding: 16px 12px;
    }

    .card {
        padding: 16px;
    }
}

/* Progress dots */
.progress-dots {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
}

.progress-dot {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: var(--elevated);
}

.progress-dot.done {
    background: var(--color-primary);
}

.progress-dot.active {
    background: linear-gradient(90deg, #0d9488, #2563eb);
}

/* Section progress bar */
.progress-bar-track {
    height: 6px;
    border-radius: 6px;
    background: var(--elevated);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width .4s;
    min-width: 2%;
}

/* Timer bar */
.timer-bar-track {
    height: 4px;
    border-radius: 4px;
    background: var(--elevated);
    margin-bottom: 16px;
    overflow: hidden;
}

.timer-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0d9488, #2563eb);
    border-radius: 4px;
    transition: width 1s linear;
}

.timer-bar-fill.danger {
    background: var(--color-danger);
}

/* Utility classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-4 { margin-bottom: 4px; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-14 { margin-bottom: 14px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-28 { margin-bottom: 28px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none; }
