/* Survey Take - Slide PowerPoint Style */

/* ============ CSS VARIABLES ============ */
:root {
    /* Theme */
    --theme: #6366f1;
    --theme-rgb: 99, 102, 241;
    --banner-url: none;
    --theme-overlay-top: 0.3;
    --theme-overlay-bottom: 0.45;
    --font-family: 'Roboto', 'Segoe UI', sans-serif;
    --danger: #ef4444;
    --success: #22c55e;
    --radius-lg: 20px;
    --radius-md: 12px;

    /* Light mode (default - no theme) */
    --survey-text: #1e293b;
    --survey-heading: #0f172a;
    --survey-text-secondary: #64748b;
    --survey-q-content: #1e293b;
    --survey-opt-text: rgba(var(--theme-rgb), 0.85);
    --survey-opt-text-selected: rgba(var(--theme-rgb), 1);
    --survey-opt-row-bg: #fff;
    --survey-opt-row-border: #e2e8f0;
    --survey-opt-hover-bg: rgba(var(--theme-rgb), 0.04);
    --survey-opt-hover-border: rgba(var(--theme-rgb), 0.35);
    --survey-opt-selected-bg: rgba(var(--theme-rgb), 0.08);
    --survey-opt-selected-border: var(--theme);
    --survey-opt-icon-border: #cbd5e1;
    --survey-q-badge-bg: rgba(var(--theme-rgb), 0.1);
    --survey-q-badge-color: var(--theme);
    --survey-q-badge-border: rgba(var(--theme-rgb), 0.2);
    --survey-input-bg: #fff;
    --survey-input-border: #e2e8f0;
    --survey-input-focus-border: var(--theme);
    --survey-other-border: #9ca3af;
    --survey-other-focus-border: var(--theme);
    --survey-nav-arrow-bg: #fff;
    --survey-nav-arrow-border: #e2e8f0;
    --survey-nav-arrow-color: #64748b;
    --survey-nav-arrow-hover-bg: rgba(var(--theme-rgb), 0.08);
    --survey-nav-arrow-hover-border: var(--theme);
    --survey-nav-arrow-hover-color: var(--theme);
    --survey-dot-bg: #e2e8f0;
    --survey-dot-border: #cbd5e1;
    --survey-dot-active-bg: var(--theme);
    --survey-dot-active-border: var(--theme);
    --survey-dot-hover-bg: rgba(var(--theme-rgb), 0.3);
    --survey-dot-answered-bg: rgba(var(--theme-rgb), 0.4);
    --survey-dot-answered-border: var(--theme);
    --survey-btn-outline-color: #64748b;
    --survey-btn-outline-border: #e2e8f0;
    --survey-btn-outline-hover-bg: rgba(var(--theme-rgb), 0.04);
    --survey-btn-outline-hover-border: #cbd5e1;
    --survey-btn-outline-hover-color: #1e293b;
    --survey-required-bg: rgba(239,68,68,.08);
    --survey-required-border: rgba(239,68,68,.15);
    --survey-required-color: #dc2626;
    --survey-error-border: rgba(239,68,68,.3);
    --survey-grid-display: none;
    --survey-orbs-display: none;
    --survey-review-icon-bg: rgba(34,197,94,.08);
    --survey-review-icon-border: rgba(34,197,94,.2);
    --survey-review-icon-color: #16a34a;
    --survey-success-icon-bg: rgba(34,197,94,.08);
    --survey-success-icon-border: rgba(34,197,94,.25);
    --survey-success-icon-color: #16a34a;
}

