/* CertQuest - Custom Styles */

/* Inter font import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Root variables for consistent theming */
:root {
    --emerald-500: #10b981;
    --emerald-600: #059669;
    --emerald-700: #047857;
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --orange-500: #f97316;
    --blue-500: #3b82f6;
    --purple-500: #8b5cf6;
    --red-500: #ef4444;
    --yellow-500: #eab308;
}

/* Base styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--gray-900);
    color: white;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom background for alternative sections */
.bg-gray-850 {
    background-color: #1a202c;
}

/* Enhanced animations and transitions */
.transition-all {
    transition: all 0.2s ease-in-out;
}

/* Navigation tabs */
.nav-tab {
    position: relative;
    transition: all 0.3s ease;
}

.nav-tab-active {
    color: var(--emerald-500) !important;
}

.nav-tab-active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 2px;
    background: var(--emerald-500);
    border-radius: 1px;
}

.transform {
    transition: transform 0.2s ease-in-out;
}

.hover\:scale-105:hover {
    transform: scale(1.05);
}

/* Custom button styles */
.btn-primary {
    background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
    border: none;
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--emerald-600), var(--emerald-700));
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Answer option styles */
.answer-option {
    position: relative;
    transition: all 0.2s ease-in-out;
    border: 2px solid transparent;
}

.answer-option:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.answer-option.selected {
    border-color: var(--emerald-500);
    background-color: rgba(16, 185, 129, 0.15);
    transform: translateY(-1px);
}

