/* AI EXAM - Main Styles */

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: #0f172a;
    color: #e2e8f0;
}

.glass-panel {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Card Flip Animation */
.card-container {
    perspective: 1000px;
}

.card {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 2rem;
    border-radius: 1rem;
}

.card-front {
    background: rgba(30, 41, 59, 0.95);
    border: 2px solid #4f46e5;
}

.card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
}

/* Animations */
@keyframes message-pop {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.message-bubble {
    animation: message-pop 0.3s ease-out forwards;
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

@keyframes slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-slide-up {
    animation: slide-up 0.4s ease-out;
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

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

::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Hide scrollbar for chat */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Loading spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Pulse animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Bounce animation */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.animate-bounce {
    animation: bounce 1s ease-in-out infinite;
}

/* ===== Responsive Styles ===== */

/* Tablet breakpoint (768px+) */
@media (min-width: 768px) {
    .card-face {
        padding: 2.5rem;
    }

    .glass-panel {
        background: rgba(30, 41, 59, 0.6);
    }
}

/* Desktop breakpoint (1024px+) */
@media (min-width: 1024px) {
    .card-face {
        padding: 3rem;
        border-radius: 1.5rem;
    }

    .glass-panel {
        background: rgba(30, 41, 59, 0.5);
        backdrop-filter: blur(12px);
    }

    /* Larger card hover effect on desktop */
    .card:hover {
        transform: scale(1.02);
        transition: transform 0.3s ease;
    }

    .card.flipped:hover {
        transform: rotateY(180deg) scale(1.02);
    }
}

/* Large desktop breakpoint (1280px+) */
@media (min-width: 1280px) {
    body {
        font-size: 16px;
    }

    .card-face {
        padding: 3.5rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .card:hover {
        transform: none;
    }

    .card.flipped:hover {
        transform: rotateY(180deg);
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .card {
        transition: none;
    }

    .animate-bounce,
    .animate-pulse,
    .animate-spin {
        animation: none;
    }

    .message-bubble,
    .fade-in,
    .animate-fade-in,
    .animate-slide-up {
        animation: none;
    }
}

/* ===== New Features Styles ===== */

/* Timer Warning Animation */
@keyframes timer-warning {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
    50% {
        box-shadow: 0 0 20px 5px rgba(239, 68, 68, 0.4);
    }
}

.timer-warning {
    animation: timer-warning 1s ease-in-out infinite;
}

/* Streak Effect Animation */
@keyframes streak-pop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.streak-effect {
    animation: streak-pop 0.5s ease-out forwards;
}

/* Question Dot Animation */
@keyframes dot-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.dot-active {
    animation: dot-pop 0.3s ease-out;
}

/* Progress Bar Animation */
.progress-bar {
    transition: width 0.5s ease-out;
}

/* Modal Backdrop */
.modal-backdrop {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Toggle Switch Animation */
.toggle-switch {
    transition: background-color 0.2s ease;
}

.toggle-knob {
    transition: transform 0.2s ease;
}

/* Keyboard Key Style */
kbd {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
}

/* Shake Animation for Wrong Answer */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

/* Success Glow Effect */
@keyframes success-glow {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.success-glow {
    animation: success-glow 0.5s ease-out;
}

/* Pause Overlay */
.pause-overlay {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Bookmark Star Animation */
@keyframes star-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.bookmark-active {
    animation: star-pop 0.3s ease-out;
}

/* Navigator Panel Slide */
@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-down {
    animation: slide-down 0.3s ease-out;
}

/* Tab Button Active State */
.tab-active {
    position: relative;
}

.tab-active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: #6366f1;
    border-radius: 2px;
}

/* Timer Critical State */
@keyframes timer-critical {
    0%, 100% {
        color: #ef4444;
        transform: scale(1);
    }
    50% {
        color: #fca5a5;
        transform: scale(1.1);
    }
}

.timer-critical {
    animation: timer-critical 0.5s ease-in-out infinite;
}

/* Smooth Input Focus */
input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

/* Button Press Effect */
button:active:not(:disabled) {
    transform: scale(0.98);
}

/* Grid columns for dynamic settings */
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* Tooltip for shortcuts */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Loading dots animation */
@keyframes loading-dots {
    0%, 20% { opacity: 0.3; }
    50% { opacity: 1; }
    80%, 100% { opacity: 0.3; }
}

.loading-dot:nth-child(1) { animation: loading-dots 1.4s infinite; animation-delay: 0s; }
.loading-dot:nth-child(2) { animation: loading-dots 1.4s infinite; animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation: loading-dots 1.4s infinite; animation-delay: 0.4s; }

/* Auto-generate indicator */
.auto-gen-indicator {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 50;
}

/* Break-keep for Korean text */
.break-keep {
    word-break: keep-all;
}

/* Selection color */
::selection {
    background: rgba(99, 102, 241, 0.4);
    color: white;
}