/* Dark mode (has theme background) */
body.survey-page.survey-has-theme {
    --survey-text: #e2e8f0;
    --survey-heading: #f1f5f9;
    --survey-text-secondary: #94a3b8;
    --survey-q-content: #fff;
    --survey-opt-row-bg: rgba(255,255,255,.02);
    --survey-opt-row-border: rgba(255,255,255,.06);
    --survey-opt-hover-bg: rgba(var(--theme-rgb), .06);
    --survey-opt-selected-bg: rgba(var(--theme-rgb), .1);
    --survey-opt-icon-border: rgba(255,255,255,.2);
    --survey-q-badge-bg: rgba(var(--theme-rgb), .15);
    --survey-q-badge-color: rgba(var(--theme-rgb), 0.7);
    --survey-q-badge-border: rgba(var(--theme-rgb), .25);
    --survey-input-bg: rgba(255,255,255,.02);
    --survey-input-border: rgba(255,255,255,.06);
    --survey-other-border: rgba(255,255,255,.2);
    --survey-nav-arrow-bg: rgba(255,255,255,.04);
    --survey-nav-arrow-border: rgba(255,255,255,.1);
    --survey-nav-arrow-color: #94a3b8;
    --survey-nav-arrow-hover-bg: rgba(var(--theme-rgb), .15);
    --survey-nav-arrow-hover-color: rgba(var(--theme-rgb), 0.8);
    --survey-dot-bg: rgba(255,255,255,.1);
    --survey-dot-border: rgba(255,255,255,.08);
    --survey-dot-answered-bg: rgba(var(--theme-rgb), .4);
    --survey-btn-outline-color: #94a3b8;
    --survey-btn-outline-border: rgba(255,255,255,.15);
    --survey-btn-outline-hover-bg: rgba(255,255,255,.04);
    --survey-btn-outline-hover-border: rgba(255,255,255,.3);
    --survey-btn-outline-hover-color: #e2e8f0;
    --survey-required-bg: rgba(239,68,68,.12);
    --survey-required-border: rgba(239,68,68,.2);
    --survey-required-color: #fca5a5;
    --survey-grid-display: block;
    --survey-orbs-display: block;
    --survey-review-icon-bg: rgba(34,197,94,.12);
    --survey-review-icon-color: #4ade80;
    --survey-review-stat-bg: rgba(255,255,255,.04);
    --survey-review-stat-border: rgba(255,255,255,.08);
    --survey-review-stat-answered: #4ade80;
    --survey-review-stat-unanswered: #fca5a5;
    --survey-success-icon-bg: rgba(34,197,94,.15);
    --survey-success-icon-border: rgba(34,197,94,.25);
    --survey-success-icon-color: #4ade80;
}

/* ============ RESET ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ============ BODY ============ */
body.survey-page {
    font-family: var(--font-family);
    background:
        linear-gradient(180deg, rgba(var(--brightness-color,0,0,0), var(--theme-overlay-top)) 0%, rgba(var(--brightness-color,0,0,0), var(--theme-overlay-bottom)) 100%),
        var(--banner-url, none) center/cover no-repeat,
        var(--survey-text); /* fallback bg */
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
    color: var(--survey-text);
}

body.survey-page:not(.survey-has-theme) {
    background: #fff;
}

body.survey-page.survey-has-theme {
    background:
        linear-gradient(180deg, rgba(var(--brightness-color,0,0,0), var(--theme-overlay-top)) 0%, rgba(var(--brightness-color,0,0,0), var(--theme-overlay-bottom)) 100%),
        var(--banner-url, none) center/cover no-repeat,
        linear-gradient(160deg, #1e293b 0%, #0f172a 60%, #0c1222 100%);
}

/* Grid overlay */
body.survey-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.015) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
    display: var(--survey-grid-display);
}

/* ============ ORBS ============ */
.survey-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.12;
    pointer-events: none;
    z-index: 0;
    display: var(--survey-orbs-display);
}
.survey-orb-1 { width: 400px; height: 400px; background: var(--theme); top: -100px; left: -100px; }
.survey-orb-2 { width: 300px; height: 300px; background: var(--theme); bottom: -80px; right: -80px; }
.survey-orb-3 { width: 200px; height: 200px; background: #06b6d4; top: 50%; right: 10%; }

/* ============ CONTAINER ============ */
.survey-slide-wrap {
    width: 100%;
    max-width: 720px;
    min-height: 560px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

.survey-slide-viewport {
    position: relative;
    width: 100%;
    min-height: 520px;
    overflow: hidden;
    flex: 1;
}

/* ============ SLIDES ============ */
.survey-slide {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    opacity: 0;
    pointer-events: none;
}
.survey-slide.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

/* ============ WELCOME ============ */
.survey-welcome-logo {
    max-width: 160px;
    max-height: 80px;
    object-fit: contain;
    z-index: 1;
}
.survey-welcome-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--survey-heading);
    text-align: center;
    line-height: 1.25;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}