.answer-option .option-check {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

/* Progress bar animations */
.progress-bar {
    transition: width 1s ease-out;
}

.domain-progress-bar {
    transition: width 0.8s ease-out;
    background: linear-gradient(90deg, var(--emerald-500), var(--emerald-600));
}

.level-progress-bar {
    background: linear-gradient(90deg, var(--emerald-500), var(--emerald-600));
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* XP Animation */
.xp-animation {
    animation: xpPulse 0.6s ease-out;
}

@keyframes xpPulse {
    0% {
        transform: scale(1);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Card hover effects */
.card-hover {
    transition: all 0.3s ease-out;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* Feature card styles */
.feature-card {
    background: linear-gradient(145deg, var(--gray-800), #243447);
    border: 1px solid rgba(16, 185, 129, 0.1);
    transition: all 0.3s ease-out;
}

.feature-card:hover {
    border-color: var(--emerald-500);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Pricing card styles */
.pricing-card {
    background: linear-gradient(145deg, var(--gray-800), #243447);
    border: 1px solid var(--gray-700);
    transition: all 0.3s ease-out;
}

.pricing-card.featured {
    border-color: var(--emerald-500);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}

.pricing-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Navigation enhancements */
.nav-stat {
    background: rgba(55, 65, 81, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Gradient text effects */
.gradient-text {
    background: linear-gradient(135deg, var(--emerald-500), #06d6a0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-800);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-600);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--emerald-500);
}

/* Loading states */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.skeleton {
    background: linear-gradient(90deg, var(--gray-700), var(--gray-600), var(--gray-700));
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

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

/* Mobile responsiveness enhancements */
@media (max-width: 768px) {
    .answer-option {
        padding: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .pricing-card {
        margin-bottom: 1.5rem;
    }
    
    .feature-card {
        margin-bottom: 1rem;
    }
    
    .nav-stat {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Dark mode optimizations */
.dark {
    color-scheme: dark;
}

/* Focus states for accessibility */
.answer-option:focus,
.btn-primary:focus,
button:focus {
    outline: 2px solid var(--emerald-500);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .answer-option.selected {
        background-color: rgba(16, 185, 129, 0.3);
        border-width: 3px;
    }
    
    .btn-primary {
        border: 2px solid var(--emerald-300);
    }
}

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

/* Print styles */
@media print {
    .no-print {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* Success and error states */
.success-state {
    background-color: rgba(16, 185, 129, 0.1);
    border: 2px solid var(--emerald-500);
    color: var(--emerald-500);
}

.error-state {
    background-color: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--red-500);
    color: var(--red-500);
}

/* Pulse animation for notifications */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Custom utilities */
.blur-backdrop {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.box-shadow-lg {
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* View transition styles */
.view-container {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Study streak fire animation */
.streak-fire {
    animation: flicker 1.5s ease-in-out infinite alternate;
}

@keyframes flicker {
    0%, 100% {
        text-shadow: 0 0 5px #f97316, 0 0 10px #f97316, 0 0 15px #f97316;
    }
    50% {
        text-shadow: 0 0 2px #f97316, 0 0 5px #f97316, 0 0 8px #f97316;
    }
}

/* Store item cards */
.store-item {
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.store-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.store-item.owned {
    border-color: var(--emerald-500);
    background: rgba(16, 185, 129, 0.1);
}

.store-item.equipped {
    border-color: var(--emerald-500);
    background: rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.store-item.not-enough-coins {
    opacity: 0.5;
    cursor: not-allowed;
}

.store-item.not-enough-coins:hover {
    transform: none;
    box-shadow: none;
}

.store-item-preview {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: center;
}

.store-item-price {
    background: var(--gray-900);
    padding: 0.25rem 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid var(--yellow-500);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
}

.store-item-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.store-item-badge.equipped {
    background: var(--emerald-500);
    color: white;
}

.store-item-badge.owned {
    background: var(--gray-600);
    color: white;
}

/* Avatar display */
.avatar-container {
    display: inline-block;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--emerald-500);
    background: var(--gray-700);
}

.avatar-small {
    width: 32px;
    height: 32px;
}

.avatar-medium {
    width: 80px;
    height: 80px;
}

.avatar-large {
    width: 120px;
    height: 120px;
}

/* Authentication modal */
#auth-modal .bg-gray-800 {
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Coin animation */
#coin-popup {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999;
    background: var(--yellow-500);
    color: var(--gray-900);
}

/* Color picker for store items */
.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 auto 0.5rem;
    border: 3px solid var(--gray-600);
    transition: all 0.3s ease;
}

.store-item:hover .color-preview {
    transform: scale(1.1);
    border-color: var(--emerald-500);
}

/* Background preview */
.background-preview {
    width: 60px;
    height: 40px;
    margin: 0 auto 0.5rem;
    border-radius: 8px;
    border: 2px solid var(--gray-600);
    transition: all 0.3s ease;
}

.store-item:hover .background-preview {
    transform: scale(1.05);
    border-color: var(--emerald-500);
}

/* Holographic color animation */
@keyframes holo-rotate {
    0% { background: linear-gradient(45deg, #ff0080, #00ffff, #ff0080); }
    25% { background: linear-gradient(135deg, #00ffff, #ff4000, #00ffff); }
    50% { background: linear-gradient(225deg, #ff4000, #8000ff, #ff4000); }
    75% { background: linear-gradient(315deg, #8000ff, #ff0080, #8000ff); }
    100% { background: linear-gradient(45deg, #ff0080, #00ffff, #ff0080); }
}

/* Avatar type selection */
.avatar-type-option {
    position: relative;
}

.avatar-type-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Milestone items */
.milestone-item {
    transition: all 0.3s ease;
}

.milestone-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Mech-only item styling */
.store-item.mech-only {
    position: relative;
}

.store-item.mech-only::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(239, 68, 68, 0.1) 10px,
        rgba(239, 68, 68, 0.1) 20px
    );
    pointer-events: none;
    border-radius: 0.5rem;
}

/* Level up animation */
@keyframes levelUp {
    0% {
        transform: translate(-50%, -50%) scale(0.5) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1) rotate(5deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
}

.level-up-animation {
    animation: levelUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Mech unlock celebration */
.mech-unlock-glow {
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.5), 
                0 0 60px rgba(16, 185, 129, 0.3),
                0 0 90px rgba(16, 185, 129, 0.2);
}

/* Progress bar for mech unlock */
.mech-progress-bar {
    background: linear-gradient(90deg, var(--orange-500), var(--yellow-500));
    transition: width 0.8s ease-out;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.4);
}

/* Deep explanation animations */
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
}
