/* ===== Reset & Variables ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #1a56db;
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

body {
    font-family: 'Inter', 'Noto Sans Arabic', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

.survey-container { max-width: 800px; margin: 0 auto; padding: 20px; }
.landing-page { max-width: 600px; margin: 40px auto; padding: 20px; text-align: center; }

/* Header */
.survey-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white; padding: 40px 30px; border-radius: var(--radius);
    text-align: center; margin-bottom: 30px; box-shadow: var(--shadow-lg);
}
.survey-header h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 8px; }
.survey-header .subtitle { font-size: 1.4rem; font-weight: 600; opacity: 0.95; direction: rtl; }
.survey-header .description { margin-top: 15px; font-size: 0.95rem; opacity: 0.85; line-height: 1.7; }
.badge { display: inline-block; background: rgba(255,255,255,0.2); padding: 6px 16px; border-radius: 20px; font-size: 0.85rem; margin-top: 12px; }

/* Progress */
.progress-bar-container { position: sticky; top: 0; z-index: 100; background: white; padding: 10px 20px; box-shadow: var(--shadow); margin-bottom: 20px; border-radius: 0 0 var(--radius) var(--radius); }
.progress-bar { height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--success)); border-radius: 3px; transition: width 0.3s; width: 0%; }
.progress-text { text-align: center; font-size: 0.8rem; color: var(--gray-500); margin-top: 5px; }

/* Scale Legend */
.scale-legend { background: white; border-radius: var(--radius); padding: 20px; margin-bottom: 25px; box-shadow: var(--shadow); display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.scale-item { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--gray-600); }
.scale-number { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.8rem; }

/* Section */
.section { background: white; border-radius: var(--radius); padding: 30px; margin-bottom: 25px; box-shadow: var(--shadow); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; padding-bottom: 15px; border-bottom: 2px solid var(--gray-100); }
.section-header h2 { font-size: 1.2rem; color: var(--primary); font-weight: 600; }
.section-header .section-title-ar { font-size: 1.15rem; color: var(--primary-dark); font-weight: 600; direction: rtl; }

/* Question */
.question { padding: 20px 0; border-bottom: 1px solid var(--gray-100); transition: background 0.3s; }
.question:last-child { border-bottom: none; padding-bottom: 0; }
.question-number { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: var(--primary); color: white; border-radius: 50%; font-size: 0.85rem; font-weight: 600; margin-bottom: 10px; }
.question-text { font-size: 1rem; color: var(--gray-800); margin-bottom: 4px; font-weight: 500; }
.question-text-ar { font-size: 0.95rem; color: var(--gray-600); direction: rtl; text-align: right; margin-bottom: 15px; }

/* Likert */
.likert-options { display: flex; gap: 8px; flex-wrap: wrap; }
.likert-option { flex: 1; min-width: 100px; }
.likert-option input[type="radio"] { display: none; }
.likert-option label { display: block; text-align: center; padding: 12px 8px; border: 2px solid var(--gray-200); border-radius: 10px; cursor: pointer; transition: all 0.2s; font-size: 0.8rem; color: var(--gray-600); background: white; }
.likert-option label:hover { border-color: var(--primary); background: var(--primary-light); }
.likert-option input[type="radio"]:checked + label { border-color: var(--primary); background: var(--primary); color: white; font-weight: 600; box-shadow: var(--shadow-md); }
.likert-option .label-number { display: block; font-size: 1.1rem; font-weight: 700; margin-bottom: 2px; }
.likert-option .label-text-ar { display: block; font-size: 0.75rem; direction: rtl; }

/* eNPS / 0–10 numeric scale */
.nps-scale { margin-top: 4px; }
.likert-options--nps .likert-option { flex: 0 1 auto; min-width: 44px; }
/* A two-pole rating has five points, so they spread across the row and each pole label below
   sits under the end it names — the eNPS rule above hugs content and bunches them to the left. */
.likert-options--poles .likert-option { flex: 1 1 0; }
.likert-options--nps .likert-option label { padding: 12px 6px; font-size: 1rem; }
.nps-endpoints { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 0.78rem; color: var(--gray-600); }
.nps-endpoints > span { max-width: 46%; }
.nps-endpoints > span:last-child { text-align: right; }
.nps-ep-ar { direction: rtl; opacity: 0.75; }
@media (max-width: 480px) {
    .likert-options--nps { flex-direction: row; flex-wrap: wrap; }
    .likert-options--nps .likert-option { min-width: 40px; }
    .likert-options--nps .likert-option label { display: block; text-align: center; padding: 10px 4px; }
}