.survey-welcome-desc {
    font-size: 16px;
    color: var(--survey-text-secondary);
    text-align: center;
    line-height: 1.6;
    max-width: 480px;
}
.survey-btn-start {
    margin-top: 36px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 40px;
    border-radius: 999px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    background: var(--theme);
    color: #fff;
    box-shadow: 0 4px 24px rgba(var(--theme-rgb), 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
}
.survey-btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(var(--theme-rgb), 0.35);
    filter: brightness(1.05);
}
.survey-btn-start:active { transform: scale(0.97); }

/* ============ QUESTION SLIDE ============ */
.survey-q-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.survey-q-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 14px;
    background: var(--survey-q-badge-bg);
    color: var(--survey-q-badge-color);
    font-weight: 700;
    font-size: 15px;
    border: 1px solid var(--survey-q-badge-border);
}
.survey-q-required {
    font-size: 12px;
    font-weight: 600;
    color: var(--survey-required-color);
    background: var(--survey-required-bg);
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--survey-required-border);
}
.survey-q-content {
    width: 100%;
    font-size: 19px;
    font-weight: bold;
    color: var(--survey-q-content);
    line-height: 1.5;
    margin-bottom: 28px;
    text-align: left;
}

/* ============ OPTIONS ============ */
.survey-q-options {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.survey-opt-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 2px solid var(--survey-opt-row-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.18s;
    background: var(--survey-opt-row-bg);
}
.survey-opt-row:hover { border-color: var(--survey-opt-hover-border); background: var(--survey-opt-hover-bg); }
.survey-opt-row.selected { border-color: var(--survey-opt-selected-border); background: var(--survey-opt-selected-bg); }
.survey-opt-row.disabled { cursor: default; pointer-events: none; }

.survey-opt-icon {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid var(--survey-opt-icon-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
}
.survey-opt-row.selected .survey-opt-icon.radio { border-color: var(--theme); }
.survey-opt-row.selected .survey-opt-icon.radio::after {
    content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--theme);
}
.survey-opt-icon.checkbox { border-radius: 6px; }
.survey-opt-row.selected .survey-opt-icon.checkbox { border-color: var(--theme); background: var(--theme); }
.survey-opt-row.selected .survey-opt-icon.checkbox::after {
    content: ''; width: 12px; height: 6px;
    border-left: 2px solid #fff; border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px);
}
.survey-opt-label { font-size: 15px; color: var(--survey-opt-text); flex: 0 0 auto; line-height: 1.4; font-weight: bold; }
.survey-opt-row.selected .survey-opt-label { color: var(--survey-opt-text-selected); }

/* ============ OTHER INLINE ============ */
.survey-other-inline-wrap {
    flex: 1;
    display: flex; align-items: center;
    min-width: 0;
}
.survey-other-inline {
    flex: 1;
    min-width: 0;
    border: none;
    border-bottom: 1.5px dotted var(--survey-other-border);
    padding: 4px 0;
    font-size: 15px;
    font-family: var(--font-family);
    color: var(--survey-text);
    outline: none;
    background: transparent;
    transition: border-color 0.2s;
    margin-left: 2px;
}
.survey-other-inline:focus { border-bottom-color: var(--survey-other-focus-border); }
.survey-other-inline::placeholder { color: var(--survey-text-secondary); font-style: italic; }

/* ============ TEXT ANSWER ============ */
.survey-text-answer {
    width: 100%;
    min-height: 140px;
    border: 2px solid var(--survey-input-border);
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: 15px;
    font-family: var(--font-family);
    color: var(--survey-text);
    background: var(--survey-input-bg);
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.6;
}
.survey-text-answer:focus { border-color: var(--survey-input-focus-border); }
.survey-text-answer::placeholder { color: var(--survey-text-secondary); }

/* ============ ERROR ============ */
.survey-q-error {
    display: none;
    width: 100%;
    color: var(--danger);
    font-size: 13px;
    font-weight: 500;
    margin-top: 16px;
    align-items: center;
    gap: 6px;
}
.survey-q-error.show { display: flex; }
.survey-slide.has-error .survey-q-options .survey-opt-row { border-color: var(--survey-error-border); }

/* ============ REVIEW SLIDE ============ */
.survey-review-icon {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(34,197,94,.12), rgba(34,197,94,.05));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: 28px;
    color: #22c55e;
}
.survey-review-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--survey-heading);
    margin-bottom: 6px;
}
.survey-review-desc {
    font-size: 14px;
    color: var(--survey-text-secondary);
    line-height: 1.6;
    text-align: center;
    max-width: 400px;
}
.survey-review-stats {
    display: flex;
    gap: 16px;
    margin: 32px 0;
}
.survey-review-stat {
    text-align: center;
    background: rgba(var(--theme-rgb), .04);
    border: 1px solid rgba(var(--theme-rgb), .08);
    border-radius: 16px;
    padding: 18px 32px;
    min-width: 130px;
}
.survey-review-stat-num {
    font-size: 34px;
    font-weight: 800;
    line-height: 1.2;
}
.survey-review-stat-num.answered { color: #22c55e; }
.survey-review-stat-num.unanswered { color: #f87171; }
.survey-review-stat-lbl {
    font-size: 11px;
    color: var(--survey-text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-top: 4px;
    font-weight: 600;
}
.survey-review-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}
}

/* ============ SUCCESS SLIDE ============ */
.survey-success-icon {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--survey-success-icon-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: var(--survey-success-icon-color);
    margin-bottom: 20px;
    border: 2px solid var(--survey-success-icon-border);
}
.survey-success-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--survey-heading);
    margin-bottom: 8px;
}
.survey-success-desc {
    font-size: 15px;
    color: var(--survey-text-secondary);
    line-height: 1.6;
    text-align: center;
}

