/* Minab 168 Quiz Style Sheet */

/* Reset & Variables */
:root {
    --bg-dark: #070b14;
    --card-bg: rgba(13, 20, 38, 0.65);
    --border-color: rgba(255, 255, 255, 0.07);
    --border-focus: rgba(30, 206, 137, 0.5);
    
    /* Palettes */
    --primary: #12b77c; /* Emerald for hope and peace */
    --primary-glow: rgba(18, 183, 124, 0.3);
    --primary-hover: #0fa16b;
    --secondary: rgba(255, 255, 255, 0.08);
    --secondary-hover: rgba(255, 255, 255, 0.15);
    
    --accent-amber: #f59e0b; /* Amber for memory & candle */
    --accent-amber-glow: rgba(245, 158, 11, 0.3);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-inverse: #0b0f19;
    
    --danger: #ef4444;
    
    /* Fonts */
    --font-sans: 'Outfit', sans-serif;
    --font-serif: 'Cinzel', serif;
    
    /* Transitions */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Glassmorphism Background Container */
.glass-bg-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 1rem;
    z-index: 1;
}

/* Floating Ambient Glow Spheres */
.glow-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.45;
}

.sphere-1 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    top: -50px;
    left: -50px;
    animation: pulse-glow 8s infinite alternate ease-in-out;
}

.sphere-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
    bottom: -100px;
    right: -100px;
    animation: pulse-glow 12s infinite alternate-reverse ease-in-out;
}

@keyframes pulse-glow {
    0% { transform: scale(1) translate(0, 0); opacity: 0.35; }
    100% { transform: scale(1.15) translate(30px, -20px); opacity: 0.55; }
}

/* App Main Card Container */
.app-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    max-width: 620px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
    transition: var(--transition-smooth);
}

/* Quiz Steps Manager */
.quiz-step {
    display: none;
    padding: 2.5rem;
}

.quiz-step.active {
    display: block;
    animation: slide-fade-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slide-fade-in {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header & Banner Styles (Step 0) */
.memorial-banner-wrapper {
    position: relative;
    width: calc(100% + 5rem);
    height: 220px;
    margin: -2.5rem -2.5rem 2rem -2.5rem;
    overflow: hidden;
    flex-shrink: 0;
}

.memorial-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    filter: brightness(0.85) contrast(1.05);
}

.banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(7, 11, 20, 0) 30%, var(--bg-dark) 100%);
}

.memorial-tribute-header {
    text-align: center;
    margin-bottom: 2rem;
}

.memorial-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--accent-amber);
    padding: 0.35rem 0.85rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.icon-sparkle {
    width: 14px;
    height: 14px;
    animation: flash 2s infinite alternate;
}

@keyframes flash {
    0% { opacity: 0.4; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1.1); }
}

.memorial-tribute-header h1 {
    font-family: var(--font-serif);
    font-size: 2.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
    margin-bottom: 0.25rem;
}

.memorial-tribute-header h2 {
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 1rem;
}

.tribute-dedication {
    font-size: 0.925rem;
    line-height: 1.6;
    color: var(--text-muted);
    max-width: 480px;
    margin: 0 auto;
}

/* Info Cards (Step 0) */
.intro-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.intro-info-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    transition: var(--transition-smooth);
}

.intro-info-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.09);
    transform: translateY(-2px);
}

.intro-info-card i {
    width: 32px;
    height: 32px;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.intro-info-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: #ffffff;
}

.intro-info-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition-smooth);
    width: auto;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-inverse);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: transparent;
}

.btn-block {
    width: 100%;
}

/* Back Button & Progress */
.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.btn-back {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.btn-back:hover {
    background: var(--secondary);
    color: #ffffff;
}

.progress-indicator {
    font-size: 0.85rem;
    font-weight: 550;
    color: var(--primary);
    background: var(--primary-glow);
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
}

/* Forms */
.section-title {
    margin-bottom: 1.75rem;
}

.section-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.35rem;
}