/* Open-ended */
.open-textarea { width: 100%; min-height: 100px; padding: 15px; border: 2px solid var(--gray-200); border-radius: 10px; font-family: inherit; font-size: 0.95rem; resize: vertical; transition: border-color 0.2s; }
.open-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* Submit */
.submit-section { text-align: center; padding: 30px; }
.btn-submit { background: linear-gradient(135deg, var(--success) 0%, #047857 100%); color: white; border: none; padding: 16px 60px; font-size: 1.1rem; font-weight: 600; border-radius: 10px; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-md); }
.btn-submit:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.submit-note { margin-top: 12px; font-size: 0.85rem; color: var(--gray-500); }

/* Messages */
.message-page { max-width: 600px; margin: 80px auto; padding: 20px; text-align: center; }
.message-card { background: white; border-radius: var(--radius); padding: 50px 40px; box-shadow: var(--shadow-lg); }
.message-icon { font-size: 4rem; margin-bottom: 20px; }
.message-card h2 { font-size: 1.5rem; color: var(--gray-800); margin-bottom: 10px; }
.message-card .text-ar { font-size: 1.2rem; color: var(--gray-600); direction: rtl; margin-top: 8px; }
.message-card.success { border-top: 4px solid var(--success); }
.message-card.error { border-top: 4px solid var(--danger); }

/* Forms */
.form-row { display: flex; gap: 15px; flex-wrap: wrap; }
.form-group { flex: 1; min-width: 200px; margin-bottom: 15px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 8px; color: var(--gray-700); font-size: 0.9rem; }
.form-control { width: 100%; padding: 12px 15px; border: 2px solid var(--gray-200); border-radius: 10px; font-size: 1rem; font-family: inherit; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* Footer */
.footer { text-align: center; padding: 30px 20px; color: var(--gray-400); font-size: 0.85rem; }
.footer strong { color: var(--gray-500); }
.footer-ar { direction: rtl; margin-top: 4px; font-size: 0.8rem; }

/* Responsive */
@media (max-width: 768px) {
    .survey-header h1 { font-size: 1.4rem; }
    .survey-header .subtitle { font-size: 1.1rem; }
    .section { padding: 20px; }
    .likert-options { gap: 6px; }
    .likert-option { min-width: 60px; }
    .likert-option label { padding: 10px 4px; font-size: 0.75rem; }
    .likert-option .label-text-ar { display: none; }
    .section-header { flex-direction: column; gap: 5px; align-items: flex-start; }
}

@media (max-width: 480px) {
    .likert-options { flex-direction: column; }
    .likert-option { min-width: unset; }
    .likert-option label { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 15px; }
    .likert-option .label-number { margin-bottom: 0; }
    .likert-option .label-text-ar { display: inline; }
}

/* ===== Choice questions (SingleChoice / MultiChoice) ===== */
.choice-hint {
    font-size: 0.85rem; color: var(--gray-600); background: var(--gray-100);
    border-radius: 8px; padding: 6px 12px; margin-bottom: 12px; display: inline-block;
}
.choice-hint-ar { direction: rtl; display: inline-block; margin-inline-start: 8px; opacity: 0.8; }

.choice-options { display: flex; flex-direction: column; gap: 10px; }
.choice-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.choice-option label {
    display: flex; align-items: flex-start; gap: 12px; cursor: pointer;
    padding: 14px 16px; border: 2px solid var(--gray-200); border-radius: var(--radius);
    background: #fff; transition: all 0.15s ease;
}
.choice-option label:hover { border-color: var(--primary); background: var(--primary-light); }
.choice-option input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 2px; }
.choice-option input:checked + label {
    border-color: var(--primary); background: var(--primary-light); box-shadow: var(--shadow-md);
}
.choice-option input:disabled + label { opacity: 0.45; cursor: not-allowed; }

/* Radio dot for single choice, square tick for multi choice */
.choice-mark {
    flex: 0 0 auto; width: 20px; height: 20px; margin-top: 2px;
    border: 2px solid var(--gray-400); border-radius: 50%; background: #fff; position: relative;
}
.choice-options--multi .choice-mark { border-radius: 6px; }
.choice-option input:checked + label .choice-mark { border-color: var(--primary); background: var(--primary); }
.choice-option input:checked + label .choice-mark::after {
    content: ''; position: absolute; left: 5px; top: 1px;
    width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.choice-options:not(.choice-options--multi) .choice-option input:checked + label .choice-mark::after {
    left: 4px; top: 4px; width: 8px; height: 8px; border: none; border-radius: 50%; background: #fff; transform: none;
}

.choice-text { display: flex; flex-direction: column; gap: 2px; }
.choice-text-en { font-weight: 500; }
.choice-text-ar { direction: rtl; font-size: 0.9rem; color: var(--gray-600); }
