:root {
    --bg-a: #f4f7fb;
    --bg-b: #eaf2ff;
    --nav: #0f172a;
    --card: #ffffff;
    --primary: #0ea5e9;
    --accent: #14b8a6;
    --muted: #64748b;
}

* { box-sizing: border-box; }

body.app-shell {
    font-family: 'Plus Jakarta Sans', 'Noto Naskh Arabic', 'Trebuchet MS', sans-serif;
    background: radial-gradient(circle at 15% 15%, var(--bg-b), var(--bg-a));
    min-height: 100vh;
}

html[dir='rtl'] body.app-shell {
    font-family: 'Noto Naskh Arabic', 'Tahoma', sans-serif;
    letter-spacing: 0;
}

.app-nav {
    background: linear-gradient(90deg, var(--nav), #1e293b);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
}

.app-nav .navbar-brand,
.app-nav .nav-link { color: #e2e8f0 !important; }

.app-nav .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.5);
}
.app-nav .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.shadow-soft {
    border-radius: 16px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.stat-card {
    background: linear-gradient(180deg, #fff, #f8fbff);
    border: 0;
}

.stat-card h6 { color: var(--muted); margin: 0; }
.stat-card h2 { margin: 8px 0 0; font-weight: 700; color: #0f172a; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: 0;
}

.lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(226, 232, 240, .92));
    border: 1px solid rgba(148, 163, 184, .28);
    box-shadow: 0 14px 32px rgba(15, 23, 42, .12);
}

.lang-toggle-link {
    min-width: 74px;
    padding: 9px 18px;
    border-radius: 999px;
    text-align: center;
    text-decoration: none;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: #334155;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
}

.lang-toggle-link:hover {
    color: #0f172a;
    transform: translateY(-1px);
}

.lang-toggle-link.is-active {
    background: linear-gradient(135deg, #0f172a, #1d4ed8 55%, #0ea5e9 100%);
    color: #fff;
    box-shadow: 0 10px 24px rgba(29, 78, 216, .28);
}

.lang-toggle-link.is-inactive {
    background: rgba(255,255,255,.72);
}

html[dir='rtl'] .lang-toggle-link {
    letter-spacing: 0;
}

@media (max-width: 575.98px) {
    .lang-toggle {
        width: 100%;
        justify-content: stretch;
    }

    .lang-toggle-link {
        flex: 1 1 0;
        min-width: 0;
    }
}

.list-select {
    max-height: 280px;
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px;
}

.list-item {
    display: block;
    padding: 6px;
    border-radius: 8px;
}

.list-item:hover { background: #f8fafc; }

/* ── Assign mode toggle buttons ─────────────────────────── */
.assign-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: 1.5px solid #cbd5e1;
    border-radius: 30px;
    cursor: pointer;
    font-size: .875rem;
    user-select: none;
    transition: all .15s;
    background: #fff;
    color: #334155;
}
.assign-mode-btn:hover { border-color: var(--primary); color: var(--primary); }
.assign-mode-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

/* ── Section badge ───────────────────────────────────────── */
.section-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    background: #e0f2fe;
    color: #0369a1;
    white-space: nowrap;
}

[dir='rtl'] .me-auto {
    margin-right: 0 !important;
    margin-left: auto !important;
}

/* ── RTL form-check (radio / checkbox) ───────────────────── */
html[dir='rtl'] .form-check {
    padding-left: 0 !important;
    padding-right: 1.5em !important;
    text-align: right;
}

html[dir='rtl'] .form-check .form-check-input {
    float: right !important;
    margin-left: 0 !important;
    margin-right: -1.5em !important;
}

.survey-theme-classic .card {
    border-left: 4px solid #0ea5e9 !important;
}