.section-title p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-group label i {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

.form-group label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-group label .sub-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 4px;
}

.form-group input, 
.form-group select {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-fast);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.form-group select option {
    background-color: #0f1626;
    color: #ffffff;
}

.form-group input:focus, 
.form-group select:focus {
    border-color: var(--border-focus);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 10px rgba(30, 206, 137, 0.15);
}

/* Error States */
.form-group.has-error input,
.form-group.has-error select {
    border-color: var(--danger);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

.error-msg {
    display: none;
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 0.35rem;
    animation: shake 0.3s;
}

.form-group.has-error .error-msg {
    display: block;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Quiz Interface (Step 2) */
.quiz-progress-bar-container {
    width: calc(100% + 5rem);
    margin: -2.5rem -2.5rem 2rem -2.5rem;
    background: rgba(255, 255, 255, 0.03);
    height: 6px;
    position: relative;
    overflow: hidden;
}

.quiz-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #3b82f6 100%);
    box-shadow: 0 0 10px rgba(18, 183, 124, 0.5);
    transition: width 0.3s ease-out;
}

.quiz-counter {
    font-size: 0.85rem;
    font-weight: 550;
    color: var(--text-muted);
}

.quiz-card-slider {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 2rem;
}

.quiz-question-container {
    opacity: 1;
}

.animate-fade {
    animation: fade-switch 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fade-switch {
    0% { opacity: 0; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1); }
}

.question-point {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.question-text {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.5;
    color: #ffffff;
    margin-bottom: 1.75rem;
}

.quiz-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
}

.option-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    transition: var(--transition-smooth);
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.option-circle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    margin-right: 0.85rem;
    position: relative;
    transition: var(--transition-fast);
}

.option-btn.selected {
    background: var(--primary-glow);
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(18, 183, 124, 0.1);
}

.option-btn.selected .option-circle {
    border-color: var(--primary);
}

.option-btn.selected .option-circle::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: var(--primary);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.quiz-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.quiz-navigation .btn {
    flex: 1;
}

/* Loading/Submitting State (Step 3) */
.loader-content {
    text-align: center;
    padding: 3rem 0;
}

.spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(18, 183, 124, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner-icon {
    width: 28px;
    height: 28px;
    color: var(--primary);
    animation: pulse 1.5s infinite alternate ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.7; }
    100% { transform: scale(1.15); opacity: 1; }
}

.loader-content h2 {
    font-size: 1.5rem;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.loader-content p {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 320px;
    margin: 0 auto;
}

/* Results Screen (Step 4) */
.result-success-checkmark {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.checkmark-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(18, 183, 124, 0.1);
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    animation: pop-check 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.checkmark-circle i {
    width: 36px;
    height: 36px;
}

@keyframes pop-check {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.result-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.result-score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(18, 183, 124, 0.15) 0%, transparent 80%);
    border: 3px double var(--primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    box-shadow: 0 0 25px rgba(18, 183, 124, 0.1);
}

.score-num {
    font-size: 3rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
}

.score-den {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: -0.25rem;
}

.score-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    margin-top: 0.35rem;
    font-weight: 700;
}

.result-details h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.25rem;
}

