/* ========================================================
   Courses Zone Academy - English Placement Test Styling
   Modern, Mobile-First, Responsive & Arabic RTL First
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap');

:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #eff6ff;
    --primary-glow: rgba(30, 64, 175, 0.15);

    --secondary: #d97706;
    --secondary-light: #fef3c7;

    --success: #10b981;
    --success-light: #ecfdf5;

    --whatsapp: #25d366;
    --whatsapp-dark: #1ea952;
    --whatsapp-glow: rgba(37, 211, 102, 0.35);

    --dark: #0f172a;
    --dark-alt: #1e293b;
    --text: #334155;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --light: #f8fafc;
    --white: #ffffff;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.04);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --font-sans: 'Cairo', system-ui, -apple-system, sans-serif;
}

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

html {
    font-family: var(--font-sans);
    direction: rtl;
    text-align: right;
    scroll-behavior: smooth;
    font-size: 16px;
    background-color: #f1f5f9;
    color: var(--text);
}

body {
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.test-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    position: sticky;
    top: 0;
    z-index: 100;
}

.test-header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-text-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    line-height: 1;
}

.brand-text-logo .brand-name-en {
    font-size: 1.35rem;
    font-weight: 900;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: system-ui, sans-serif;
}

.brand-text-logo .brand-badge-en {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    border: 1px solid rgba(30, 64, 175, 0.2);
}

.header-status {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 700;
}

/* Main Container */
.test-container {
    width: 100%;
    max-width: 860px;
    margin: 2.5rem auto;
    padding: 0 1.25rem;
    flex: 1;
}

/* Cards */
.test-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2.25rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

/* Registration Form */
.reg-title {
    font-size: 1.85rem;
    font-weight: 900;
    color: var(--dark);
    margin-bottom: 0.5rem;
    text-align: center;
}

.reg-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
    line-height: 1.8;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: right;
}

.form-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.45rem;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1.15rem;
    font-size: 1rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    background: var(--white);
    color: var(--dark);
    outline: none;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Explicit Consent Checkbox */
.consent-box {
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: 12px;
    padding: 1.15rem 1.25rem;
    margin: 1.75rem 0;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.consent-box:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

.consent-box input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 3px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.consent-text {
    font-size: 0.925rem;
    line-height: 1.6;
    color: var(--dark);
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 800;
    padding: 0.85rem 1.85rem;
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    text-decoration: none;
    line-height: 1.25;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30,64,175,0.25);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}

.btn-secondary:hover {
    background: #b45309;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--dark);
}

.btn-outline:hover {
    background: var(--light);
    border-color: #cbd5e1;
    color: var(--primary);
}

.btn-whatsapp {
    background: var(--whatsapp);
    color: var(--white);
    box-shadow: 0 4px 14px var(--whatsapp-glow);
}

.btn-whatsapp:hover {
    background: var(--whatsapp-dark);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(37, 211, 102, 0.45);
}

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

/* Progress Header */
.exam-progress-header {
    margin-bottom: 2rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.925rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.65rem;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #3b82f6);
    transition: width 0.3s ease;
}

/* Question Section */
.question-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.q-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.q-category-badge.grammar { background: #dbeafe; color: #1e40af; }
.q-category-badge.vocabulary { background: #fef3c7; color: #92400e; }
.q-category-badge.reading { background: #e0e7ff; color: #4338ca; }

.q-index-pill {
    font-size: 0.875rem;
    font-weight: 800;
    color: var(--text-muted);
}

/* Reading Passage Box */
.reading-passage-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-right: 4px solid #4338ca;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--dark-alt);
    text-align: left;
    direction: ltr;
}

.reading-passage-title {
    font-weight: 800;
    color: #312e81;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Question Title */
.question-title {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 1.5rem;
    line-height: 1.5;
    text-align: left;
    direction: ltr;
}

/* Option List */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 2rem;
    direction: ltr;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--white);
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--dark);
    text-align: left;
}

.option-item:hover {
    border-color: var(--primary);
    background: var(--light);
}

.option-item.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

.option-radio {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* Test Navigation Controls */
.test-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* Result Card */
.result-card {
    text-align: center;
    padding: 3rem 2rem;
}

.result-emoji {
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 1rem;
}

.result-score-circle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: var(--white);
    margin: 1.5rem auto;
    box-shadow: 0 10px 25px var(--primary-glow);
}

.score-num {
    font-size: 2.75rem;
    font-weight: 900;
    line-height: 1;
}

.score-total {
    font-size: 1rem;
    opacity: 0.85;
    font-weight: 700;
}

.result-level-badge {
    display: inline-block;
    padding: 0.5rem 1.75rem;
    border-radius: var(--radius-full);
    font-size: 1.25rem;
    font-weight: 900;
    margin: 1rem 0;
}

.level-beginner { background: #fef2f2; color: #991b1b; border: 1.5px solid #fecaca; }
.level-elementary { background: #fffbeb; color: #92400e; border: 1.5px solid #fde68a; }
.level-pre { background: #eff6ff; color: #1e40af; border: 1.5px solid #bfdbfe; }
.level-intermediate { background: #ecfdf5; color: #065f46; border: 1.5px solid #a7f3d0; }
.level-upper { background: #f5f3ff; color: #5b21b6; border: 1.5px solid #ddd6fe; }

.result-feedback-box {
    background: var(--light);
    border-radius: 14px;
    padding: 1.5rem;
    margin: 1.75rem 0;
    text-align: right;
    border: 1px solid var(--border);
}

.result-feedback-ar {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1.8;
    margin-bottom: 0.75rem;
}

.result-feedback-en {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.7;
    direction: ltr;
    text-align: left;
    font-family: system-ui, -apple-system, sans-serif;
}

/* Category Breakdown Bars */
.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.75rem 0;
}

.breakdown-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

.breakdown-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 700;
}

.breakdown-val {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--dark);
    margin-top: 0.25rem;
}

/* Alert Boxes */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-weight: 700;
    font-size: 0.95rem;
}
.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* Footer */
.test-footer {
    text-align: center;
    padding: 2rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--white);
}

/* Responsive */
@media (max-width: 640px) {
    .test-card {
        padding: 1.75rem 1.25rem;
    }
    .reg-title {
        font-size: 1.5rem;
    }
    .question-title {
        font-size: 1.15rem;
    }
    .breakdown-grid {
        grid-template-columns: 1fr;
    }
    .result-score-circle {
        width: 120px;
        height: 120px;
    }
    .score-num {
        font-size: 2.25rem;
    }
}
