/**
 * NEXABL Quiz Styles with Animations
 * Provides smooth transitions and visual feedback
 */

/* Quiz Container Layout */
.quiz-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 500px;
    position: relative;
}

/* Progress Bar Styles */
.quiz-progress {
    background: #f3f4f6;
    height: 8px;
    border-radius: 4px;
    margin-bottom: 2rem;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
    height: 100%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.step-counter {
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Quiz Step Animations */
.quiz-step {
    animation: slideIn 0.3s ease-out;
    opacity: 0;
    animation-fill-mode: forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.quiz-step.slide-out {
    animation: slideOut 0.3s ease-out;
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-20px);
    }
}

/* Question Styles */
.quiz-step h3 {
    font-size: 2rem;
    color: #1f2937;
    margin-bottom: 1rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.3;
}

.quiz-subtext {
    color: #6b7280;
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
    text-align: center;
}

/* Quiz Options (Button Style) */
.quiz-options {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.quiz-option {
    background: white;
    border: 3px solid #e5e7eb;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    font-weight: 600;
    font-size: 1.2rem;
    color: #374151;
    position: relative;
    overflow: hidden;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-option::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.quiz-option:hover {
    border-color: #22c55e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.15);
}

.quiz-option:hover::before {
    width: 100%;
    height: 100%;
    border-radius: 12px;
}

.quiz-option:active {
    transform: translateY(0);
    transition: transform 0.1s;
}

.quiz-option.selected {
    background: #22c55e;
    color: white;
    border-color: #22c55e;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
}

.quiz-option.selected::before {
    display: none;
}

/* Input Styles */
.quiz-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
}

.quiz-input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.quiz-input.is-invalid {
    border-color: #ef4444;
    animation: shake 0.3s ease-in-out;
}

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

/* Error Message */
.error-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: none;
    animation: fadeIn 0.2s ease-out;
}

/* Navigation Buttons */
.quiz-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    gap: 1rem;
}

.btn {
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.btn-primary {
    background: #22c55e;
    color: white;
}

.btn-primary:hover {
    background: #16a34a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.btn-success:hover {
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Loading State */
.quiz-loading {
    text-align: center;
    padding: 3rem;
    animation: fadeIn 0.3s ease-out;
}

.spinner-border {
    display: inline-block;
    width: 3rem;
    height: 3rem;
    border: 3px solid #f3f4f6;
    border-radius: 50%;
    border-top-color: #22c55e;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Success State */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
    position: relative;
}

.success-checkmark svg {
    stroke: #22c55e;
    stroke-width: 3;
    fill: none;
    animation: checkmark 0.6s ease-out;
}

@keyframes checkmark {
    0% {
        stroke-dasharray: 0 100;
    }
    100% {
        stroke-dasharray: 100 100;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .quiz-container {
        padding: 1rem;
        min-height: auto;
    }
    
    .quiz-step h3 {
        font-size: 1.25rem;
    }
    
    .quiz-option {
        padding: 1.25rem 1rem;
        font-size: 0.95rem;
    }
    
    .quiz-navigation {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 1rem;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
        margin-top: 2rem;
        z-index: 100;
    }
    
    .quiz-container {
        padding-bottom: 100px; /* Space for fixed navigation */
    }
    
    .btn {
        padding: 1rem 1.5rem;
        flex: 1;
    }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        #f3f4f6 25%,
        #e5e7eb 50%,
        #f3f4f6 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1.5rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.skeleton-button {
    height: 3rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Visible */
.btn:focus-visible,
.quiz-option:focus-visible,
.quiz-input:focus-visible {
    outline: 3px solid #22c55e;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .quiz-option {
        border-width: 3px;
    }
    
    .quiz-option.selected {
        outline: 3px solid currentColor;
        outline-offset: -3px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
