/* Modern Personality Test Styles - Bootstrap 5 Compatible */

:root {
    --primary-color: #0f75bd;
    --primary-dark: #0a5a96;
    --secondary-color: #f72c93;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --white-shadow: 0 2px 4px rgba(255, 255, 255, 0.8);
    --card-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 1rem 2rem rgba(0, 0, 0, 0.15);
}

/* Section Styling */
.personality-test-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
}

/* Header Styling - Match brand identity */
.test-header h1 {
    color: #0F75BD;
    text-shadow: 
        2px 2px 0px rgba(255, 255, 255, 0.8),
        -2px -2px 0px rgba(255, 255, 255, 0.8),
        2px -2px 0px rgba(255, 255, 255, 0.8),
        -2px 2px 0px rgba(255, 255, 255, 0.8),
        0px 0px 15px rgba(0, 0, 0, 0.7),
        0px 0px 8px rgba(0, 0, 0, 0.5);
    font-weight: 700;
}

.test-header .lead {
    color: #0F75BD;
    text-shadow: 
        2px 2px 0px rgba(255, 255, 255, 0.8),
        -2px -2px 0px rgba(255, 255, 255, 0.8),
        2px -2px 0px rgba(255, 255, 255, 0.8),
        -2px 2px 0px rgba(255, 255, 255, 0.8),
        0px 0px 15px rgba(0, 0, 0, 0.7),
        0px 0px 8px rgba(0, 0, 0, 0.5);
    font-weight: 500;
}

/* Game Container */
.game-container {
    max-width: 100%;
}

/* Question Card */
.question-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

.question-card:hover {
    box-shadow: var(--card-shadow-hover);
}

.question-text {
    color: var(--dark-color);
    font-weight: 600;
    line-height: 1.4;
}

/* Choice Containers */
.choices-container {
    gap: 1rem;
}

/* Micro-interaction animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes slideInFromLeft {
    0% { transform: translateX(-100%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes slideInFromRight {
    0% { transform: translateX(100%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes fadeInUp {
    0% { transform: translateY(30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.15); }
    28% { transform: scale(1); }
    42% { transform: scale(1.08); }
    70% { transform: scale(1); }
}

/* Question entrance animation */
.question-card {
    animation: fadeInUp 0.8s ease-out;
}

/* Choice entrance animations */
.choice-container:nth-child(1) {
    animation: slideInFromLeft 0.6s ease-out 0.2s both;
}

.choice-container:nth-child(2) {
    animation: slideInFromRight 0.6s ease-out 0.4s both;
}

.choice-container {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #dee2e6;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.9);
    position: relative;
    overflow: hidden;
}

.choice-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(15, 117, 189, 0.1), transparent);
    transition: left 0.5s ease;
}

.choice-container:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0.5rem 1rem rgba(15, 117, 189, 0.2);
    transform: translateY(-3px) scale(1.02);
    animation: pulse 0.6s ease-in-out;
}

.choice-container:hover::before {
    left: 100%;
}

.choice-container:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(15, 117, 189, 0.25);
}

.choice-container:active,
.choice-container.selected {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-color: var(--primary-dark);
    color: white;
    transform: translateY(1px) scale(0.98);
    animation: heartbeat 0.8s ease-in-out;
}

.choice-container.selected .choice-text,
.choice-container:active .choice-text {
    color: white;
    font-weight: 600;
}

.choice-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--dark-color);
    transition: color 0.3s ease;
    margin: 0;
    text-align: center;
}

/* Progress Section */
.progress-section {
    margin-top: 2rem;
}

.progress {
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: #e9ecef;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 0.5rem;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    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%); }
}

/* Badge Styling */
.badge.bg-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)) !important;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
}

/* Loading State */
.choice-container.loading {
    pointer-events: none;
    opacity: 0.6;
}

.choice-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Question Loading Animation */
@keyframes questionSlideIn {
    0% { 
        transform: translateX(-100%); 
        opacity: 0; 
    }
    100% { 
        transform: translateX(0); 
        opacity: 1; 
    }
}

.question-text.loading {
    animation: questionSlideIn 0.5s ease-out;
}

/* Progressive Loading for Choices */
.choice-container.enter-left {
    animation: slideInFromLeft 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.choice-container.enter-right {
    animation: slideInFromRight 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* Staggered Animation Delays */
.choice-container.enter-left {
    animation-delay: 0.1s;
}

.choice-container.enter-right {
    animation-delay: 0.2s;
}

/* Smooth Progress Bar Animation */
.progress-bar.updating {
    animation: progressPulse 0.3s ease-in-out;
}

@keyframes progressPulse {
    0% { transform: scaleY(1); }
    50% { transform: scaleY(1.1); }
    100% { transform: scaleY(1); }
}

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

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .choice-container,
    .progress-bar,
    .question-card {
        transition: none;
    }
    
    .choice-container::before {
        display: none;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    .test-header h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .test-header .lead {
        font-size: 1rem;
        line-height: 1.4;
    }
    
    .question-card .card-body {
        padding: 1.5rem;
    }
    
    .choice-text {
        font-size: 1rem;
        line-height: 1.3;
    }
    
    .choice-container .card-body {
        padding: 1rem;
        min-height: 60px; /* Ensure minimum touch target size */
    }
    
    .choice-container {
        margin-bottom: 1rem;
        min-height: 60px; /* iOS minimum touch target */
    }
    
    /* Enhanced touch feedback for mobile */
    .choice-container:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* Larger tap targets for mobile */
    .choice-container:hover {
        transform: translateY(-2px) scale(1.01);
    }
    
    /* Prevent zoom on double tap */
    .choice-container {
        touch-action: manipulation;
    }
}

/* Extra Small Screens - Mobile First */
@media (max-width: 576px) {
    .personality-test-section {
        padding: 1rem 0;
    }
    
    .test-header {
        margin-bottom: 1.5rem;
    }
    
    .test-header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .question-card .card-body {
        padding: 1rem;
    }
    
    .question-text {
        font-size: 1.1rem;
        line-height: 1.4;
    }
    
    .choice-container .card-body {
        padding: 0.75rem;
        min-height: 50px;
    }
    
    .choice-container {
        margin-bottom: 0.75rem;
        min-height: 50px;
    }
    
    .choice-text {
        font-size: 0.95rem;
        line-height: 1.3;
    }
    
    .progress-section {
        margin-top: 1.5rem;
    }
    
    .badge.bg-primary {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }
    
    /* Optimize for one-handed use */
    .choice-container {
        border-radius: 12px;
    }
    
    /* Ensure smooth scrolling on mobile */
    .personality-test-section {
        scroll-behavior: smooth;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .personality-test-section {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
    
    .question-card {
        background: rgba(52, 73, 94, 0.95);
        color: #ecf0f1;
    }
    
    .question-text {
        color: #ecf0f1;
    }
    
    .choice-container {
        background: rgba(52, 73, 94, 0.9);
        border-color: #5a6c7d;
        color: #ecf0f1;
    }
    
    .choice-text {
        color: #ecf0f1;
    }
    
    .progress {
        background-color: #5a6c7d;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .choice-container {
        border-width: 3px;
    }
    
    .choice-container:focus {
        box-shadow: 0 0 0 0.5rem rgba(15, 117, 189, 0.5);
    }
}

/* Print Styles */
@media print {
    .personality-test-section {
        background: white;
    }
    
    .question-card,
    .choice-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .progress-section {
        display: none;
    }
}