/* ============ BOTTOM BAR ============ */
.survey-bottom-bar {
    position: relative;
    z-index: 2;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
}
.survey-bottom-bar.hidden { display: none; }

.survey-nav-arrow {
    width: 48px; height: 48px;
    border-radius: 50%;
    border: 1px solid var(--survey-nav-arrow-border);
    background: var(--survey-nav-arrow-bg);
    backdrop-filter: blur(10px);
    color: var(--survey-nav-arrow-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 20px;
    font-family: var(--font-family);
}
.survey-nav-arrow svg { width: 22px; height: 22px; }
.survey-nav-arrow:hover:not(:disabled) {
    background: var(--survey-nav-arrow-hover-bg);
    border-color: var(--survey-nav-arrow-hover-border);
    color: var(--survey-nav-arrow-hover-color);
}
.survey-nav-arrow:disabled { opacity: 0.2; cursor: not-allowed; }

/* --- Nav Text Mode --- */
.survey-bottom-bar.nav-text .survey-nav-arrow {
    width: auto; height: auto;
    border: none;
    background: transparent;
    padding: 10px 18px;
    font-size: 14px; font-weight: 500;
    gap: 6px;
    color: var(--survey-nav-arrow-color);
    backdrop-filter: none;
}
.survey-bottom-bar.nav-text .survey-nav-arrow:hover:not(:disabled) {
    background: transparent;
    color: var(--survey-nav-arrow-hover-color);
}
.survey-bottom-bar.nav-text .survey-nav-arrow:disabled {
    opacity: 0.3;
    color: var(--survey-nav-arrow-color);
}
.survey-bottom-bar.nav-text .survey-nav-arrow svg { width: 16px; height: 16px; }

/* --- Nav Pills Mode --- */
.survey-bottom-bar.nav-pills .survey-nav-arrow {
    width: auto; height: auto;
    border-radius: 999px;
    padding: 14px 28px;
    font-size: 14px; font-weight: 600;
    border: none;
    background: var(--theme); color: #fff;
    box-shadow: 0 4px 14px rgba(var(--theme-rgb),.25);
    gap: 8px;
}
.survey-bottom-bar.nav-pills .survey-nav-arrow:hover:not(:disabled) {
    filter: brightness(1.1);
    background: var(--theme); color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(var(--theme-rgb),.35);
}
.survey-bottom-bar.nav-pills .survey-nav-arrow:disabled {
    opacity: 0.3;
    background: rgba(var(--theme-rgb),.3); color: rgba(255,255,255,.5);
}
.survey-bottom-bar.nav-pills .survey-nav-arrow svg { width: 16px; height: 16px; }
.survey-bottom-bar.nav-pills #btnPrev {
    background: var(--survey-nav-arrow-bg);
    color: var(--survey-nav-arrow-color);
    border: 1px solid var(--survey-nav-arrow-border);
    box-shadow: none;
}
.survey-bottom-bar.nav-pills #btnPrev:hover:not(:disabled) {
    background: var(--survey-nav-arrow-hover-bg);
    color: var(--survey-nav-arrow-hover-color);
    border-color: var(--survey-nav-arrow-hover-border);
    filter: none; transform: none;
    box-shadow: none;
}
.survey-bottom-bar.nav-pills #btnPrev:disabled {
    opacity: 0.2;
    background: var(--survey-nav-arrow-bg);
    color: var(--survey-nav-arrow-color);
}