.survey-theme-modern .card {
    background: linear-gradient(180deg, #ffffff, #f6fbff);
    border-radius: 20px;
}

.survey-theme-minimal .card {
    box-shadow: none;
    border: 1px solid #dbeafe !important;
}

.survey-theme-aurora {
    background: linear-gradient(135deg, #e0f2fe 0%, #ede9fe 40%, #ffe4e6 100%);
    padding: 14px;
    border-radius: 22px;
}

.survey-theme-aurora .card {
    background: linear-gradient(180deg, #ffffff, #f8faff);
    border-top: 5px solid #6366f1;
}

.survey-theme-sunset {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 45%, #ffe4e6 100%);
    padding: 14px;
    border-radius: 22px;
}

.survey-theme-sunset .card {
    background: linear-gradient(180deg, #fff, #fff5f2);
    border-left: 6px solid #f97316 !important;
}

.survey-theme-candy {
    background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 35%, #fae8ff 100%);
    padding: 14px;
    border-radius: 22px;
}

.survey-theme-candy .card {
    background: linear-gradient(180deg, #ffffff, #fff7fd);
    border-right: 6px solid #ec4899 !important;
}

.survey-theme-emerald {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 45%, #ccfbf1 100%);
    padding: 14px;
    border-radius: 22px;
}

.survey-theme-emerald .card {
    background: linear-gradient(180deg, #ffffff, #f0fdfa);
    border-top: 5px solid #10b981;
}

.survey-theme-royal {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #0f172a 100%);
    padding: 14px;
    border-radius: 22px;
}

.survey-theme-royal .card {
    background: linear-gradient(180deg, #1f2937, #111827);
    color: #e5e7eb;
    border: 1px solid #4f46e5;
}

.survey-theme-royal .text-muted,
.survey-theme-royal label,
.survey-theme-royal h3,
.survey-theme-royal h4,
.survey-theme-royal h5,
.survey-theme-royal h6 {
    color: #e5e7eb !important;
}

.template-sample {
    margin-top: 8px;
    padding: 14px;
    border-radius: 16px;
    transition: all 0.25s ease;
}

.survey-theme-oceanic { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 45%, #d1fae5 100%); padding: 14px; border-radius: 22px; }
.survey-theme-oceanic .card { background: linear-gradient(180deg, #fff, #eff6ff); border-left: 6px solid #2563eb !important; }

.survey-theme-lava { background: linear-gradient(135deg, #fee2e2 0%, #fecaca 40%, #fdba74 100%); padding: 14px; border-radius: 22px; }
.survey-theme-lava .card { background: linear-gradient(180deg, #fff, #fff1f2); border-top: 5px solid #dc2626; }

.survey-theme-citrus { background: linear-gradient(135deg, #fef9c3 0%, #fde68a 45%, #bbf7d0 100%); padding: 14px; border-radius: 22px; }
.survey-theme-citrus .card { background: linear-gradient(180deg, #fff, #fefce8); border-right: 6px solid #eab308 !important; }

.survey-theme-coral { background: linear-gradient(135deg, #ffe4e6 0%, #fecdd3 45%, #fed7aa 100%); padding: 14px; border-radius: 22px; }
.survey-theme-coral .card { background: linear-gradient(180deg, #fff, #fff7ed); border-left: 6px solid #fb7185 !important; }

.survey-theme-forest { background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 45%, #a7f3d0 100%); padding: 14px; border-radius: 22px; }
.survey-theme-forest .card { background: linear-gradient(180deg, #fff, #f0fdf4); border-top: 5px solid #15803d; }

.survey-theme-skyglass { background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 45%, #dbeafe 100%); padding: 14px; border-radius: 22px; }
.survey-theme-skyglass .card { background: linear-gradient(180deg, #fff, #f0f9ff); border-right: 6px solid #0ea5e9 !important; }

.survey-theme-monoink { background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 45%, #f3f4f6 100%); padding: 14px; border-radius: 22px; }
.survey-theme-monoink .card { background: linear-gradient(180deg, #fff, #f9fafb); border-left: 6px solid #374151 !important; }

.survey-theme-sand { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 45%, #fed7aa 100%); padding: 14px; border-radius: 22px; }
.survey-theme-sand .card { background: linear-gradient(180deg, #fff, #fffbeb); border-top: 5px solid #d97706; }

.survey-theme-midnight { background: linear-gradient(135deg, #0f172a 0%, #1e293b 45%, #334155 100%); padding: 14px; border-radius: 22px; }
.survey-theme-midnight .card { background: linear-gradient(180deg, #1f2937, #0f172a); color: #f1f5f9; border: 1px solid #38bdf8; }
.survey-theme-midnight .text-muted, .survey-theme-midnight label, .survey-theme-midnight h3, .survey-theme-midnight h4, .survey-theme-midnight h5, .survey-theme-midnight h6 { color: #e2e8f0 !important; }

.survey-theme-lavender { background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 45%, #fbcfe8 100%); padding: 14px; border-radius: 22px; }
.survey-theme-lavender .card { background: linear-gradient(180deg, #fff, #faf5ff); border-left: 6px solid #8b5cf6 !important; }

.survey-theme-rosegold { background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 45%, #fbcfe8 100%); padding: 14px; border-radius: 22px; }
.survey-theme-rosegold .card { background: linear-gradient(180deg, #fff, #fff1f2); border-top: 5px solid #e11d48; }

.survey-theme-mintpop { background: linear-gradient(135deg, #ecfdf5 0%, #a7f3d0 45%, #99f6e4 100%); padding: 14px; border-radius: 22px; }
.survey-theme-mintpop .card { background: linear-gradient(180deg, #fff, #f0fdfa); border-right: 6px solid #10b981 !important; }

.survey-theme-amber { background: linear-gradient(135deg, #fef3c7 0%, #fcd34d 45%, #fb923c 100%); padding: 14px; border-radius: 22px; }
.survey-theme-amber .card { background: linear-gradient(180deg, #fff, #fffbeb); border-left: 6px solid #f59e0b !important; }

.survey-theme-glacier { background: linear-gradient(135deg, #e0f2fe 0%, #cffafe 45%, #ecfeff 100%); padding: 14px; border-radius: 22px; }
.survey-theme-glacier .card { background: linear-gradient(180deg, #fff, #f0f9ff); border-top: 5px solid #06b6d4; }

.survey-theme-tropic { background: linear-gradient(135deg, #ccfbf1 0%, #a7f3d0 45%, #fde047 100%); padding: 14px; border-radius: 22px; }
.survey-theme-tropic .card { background: linear-gradient(180deg, #fff, #f7fee7); border-right: 6px solid #14b8a6 !important; }

.survey-theme-graphite { background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 45%, #94a3b8 100%); padding: 14px; border-radius: 22px; }
.survey-theme-graphite .card { background: linear-gradient(180deg, #fff, #f8fafc); border-left: 6px solid #475569 !important; }

.survey-theme-peach { background: linear-gradient(135deg, #ffedd5 0%, #fdba74 45%, #fecdd3 100%); padding: 14px; border-radius: 22px; }
.survey-theme-peach .card { background: linear-gradient(180deg, #fff, #fff7ed); border-top: 5px solid #f97316; }

.survey-theme-berry { background: linear-gradient(135deg, #f5d0fe 0%, #f0abfc 45%, #fda4af 100%); padding: 14px; border-radius: 22px; }
.survey-theme-berry .card { background: linear-gradient(180deg, #fff, #fdf4ff); border-right: 6px solid #a21caf !important; }

.survey-theme-aqua { background: linear-gradient(135deg, #cffafe 0%, #67e8f9 45%, #93c5fd 100%); padding: 14px; border-radius: 22px; }
.survey-theme-aqua .card { background: linear-gradient(180deg, #fff, #ecfeff); border-left: 6px solid #0891b2 !important; }

.survey-theme-neonlime { background: linear-gradient(135deg, #ecfccb 0%, #bef264 45%, #fde047 100%); padding: 14px; border-radius: 22px; }
.survey-theme-neonlime .card { background: linear-gradient(180deg, #fff, #f7fee7); border-top: 5px solid #65a30d; }

.preview-toolbar {
    position: sticky;
    top: 10px;
    z-index: 10;
}

.preview-shell {
    max-width: 1000px;
    margin: 0 auto;
}

.preview-header {
    border: 1px solid rgba(148, 163, 184, 0.28);
    overflow: hidden;
}

.preview-kicker {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
    color: #475569;
    font-weight: 700;
}

.preview-meta {
    min-width: 130px;
}

.meta-pill {
    background: #e2e8f0;
    color: #0f172a;
    border-radius: 999px;
    font-size: 12px;
    padding: 6px 10px;
    margin-bottom: 8px;
    font-weight: 700;
}

.preview-stats .stat-chip {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 12px;
    padding: 10px 12px;
}

.preview-stats .stat-chip span {
    display: block;
    color: #64748b;
    font-size: 12px;
}

.preview-stats .stat-chip strong {
    font-size: 22px;
    line-height: 1;
    color: #0f172a;
}

.preview-section {
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.section-index {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #0ea5e9;
    color: #fff;
    font-size: 13px;
    margin-inline-end: 8px;
}

.question-count {
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 4px 10px;
}

.preview-question {
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.72);
}

.options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ── Preview: option list (radio/checkbox) ──────────────────────── */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 2px;
}

.option-row input[type="radio"],
.option-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

/* ── Preview: Likert scale row ──────────────────────────────────── */
.likert-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.likert-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    gap: 4px;
    flex: 1 1 80px;
    min-width: 72px;
    text-align: center;
}

.likert-cell input[type="radio"] {
    display: none;
}

.likert-circle {
    display: inline-flex;
    width: 26px;
    height: 26px;
    border: 2px solid #94a3b8;
    border-radius: 50%;
    transition: border-color .15s, background .15s;
    flex-shrink: 0;
}

.likert-cell input[type="radio"]:checked + .likert-circle {
    border-color: var(--primary);
    background: var(--primary);
}

.likert-label {
    font-size: 0.75rem;
    color: #475569;
    line-height: 1.2;
}

/* ── Preview: rating strip ──────────────────────────────────────── */
.rating-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rating-cell {
    cursor: pointer;
}

.rating-cell input[type="radio"] {
    display: none;
}

.rating-circle {
    display: inline-flex;
    width: 36px;
    height: 36px;
    border: 2px solid #94a3b8;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    transition: border-color .15s, background .15s, color .15s;
}

.rating-cell input[type="radio"]:checked + .rating-circle {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.text-answer-line {
    border-bottom: 2px solid #cbd5e1;
    color: #64748b;
    height: 30px;
    padding-top: 6px;
}

@media print {
    .no-print,
    .app-nav,
    .btn { display: none !important; }

    body.app-shell {
        background: #fff !important;
        font-size: 12pt;
    }

    .preview-toolbar {
        position: static;
    }

    .preview-shell {
        max-width: 100%;
        padding: 0;
    }

    .preview-header {
        border: 0 !important;
    }

    .print-area .card {
        box-shadow: none !important;
        border: 1px solid #d1d5db !important;
        break-inside: avoid;
        page-break-inside: avoid;
        border-radius: 10px !important;
    }

    .preview-question {
        border-color: #d1d5db;
        background: #fff;
    }

    /* Print: show all input controls */
    .option-row input[type="radio"],
    .option-row input[type="checkbox"] {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .likert-circle, .rating-circle {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border: 2px solid #000;
    }

    .likert-cell input[type="radio"]:checked + .likert-circle,
    .rating-cell input[type="radio"]:checked + .rating-circle {
        background: #000 !important;
    }
}

@media (max-width: 768px) {
    .container-fluid { padding-left: 12px; padding-right: 12px; }
}