.school-std {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.result-dedication-box {
    background: rgba(245, 158, 11, 0.03);
    border: 1px solid rgba(245, 158, 11, 0.1);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
    text-align: left;
    align-items: flex-start;
}

.icon-candle {
    width: 20px;
    height: 20px;
    color: var(--accent-amber);
    flex-shrink: 0;
    margin-top: 2px;
    animation: flash 1.5s infinite alternate ease-in-out;
}

.result-dedication-box p {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.result-dedication-box p strong {
    color: #ffffff;
}

.result-actions .btn {
    box-shadow: none;
}

/* =============================================
   Custom Toast Notification
   ============================================= */
.app-toast {
    position: fixed;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem 0.85rem 1.1rem;
    min-width: 280px;
    max-width: calc(100vw - 2rem);
    border-radius: 14px;
    background: rgba(13, 20, 38, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
    opacity: 0;
}

.app-toast--visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Warning (amber) */
.app-toast--warning {
    border-color: rgba(245, 158, 11, 0.35);
}
.app-toast--warning .toast-icon {
    color: var(--accent-amber);
}

/* Error (red) */
.app-toast--error {
    border-color: rgba(239, 68, 68, 0.35);
}
.app-toast--error .toast-icon {
    color: var(--danger);
}

/* Success (emerald) */
.app-toast--success {
    border-color: rgba(18, 183, 124, 0.35);
}
.app-toast--success .toast-icon {
    color: var(--primary);
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-msg {
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-main);
    line-height: 1.4;
    flex: 1;
}

.toast-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem;
    border-radius: 6px;
    transition: var(--transition-fast);
    flex-shrink: 0;
    margin-left: 0.25rem;
}

.toast-close:hover {
    background: var(--secondary);
    color: #ffffff;
}

.toast-close i {
    width: 14px;
    height: 14px;
}

/* Confetti Canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 999;
}

/* Responsive Styles */
@media (max-width: 640px) {
    body {
        align-items: flex-start;
    }

    .glass-bg-container {
        padding: 0;
        align-items: stretch;
    }
    
    .app-card {
        border-radius: 0;
        min-height: 100vh;
        width: 100%;
        max-width: 100%;
        box-shadow: none;
        /* Make the card a column so steps can flex-fill */
        display: flex;
        flex-direction: column;
    }
    
    /* Active step stretches to fill all remaining card height */
    .quiz-step.active {
        display: flex;
        flex-direction: column;
        flex: 1;
    }
    
    .quiz-step {
        padding: 1.25rem 1rem;
    }
    
    /* Fix banner image: full bleed, proper height */
    .memorial-banner-wrapper {
        margin: -1.25rem -1rem 1.5rem -1rem;
        width: calc(100% + 2rem);
        height: 200px;
    }

    .memorial-banner {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center top;
    }
    
    .memorial-tribute-header {
        margin-bottom: 1.25rem;
    }

    .memorial-tribute-header h1 {
        font-size: 1.85rem;
    }
    
    .memorial-tribute-header h2 {
        font-size: 0.95rem;
    }
    
    .tribute-dedication {
        font-size: 0.82rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .intro-card-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
        margin-bottom: 1.25rem;
    }

    .intro-info-card {
        padding: 1rem 0.75rem;
    }

    .intro-info-card p {
        font-size: 0.75rem;
    }

    .btn {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Quiz progress bar – matches step padding */
    .quiz-progress-bar-container {
        margin: -1.25rem -1rem 1.5rem -1rem;
        width: calc(100% + 2rem);
    }

    .question-text {
        font-size: 1.05rem;
        margin-bottom: 1.25rem;
        line-height: 1.55;
    }

    /* Quiz slider grows to fill available height; nav sticks to bottom */
    .quiz-card-slider {
        flex: 1;
        min-height: 0;
        margin-bottom: 1.25rem;
    }

    .quiz-navigation {
        margin-top: auto;
    }

    .option-btn {
        padding: 0.85rem 1rem;
        font-size: 0.92rem;
    }

    .quiz-navigation {
        gap: 0.5rem;
    }
    
    .quiz-navigation .btn {
        padding: 0.8rem 0.5rem;
        font-size: 0.88rem;
    }

    .result-score-circle {
        width: 110px;
        height: 110px;
    }

    .score-num {
        font-size: 2.25rem;
    }

    .result-details h3 {
        font-size: 1.2rem;
    }
    
    .result-card {
        padding: 1.5rem 1rem;
    }

    .result-dedication-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.5rem;
    }
}