.survey-nav-dots {
    display: none;
    align-items: center;
    gap: 8px;
}
.survey-nav-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--survey-dot-bg);
    border: 1px solid var(--survey-dot-border);
    cursor: pointer;
    transition: all 0.25s;
}
.survey-nav-dot:hover { background: var(--survey-dot-hover-bg); }
.survey-nav-dot.answered { background: var(--survey-dot-answered-bg); border-color: var(--survey-dot-answered-border); }
.survey-nav-dot.active {
    background: var(--survey-dot-active-bg);
    border-color: var(--survey-dot-active-border);
    box-shadow: 0 0 0 4px rgba(var(--theme-rgb),.25);
    transform: scale(1.25);
}
.survey-nav-dot.welcome-dot { border-radius: 4px; width: 10px; }

.survey-btn-submit {
    padding: 14px 36px;
    border-radius: 999px;
    border: none;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-family);
    cursor: pointer;
    background: linear-gradient(135deg, var(--success), #16a34a);
    color: #fff;
    box-shadow: 0 4px 20px rgba(34,197,94,.3);
    transition: all 0.25s;
    letter-spacing: 0.3px;
}
.survey-btn-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(34,197,94,.4); filter: brightness(1.08); }
.survey-btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.survey-btn-outline {
    padding: 14px 28px;
    border-radius: 999px;
    border: 1px solid var(--survey-btn-outline-border);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    background: transparent;
    color: var(--survey-btn-outline-color);
    transition: all 0.2s;
}
.survey-btn-outline:hover {
    border-color: var(--survey-btn-outline-hover-border);
    color: var(--survey-btn-outline-hover-color);
    background: var(--survey-btn-outline-hover-bg);
}

/* ============ BACK LINK (below start button) ============ */
.survey-back-link {
    display: block;
    margin-top: 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 400;
    font-family: var(--font-family);
    text-decoration: none;
    color: var(--survey-btn-outline-color);
    opacity: 0.5;
    transition: opacity 0.2s;
}

.survey-back-link:hover {
    opacity: 0.8;
}
.survey-loader-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    color: var(--survey-text-secondary);
    font-size: 15px;
}
.survey-error-card {
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(239,68,68,.2);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
}
.survey-error-card h1 { font-size: 22px; color: #fca5a5; margin-bottom: 12px; }
.survey-error-card p { color: var(--survey-text-secondary); line-height: 1.6; margin-bottom: 20px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 600px) {
    .survey-slide { padding: 32px 24px; }
    .survey-welcome-title { font-size: 26px; }
    .survey-q-content { font-size: 17px; }
    .survey-opt-row { padding: 12px 14px; flex-wrap: wrap; }
    .survey-other-inline-wrap { width: 100%; margin-left: 36px; margin-top: 4px; }
    .survey-nav-arrow { width: 40px; height: 40px; }
    .survey-nav-arrow svg { width: 20px; height: 20px; }
    .survey-btn-start { padding: 14px 32px; }
    .survey-review-stats { gap: 20px; }
    .survey-welcome-logo { max-width: 120px; max-height: 60px; }
}
