// Quiz Frontend Styles

.simpleform-quiz-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;

    .quiz-wrapper {
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        overflow: hidden;
    }

    .quiz-header {
        padding: 30px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        text-align: center;

        .quiz-title {
            margin: 0 0 10px 0;
            font-size: 28px;
            font-weight: 700;
        }

        .quiz-description {
            margin: 0;
            font-size: 16px;
            opacity: 0.9;
        }
    }

    .quiz-content {
        padding: 30px;
    }

    .quiz-question {
        margin-bottom: 40px;

        &:last-child {
            margin-bottom: 0;
        }

        .question-header {
            margin-bottom: 20px;

            .question-number {
                display: inline-block;
                padding: 4px 12px;
                background: #f3f4f6;
                border-radius: 20px;
                font-size: 12px;
                font-weight: 600;
                color: #6b7280;
                margin-bottom: 12px;
            }

            .question-text {
                margin: 0 0 10px 0;
                font-size: 20px;
                font-weight: 600;
                color: #1f2937;
            }

            .question-description {
                margin: 0 0 15px 0;
                font-size: 14px;
                color: #6b7280;
            }

            .question-image {
                width: 100%;
                max-width: 500px;
                height: auto;
                border-radius: 8px;
                margin-top: 15px;
            }
        }

        .question-answers {
            display: flex;
            flex-direction: column;
            gap: 12px;

            .answer-option {
                display: flex;
                align-items: center;
                padding: 16px;
                border: 2px solid #e5e7eb;
                border-radius: 8px;
                cursor: pointer;
                transition: all 0.2s;

                &:hover {
                    border-color: #667eea;
                    background: #f9fafb;
                }

                input[type="radio"] {
                    margin-right: 12px;
                    width: 20px;
                    height: 20px;
                    cursor: pointer;
                }

                .answer-content {
                    display: flex;
                    align-items: center;
                    gap: 12px;
                    flex: 1;

                    .answer-image {
                        width: 60px;
                        height: 60px;
                        object-fit: cover;
                        border-radius: 6px;
                    }

                    .answer-text {
                        font-size: 16px;
                        color: #374151;
                    }
                }

                input[type="radio"]:checked~.answer-content {
                    font-weight: 600;
                    color: #667eea;
                }
            }
        }
    }

    .quiz-footer {
        padding: 20px 30px;
        background: #f9fafb;
        border-top: 1px solid #e5e7eb;
        text-align: center;

        .quiz-submit-btn {
            padding: 14px 40px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;

            &:hover {
                transform: translateY(-2px);
                box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
            }

            &:active {
                transform: translateY(0);
            }
        }
    }

    .quiz-results {
        padding: 30px;

        .quiz-results-content {
            text-align: center;

            &.passed {
                h3 {
                    color: #10b981;
                }
            }

            &.failed {
                h3 {
                    color: #ef4444;
                }
            }

            h3 {
                margin: 0 0 20px 0;
                font-size: 32px;
            }

            .score-text {
                font-size: 24px;
                font-weight: 600;
                color: #1f2937;
                margin: 0 0 10px 0;
            }

            .passing-score {
                font-size: 14px;
                color: #6b7280;
                margin: 0 0 30px 0;
            }

            .quiz-reward {
                padding: 20px;
                background: #fef3c7;
                border: 2px solid #fbbf24;
                border-radius: 8px;
                margin: 20px 0;

                h4 {
                    margin: 0 0 10px 0;
                    color: #92400e;
                }

                .reward-coupon {
                    font-size: 18px;
                    color: #92400e;

                    strong {
                        font-size: 24px;
                        color: #78350f;
                    }
                }

                .reward-link {
                    display: inline-block;
                    padding: 10px 24px;
                    background: #fbbf24;
                    color: #78350f;
                    text-decoration: none;
                    border-radius: 6px;
                    font-weight: 600;
                    margin-top: 10px;
                    transition: all 0.2s;

                    &:hover {
                        background: #f59e0b;
                    }
                }
            }

            .correct-answers-section {
                margin-top: 30px;
                text-align: left;

                h4 {
                    margin: 0 0 15px 0;
                    font-size: 18px;
                    color: #1f2937;
                }

                .answer-review {
                    padding: 12px;
                    border-radius: 6px;
                    margin-bottom: 8px;

                    &.correct {
                        background: #d1fae5;
                        color: #065f46;
                    }

                    &.incorrect {
                        background: #fee2e2;
                        color: #991b1b;
                    }

                    p {
                        margin: 0;
                        font-size: 14px;
                    }
                }
            }
        }
    }

    .quiz-error {
        padding: 20px;
        background: #fee2e2;
        color: #991b1b;
        border-radius: 8px;
        text-align: center;
    }


    // Step transition animations
    .quiz-step-content {
        animation: stepSlideIn 0.3s ease-out;
    }

    @keyframes stepSlideIn {
        from {
            opacity: 0;
            transform: translateX(20px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }



    // Login Required Styles
    .quiz-login-required {
        padding: 60px 30px;
        text-align: center;
        background: linear-gradient(135deg, #fef7f0 0%, #fff2e6 100%);
        border: 2px solid #fed7aa;
        border-radius: 12px;
        margin: 20px;

        .login-required-content {
            max-width: 450px;
            margin: 0 auto;

            h3 {
                color: #ea580c;
                font-size: 28px;
                margin-bottom: 20px;
                font-weight: 700;
                text-shadow: 0 1px 2px rgba(234, 88, 12, 0.1);
            }

            p {
                color: #7c2d12;
                font-size: 18px;
                margin-bottom: 30px;
                line-height: 1.6;
                font-weight: 500;
            }

            .quiz-login-btn {
                display: inline-block;
                padding: 16px 40px;
                background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
                color: white;
                text-decoration: none;
                border-radius: 10px;
                font-weight: 700;
                font-size: 16px;
                transition: all 0.3s ease;
                box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
                text-transform: uppercase;
                letter-spacing: 0.5px;

                &:hover {
                    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
                    color: white;
                    text-decoration: none;
                    transform: translateY(-2px);
                    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
                }

                &:active {
                    transform: translateY(0);
                }
            }
        }
    }

    // Already Taken Styles
    .quiz-already-taken {
        padding: 60px 30px;
        text-align: center;
        background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
        border: 2px solid #fbbf24;
        border-radius: 12px;
        margin: 20px;

        .already-taken-content {
            max-width: 500px;
            margin: 0 auto;

            h3 {
                color: #d97706;
                font-size: 28px;
                margin-bottom: 20px;
                font-weight: 700;
                text-shadow: 0 1px 2px rgba(217, 119, 6, 0.1);
            }

            p {
                color: #92400e;
                font-size: 18px;
                margin-bottom: 30px;
                line-height: 1.6;
                font-weight: 500;
            }

            .quiz-retake-btn {
                display: inline-block;
                padding: 16px 40px;
                background: linear-gradient(135deg, #10b981 0%, #059669 100%);
                color: white;
                border: none;
                border-radius: 10px;
                font-weight: 700;
                font-size: 16px;
                cursor: pointer;
                transition: all 0.3s ease;
                box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
                text-transform: uppercase;
                letter-spacing: 0.5px;

                &:hover {
                    background: linear-gradient(135deg, #059669 0%, #047857 100%);
                    transform: translateY(-2px);
                    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
                }

                &:active {
                    transform: translateY(0);
                }
            }
        }
    }

    // Custom Modal Styles
    .custom-modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        backdrop-filter: blur(4px);

        &.visible {
            opacity: 1;
            visibility: visible;
        }

        .custom-modal {
            background: white;
            border-radius: 12px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            max-width: 400px;
            width: 90%;
            max-height: 80vh;
            overflow: hidden;
            transform: scale(0.9) translateY(20px);
            transition: all 0.3s ease;

            &.success {
                border-top: 4px solid #10b981;
            }

            &.error {
                border-top: 4px solid #ef4444;
            }

            &.info {
                border-top: 4px solid #3b82f6;
            }

            .custom-modal-header {
                padding: 20px 24px 0;

                h3 {
                    margin: 0;
                    font-size: 20px;
                    font-weight: 700;
                    color: #1f2937;
                }
            }

            .custom-modal-body {
                padding: 16px 24px 24px;
                color: #6b7280;
                font-size: 16px;
                line-height: 1.5;
            }

            .custom-modal-progress {
                height: 4px;
                background: #f3f4f6;
                overflow: hidden;

                .custom-modal-progress-indicator {
                    height: 100%;
                    width: 0%;
                    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
                    transition: width linear;
                }
            }
        }

        &.visible .custom-modal {
            transform: scale(1) translateY(0);
        }
    }

    // Enhanced Quiz Error Styles
    .quiz-error {
        padding: 30px;
        background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
        color: #991b1b;
        border: 2px solid #f87171;
        border-radius: 12px;
        text-align: center;
        font-size: 18px;
        font-weight: 600;
        margin: 20px;
        box-shadow: 0 4px 12px rgba(248, 113, 113, 0.2);
    }

    // Loading States
    .quiz-loading {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 60px 30px;
        text-align: center;

        .spinner {
            width: 40px;
            height: 40px;
            border: 4px solid #e5e7eb;
            border-top: 4px solid #667eea;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-bottom: 20px;
        }

        p {
            color: #6b7280;
            font-size: 16px;
            margin: 0;
        }
    }

    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }

    // Enhanced User Info Section
    .quiz-user-info {
        background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
        border: 2px solid #0ea5e9;
        border-radius: 12px;
        padding: 24px;
        margin-bottom: 24px;
        box-shadow: 0 2px 8px rgba(14, 165, 233, 0.1);

        h3 {
            font-size: 20px;
            color: #0c4a6e;
            margin: 0 0 20px 0;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 8px;

            &::before {
                content: "👤";
                font-size: 24px;
            }
        }

        .user-info-fields {
            display: flex;
            flex-direction: column;
            gap: 20px;

            .form-field {
                display: flex;
                flex-direction: column;
                gap: 8px;

                label {
                    font-size: 15px;
                    font-weight: 600;
                    color: #0c4a6e;
                    display: flex;
                    align-items: center;
                    gap: 4px;
                }

                input {
                    padding: 14px 16px;
                    border: 2px solid #bae6fd;
                    border-radius: 8px;
                    font-size: 16px;
                    transition: all 0.3s ease;
                    background: white;

                    &:focus {
                        outline: none;
                        border-color: #0ea5e9;
                        box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
                        transform: translateY(-1px);
                    }

                    &::placeholder {
                        color: #94a3b8;
                    }

                    &:invalid {
                        border-color: #ef4444;
                    }
                }
            }
        }

        @media (min-width: 640px) {
            .user-info-fields {
                flex-direction: row;
                gap: 20px;

                .form-field {
                    flex: 1;
                }
            }
        }
    }

    // Mobile Responsive Enhancements
    @media (max-width: 768px) {
        .quiz-login-required,
        .quiz-already-taken {
            padding: 40px 20px;
            margin: 10px;

            .login-required-content,
            .already-taken-content {
                h3 {
                    font-size: 24px;
                }

                p {
                    font-size: 16px;
                }

                .quiz-login-btn,
                .quiz-retake-btn {
                    padding: 14px 32px;
                    font-size: 15px;
                }
            }
        }

        .custom-modal-overlay {
            .custom-modal {
                margin: 20px;
                max-width: none;
                width: calc(100% - 40px);

                .custom-modal-header {
                    padding: 16px 20px 0;

                    h3 {
                        font-size: 18px;
                    }
                }

                .custom-modal-body {
                    padding: 12px 20px 20px;
                    font-size: 15px;
                }
            }
        }

        .quiz-user-info {
            padding: 20px;
            margin-bottom: 20px;

            h3 {
                font-size: 18px;
            }
        }
    }
    
}

// Responsive
@media (max-width: 768px) {
    .simpleform-quiz-container {
        margin: 20px auto;
        padding: 10px;

        .quiz-header {
            padding: 20px;

            .quiz-title {
                font-size: 22px;
            }
        }

        .quiz-content {
            padding: 20px;
        }

        .quiz-question {
            .question-header {
                .question-text {
                    font-size: 18px;
                }
            }

            .question-answers {
                .answer-option {
                    padding: 12px;

                    .answer-content {
                        .answer-text {
                            font-size: 14px;
                        }
                    }
                }
            }
        }
    }
}

// User Information Section
.quiz-user-info {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;

    h3 {
        font-size: 18px;
        color: #111827;
        margin: 0 0 16px 0;
    }

    .user-info-fields {
        display: flex;
        flex-direction: column;
        gap: 16px;

        .form-field {
            display: flex;
            flex-direction: column;
            gap: 6px;

            label {
                font-size: 14px;
                font-weight: 500;
                color: #374151;
            }

            input {
                padding: 10px 14px;
                border: 1px solid #d1d5db;
                border-radius: 6px;
                font-size: 14px;
                transition: border-color 0.2s;

                &:focus {
                    outline: none;
                    border-color: #4a6cf7;
                    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
                }

                &::placeholder {
                    color: #9ca3af;
                }
            }
        }
    }

    @media (min-width: 640px) {
        .user-info-fields {
            flex-direction: row;
            gap: 16px;

            .form-field {
                flex: 1;
            }
        }
    }
}

// Step-by-Step Quiz Styles
.quiz-wrapper.step-by-step {
    .step-navigation {
        padding: 20px 30px;
        background: #f8fafc;
        border-bottom: 1px solid #e2e8f0;

        &.progress-bar {
            .progress-container {
                width: 100%;
                height: 8px;
                background: #e2e8f0;
                border-radius: 4px;
                overflow: hidden;
                margin-bottom: 8px;

                .progress-bar-fill {
                    height: 100%;
                    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
                    transition: width 0.3s ease;
                }
            }

            .progress-text {
                text-align: center;
                font-size: 14px;
                color: #64748b;
                font-weight: 500;
            }
        }

        &.numbers,
        &.custom-labels {
            .step-indicators {
                display: flex;
                justify-content: center;
                align-items: center;
                gap: 16px;
                margin-bottom: 12px;

                .step-indicator {
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    gap: 6px;

                    .step-circle {
                        width: 32px;
                        height: 32px;
                        border-radius: 50%;
                        background: #e2e8f0;
                        color: #64748b;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        font-size: 14px;
                        font-weight: 600;
                        transition: all 0.3s ease;
                    }

                    .step-label {
                        font-size: 12px;
                        color: #64748b;
                        text-align: center;
                        max-width: 80px;
                        line-height: 1.2;
                    }

                    &.active {
                        .step-circle {
                            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
                            color: white;
                            transform: scale(1.1);
                        }

                        .step-label {
                            color: #667eea;
                            font-weight: 600;
                        }
                    }

                    &.completed {
                        .step-circle {
                            background: #10b981;
                            color: white;
                        }

                        .step-label {
                            color: #10b981;
                        }
                    }
                }
            }

            .step-text {
                text-align: center;
                font-size: 14px;
                color: #64748b;
                font-weight: 500;
            }
        }
    }

    .quiz-step-content {
        .step-header {
            text-align: center;
            margin-bottom: 24px;

            h3 {
                font-size: 20px;
                color: #1e293b;
                margin: 0 0 8px 0;
                font-weight: 600;
            }

            .step-description {
                font-size: 14px;
                color: #64748b;
                margin: 0;
            }
        }

        .quiz-questions {
            .quiz-question {
                background: #f8fafc;
                border: 2px solid #e2e8f0;
                border-radius: 12px;
                padding: 24px;
                margin-bottom: 24px;
                transition: all 0.3s ease;

                &:hover {
                    border-color: #cbd5e1;
                    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
                }

                &:last-child {
                    margin-bottom: 0;
                }
            }
        }
    }

    .step-footer {
        display: flex;
        justify-content: center;
        padding: 20px 30px;
        background: #f9fafb;
        border-top: 1px solid #e5e7eb;

        .step-buttons {
            display: flex;
            gap: 12px;
            align-items: center;

            .quiz-prev-btn,
            .quiz-next-btn,
            .quiz-submit-btn {
                padding: 12px 24px;
                border: none;
                border-radius: 8px;
                font-size: 14px;
                font-weight: 600;
                cursor: pointer;
                transition: all 0.3s;
            }

            .quiz-prev-btn {
                background: #e2e8f0;
                color: #64748b;

                &:hover {
                    background: #cbd5e1;
                    transform: translateY(-1px);
                }
            }

            .quiz-next-btn {
                background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
                color: white;

                &:hover {
                    transform: translateY(-2px);
                    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
                }
            }

            .quiz-submit-btn {
                background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
                color: white;

                &:hover {
                    transform: translateY(-2px);
                    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
                }
            }
        }
    }
}

// Mobile responsive for step-by-step
@media (max-width: 768px) {
    .quiz-wrapper.step-by-step {
        .step-navigation {
            padding: 16px 20px;

            &.numbers,
            &.custom-labels {
                .step-indicators {
                    gap: 12px;

                    .step-indicator {
                        .step-circle {
                            width: 28px;
                            height: 28px;
                            font-size: 12px;
                        }

                        .step-label {
                            font-size: 11px;
                            max-width: 60px;
                        }
                    }
                }
            }
        }

        .quiz-step-content {
            .step-header {
                h3 {
                    font-size: 18px;
                }

                .step-description {
                    font-size: 13px;
                }
            }

            .quiz-questions {
                .quiz-question {
                    padding: 20px;
                }
            }
        }

        .step-footer {
            padding: 16px 20px;

            .step-buttons {
                gap: 8px;

                .quiz-prev-btn,
                .quiz-next-btn,
                .quiz-submit-btn {
                    padding: 10px 20px;
                    font-size: 13px;
                }
            }
        }
    }

}