﻿/* ============================================================
   QUIZPRO ACADEMY — animations.css  (v3 — WOW EDITION)
   ============================================================ */


/* ── 1. PAGE ENTER ── */
@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body {
    animation: pageEnter 0.5s ease both;
}

/* ── 2. SCROLL REVEAL ── */
.reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.6s cubic-bezier(0.22,1,0.36,1), transform 0.6s cubic-bezier(0.22,1,0.36,1);
}

    .reveal.visible {
        opacity: 1;
        transform: translateY(0);
    }

.reveal-left {
    transform: translateX(-32px);
}

.reveal-right {
    transform: translateX(32px);
}

    .reveal-left.visible, .reveal-right.visible {
        transform: translateX(0);
    }

.reveal-scale {
    transform: scale(0.9);
}

    .reveal-scale.visible {
        transform: scale(1);
    }

.reveal-delay-1 {
    transition-delay: 0.08s;
}

.reveal-delay-2 {
    transition-delay: 0.16s;
}

.reveal-delay-3 {
    transition-delay: 0.24s;
}

.reveal-delay-4 {
    transition-delay: 0.32s;
}

.reveal-delay-5 {
    transition-delay: 0.40s;
}

/* ── 3. HERO ENTRANCE ── */
@keyframes heroTitle {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes heroSub {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes heroBtns {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-title {
    animation: heroTitle 0.7s 0.1s cubic-bezier(0.22,1,0.36,1) both;
}

.hero-sub {
    animation: heroSub 0.7s 0.28s cubic-bezier(0.22,1,0.36,1) both;
}

.hero-btns {
    animation: heroBtns 0.7s 0.44s cubic-bezier(0.22,1,0.36,1) both;
}

/* ── 4. DASHBOARD CARD DROP ── */
@keyframes cardDrop {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dash-card {
    animation: cardDrop 0.5s cubic-bezier(0.22,1,0.36,1) both;
}

    .dash-card:nth-child(1) {
        animation-delay: 0.04s;
    }

    .dash-card:nth-child(2) {
        animation-delay: 0.10s;
    }

    .dash-card:nth-child(3) {
        animation-delay: 0.16s;
    }

    .dash-card:nth-child(4) {
        animation-delay: 0.22s;
    }

    .dash-card:nth-child(5) {
        animation-delay: 0.28s;
    }

    .dash-card:nth-child(6) {
        animation-delay: 0.34s;
    }

/* ── 5. STATS POP ── */
@keyframes statsPop {
    from {
        opacity: 0;
        transform: scale(0.75) translateY(12px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.stats-item {
    animation: statsPop 0.55s cubic-bezier(0.34,1.56,0.64,1) both;
}

    .stats-item:nth-child(1) {
        animation-delay: 0.05s;
    }

    .stats-item:nth-child(2) {
        animation-delay: 0.13s;
    }

    .stats-item:nth-child(3) {
        animation-delay: 0.21s;
    }

    .stats-item:nth-child(4) {
        animation-delay: 0.29s;
    }

/* ── 6. TABLE ROW STAGGER ── */
@keyframes rowFade {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

tbody tr {
    animation: rowFade 0.38s cubic-bezier(0.22,1,0.36,1) both;
}

    tbody tr:nth-child(1) {
        animation-delay: 0.03s;
    }

    tbody tr:nth-child(2) {
        animation-delay: 0.07s;
    }

    tbody tr:nth-child(3) {
        animation-delay: 0.11s;
    }

    tbody tr:nth-child(4) {
        animation-delay: 0.15s;
    }

    tbody tr:nth-child(5) {
        animation-delay: 0.19s;
    }

    tbody tr:nth-child(6) {
        animation-delay: 0.23s;
    }

    tbody tr:nth-child(7) {
        animation-delay: 0.27s;
    }

    tbody tr:nth-child(8) {
        animation-delay: 0.31s;
    }

    tbody tr:nth-child(9) {
        animation-delay: 0.35s;
    }

    tbody tr:nth-child(10) {
        animation-delay: 0.39s;
    }

/* ── 7. MODAL ANIMATION ── */
@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.88) translateY(24px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes backdropIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-animate {
    animation: modalIn 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}

.backdrop-animate {
    animation: backdropIn 0.25s ease both;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

    .modal-overlay.is-open {
        display: flex;
    }

/* ── 8. HOVER CARD LIFT + GLOW ── */
.hover-lift {
    transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.28s ease;
}

    .hover-lift:hover {
        transform: translateY(-6px);
        box-shadow: 0 16px 40px rgba(0,40,142,0.15);
    }

/* ── 9. FEATURE CARD HOVER ── */
.feature-card {
    transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.28s ease, border-color 0.2s ease;
    position: relative;
    overflow: hidden;
}

    .feature-card::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, rgba(0,40,142,0.04) 0%, transparent 60%);
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }

    .feature-card:hover::before {
        opacity: 1;
    }

    .feature-card:hover {
        transform: translateY(-7px);
        box-shadow: 0 16px 40px rgba(0,40,142,0.14);
    }

/* ── 10. MAGNETIC BUTTON GLOW ── */
button.btn-primary, .btn-glow, .btn-magnetic {
    transition: box-shadow 0.25s ease, transform 0.15s ease, background 0.2s ease;
    position: relative;
    overflow: hidden;
}

    button.btn-primary:hover, .btn-glow:hover, .btn-magnetic:hover {
        box-shadow: 0 0 0 6px rgba(0,40,142,0.12), 0 8px 24px rgba(0,40,142,0.25);
        transform: translateY(-2px);
    }

    button.btn-primary:active, .btn-glow:active, .btn-magnetic:active {
        transform: scale(0.96) translateY(0);
        box-shadow: 0 0 0 3px rgba(0,40,142,0.1);
    }

/* ── 11. RIPPLE ── */
.ripple-host {
    position: relative;
    overflow: hidden;
}

@keyframes rippleAnim {
    to {
        transform: scale(4.5);
        opacity: 0;
    }
}

.ripple-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.38);
    transform: scale(0);
    animation: rippleAnim 0.6s linear;
    pointer-events: none;
}

/* ── 12. INPUT FOCUS ── */
input, select, textarea {
    transition: box-shadow 0.22s ease, border-color 0.22s ease, transform 0.15s ease;
}

    input:focus, select:focus, textarea:focus {
        box-shadow: 0 0 0 3px rgba(0,40,142,0.14);
        outline: none;
    }

/* ── 13. SIDEBAR NAV INDICATOR — chỉ sidebar, KHÔNG header ── */
#sidebarPanel nav a {
    position: relative;
    overflow: hidden;
    transition: color 0.18s ease, background 0.18s ease;
}

    #sidebarPanel nav a::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 3px;
        background: #00288e;
        border-radius: 0 4px 4px 0;
        transform: scaleY(0);
        transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
    }

    #sidebarPanel nav a:hover::before {
        transform: scaleY(1);
    }

    #sidebarPanel nav a::after {
        content: '';
        position: absolute;
        inset: 0;
        background: currentColor;
        opacity: 0;
        border-radius: inherit;
        transition: opacity 0.18s ease;
        pointer-events: none;
    }

    #sidebarPanel nav a:hover::after {
        opacity: 0.06;
    }

/* ── 14. NAVBAR SCROLL SHADOW ── */
header.scrolled {
    box-shadow: 0 4px 24px rgba(0,40,142,0.14);
    backdrop-filter: blur(8px);
    transition: box-shadow 0.3s ease;
}

/* ── 15. QUESTION ANSWER OPTIONS ── */
@keyframes questionSlide {
    from {
        opacity: 0;
        transform: translateX(28px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.question-animate {
    animation: questionSlide 0.35s cubic-bezier(0.22,1,0.36,1) both;
}

.option-btn {
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    cursor: pointer;
    transform: none !important;
}

    .option-btn:hover:not(:disabled) {
        box-shadow: 0 2px 12px rgba(0,40,142,0.10);
    }

/* ── 16. PROGRESS BAR ── */
.progress-fill {
    transition: width 1.2s cubic-bezier(0.22,1,0.36,1);
    position: relative;
    overflow: hidden;
}

    .progress-fill::after {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.35) 50%, transparent 100%);
        animation: shimmerBar 2s infinite;
    }

@keyframes shimmerBar {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(200%);
    }
}

/* ── 17. SCORE POP ── */
@keyframes scorePop {
    0% {
        opacity: 0;
        transform: scale(0.4) rotate(-10deg);
    }

    60% {
        transform: scale(1.15) rotate(3deg);
    }

    80% {
        transform: scale(0.95) rotate(-1deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

.score-pop {
    animation: scorePop 0.8s 0.2s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* ── 18. CONFETTI / FIREWORKS CANVAS ── */
#confetti-canvas, #fireworks-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99998;
}

/* ── 19. CORRECT ANSWER FLASH ── */
@keyframes correctFlash {
    0% {
        background: #bbf7d0;
        box-shadow: 0 0 0 3px #4ade80;
    }

    100% {
        background: transparent;
        box-shadow: none;
    }
}

.correct-flash {
    animation: correctFlash 0.9s ease;
}

/* ── 20. WRONG ANSWER SHAKE ── */
@keyframes wrongShake {
    0%,100% {
        transform: translateX(0);
    }

    15% {
        transform: translateX(-8px);
    }

    30% {
        transform: translateX(8px);
    }

    45% {
        transform: translateX(-6px);
    }

    60% {
        transform: translateX(6px);
    }

    75% {
        transform: translateX(-3px);
    }

    90% {
        transform: translateX(3px);
    }
}

@keyframes wrongGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(239,68,68,0.5);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(239,68,68,0);
    }

    100% {
        box-shadow: none;
    }
}

.wrong-shake {
    animation: wrongShake 0.5s ease, wrongGlow 0.8s ease;
}

/* ── 21. TIMER WARNING ── */
@keyframes timerPulse {
    0%,100% {
        color: #dc2626;
        transform: scale(1);
    }

    50% {
        color: #ef4444;
        transform: scale(1.1);
        text-shadow: 0 0 12px rgba(239,68,68,0.5);
    }
}

.timer-warning {
    animation: timerPulse 0.7s ease infinite;
}

/* ── 22. TOOLTIP ── */
[data-tooltip] {
    position: relative;
}

    [data-tooltip]::before {
        content: attr(data-tooltip);
        position: absolute;
        bottom: calc(100% + 8px);
        left: 50%;
        transform: translateX(-50%) scale(0.75) translateY(4px);
        background: #1a1b22;
        color: #fff;
        padding: 6px 12px;
        border-radius: 8px;
        font-size: 12px;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
        z-index: 1000;
        font-weight: 500;
    }

    [data-tooltip]:hover::before {
        opacity: 1;
        transform: translateX(-50%) scale(1) translateY(0);
    }

/* ── 23. SPINNER ── */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #c4c5d5;
    border-top-color: #00288e;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    display: inline-block;
}

/* ── 24. SKELETON SHIMMER ── */
@keyframes shimmer {
    0% {
        background-position: -600px 0;
    }

    100% {
        background-position: 600px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #eeedf7 25%, #f4f2fc 50%, #eeedf7 75%);
    background-size: 600px 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: 8px;
}

/* ── 25. PULSE BADGE ── */
@keyframes pulseBadge {
    0%,100% {
        box-shadow: 0 0 0 0 rgba(0,40,142,0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(0,40,142,0);
    }
}

.badge-pulse {
    animation: pulseBadge 1.8s ease infinite;
}

/* ── 26. TOAST ── */
#toast-container {
    position: fixed;
    top: 72px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(90px) scale(0.9) rotate(2deg);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1) rotate(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(90px) scale(0.9);
    }
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 14px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    animation: toastIn 0.45s cubic-bezier(0.34,1.56,0.64,1) both;
    min-width: 240px;
    max-width: 360px;
    border-left: 4px solid;
}

    .toast.hide {
        animation: toastOut 0.3s ease forwards;
    }

.toast-success {
    background: #e8f5e9;
    color: #1b5e20;
    border-color: #4caf50;
}

.toast-error {
    background: #fce4ec;
    color: #880e4f;
    border-color: #e91e63;
}

.toast-info {
    background: #e3f2fd;
    color: #0d47a1;
    border-color: #2196f3;
}

.toast-warning {
    background: #fff8e1;
    color: #e65100;
    border-color: #ff9800;
}

/* ── 27. AUTH FORM ── */
@keyframes formSlide {
    from {
        opacity: 0;
        transform: translateY(28px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes panelReveal {
    from {
        opacity: 0;
        transform: translateX(-36px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.auth-form-card {
    animation: formSlide 0.55s 0.1s cubic-bezier(0.22,1,0.36,1) both;
}

.auth-left-panel {
    animation: panelReveal 0.65s 0.05s cubic-bezier(0.22,1,0.36,1) both;
}

/* ── 28. FLOATING PARTICLES (background decoration) ── */
.particle-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

    .particle-bg span {
        position: absolute;
        border-radius: 50%;
        background: rgba(0,40,142,0.06);
        animation: floatParticle linear infinite;
    }

@keyframes floatParticle {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-100px) scale(1);
        opacity: 0;
    }
}


/* ── 30. STAR BURST CLICK EFFECT ── */
.click-burst {
    position: fixed;
    pointer-events: none;
    z-index: 999997;
    width: 0;
    height: 0;
}

@keyframes burst-ray {
    from {
        transform: rotate(var(--angle)) scaleY(1);
        opacity: 1;
    }

    to {
        transform: rotate(var(--angle)) translateY(-30px) scaleY(0);
        opacity: 0;
    }
}

.burst-ray {
    position: absolute;
    width: 3px;
    height: 16px;
    background: #00288e;
    border-radius: 2px;
    transform-origin: bottom center;
    animation: burst-ray 0.4s cubic-bezier(0.22,1,0.36,1) forwards;
}

/* ── 31. GLOWING SCORE RING ── */
@keyframes glowRing {
    0%,100% {
        box-shadow: 0 0 0 0 rgba(0,40,142,0.5);
    }

    50% {
        box-shadow: 0 0 0 16px rgba(0,40,142,0);
    }
}

.score-ring-glow {
    animation: glowRing 2s ease infinite;
}

/* ── 32. EXAM NAV BUTTON ANSWERED ── */
@keyframes navBtnPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1.05);
    }
}

.nav-btn-answered {
    animation: navBtnPop 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* ── 33. TILT CARD (3D hover) ── */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.1s ease;
    will-change: transform;
}

/* ── 34. GRADIENT SWEEP on load ── */
@keyframes gradientSweep {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.gradient-animated {
    background-size: 200% 200%;
    animation: gradientSweep 6s ease infinite;
}



/* ── SIDEBAR CỐ ĐỊNH — không cuộn theo trang ── */
#sidebarPanel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100dvh !important;
    will-change: transform;
    contain: layout style;
    z-index: 40 !important;
}

/* Body layout: sidebar fixed, main scroll độc lập */
body:has(#sidebarPanel) {
    overflow: hidden;
    height: 100dvh;
}

    /* Main content cuộn độc lập */
    body:has(#sidebarPanel) > main,
    .md\:ml-\[280px\] {
        height: 100dvh;
        overflow-y: auto;
        overflow-x: hidden;
    }

/* ── PHÒNG THI: tắt mọi hiệu ứng ripple/overflow trên option-btn ── */
.option-btn {
    overflow: visible !important;
}

    .option-btn .ripple-circle,
    #mainForm .ripple-circle {
        display: none !important;
    }


/* ── NAVBAR UNDERLINE: xem style trong _Layout.cshtml ── */

/* ── 35. PAGE EXIT ── */
body.page-exit {
    animation: none;
    opacity: 0;
    transition: opacity 0.22s ease;
}

/* ── 36. COUNT-UP BOUNCE ── */
@keyframes numBounce {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.18);
    }

    100% {
        transform: scale(1);
    }
}

.num-bounce {
    animation: numBounce 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

/* ── 37. SUCCESS CHECKMARK SVG ── */
@keyframes checkDraw {
    from {
        stroke-dashoffset: 100;
    }

    to {
        stroke-dashoffset: 0;
    }
}

.check-draw {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: checkDraw 0.5s 0.2s ease forwards;
}

/* ── 38. HOVER SHINE on tables ── */
tbody tr {
    position: relative;
    transition: background 0.15s ease, transform 0.15s ease;
}

    tbody tr:hover {
        background: rgba(0,40,142,0.03) !important;
        transform: scale(1.002);
    }



/* ── 10. EXAM / ASSIGNMENT CARD HOVER LIFT ── */
.exam-hover-card {
    position: relative;
    isolation: isolate;
    transform: translateY(0) scale(1);
    will-change: transform, box-shadow, border-color;
    transition:
        transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.28s ease,
        border-color 0.28s ease,
        background 0.28s ease;
}

.exam-hover-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        radial-gradient(circle at 18% 10%, rgba(79, 70, 229, 0.12), transparent 34%),
        radial-gradient(circle at 92% 4%, rgba(6, 182, 212, 0.12), transparent 32%);
    opacity: 0;
    transition: opacity 0.28s ease;
    pointer-events: none;
    z-index: 0;
}

.exam-hover-card > * {
    position: relative;
    z-index: 1;
}

.exam-hover-card:hover {
    transform: translateY(-10px) scale(1.018);
    border-color: rgba(79, 70, 229, 0.45);
    box-shadow:
        0 22px 45px rgba(15, 23, 42, 0.14),
        0 10px 24px rgba(37, 99, 235, 0.16);
}

.exam-hover-card:hover::after {
    opacity: 1;
}

.exam-hover-card:hover .h-2.bg-gradient-to-r {
    filter: saturate(1.25) brightness(1.08);
}

.exam-hover-card a,
.exam-hover-card button {
    transition: transform 0.22s ease, box-shadow 0.22s ease, opacity 0.22s ease, background-color 0.22s ease;
}

.exam-hover-card:hover a,
.exam-hover-card:hover button {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.14);
}

@media (prefers-reduced-motion: reduce) {
    .exam-hover-card,
    .exam-hover-card::after,
    .exam-hover-card a,
    .exam-hover-card button {
        transition: none;
    }

    .exam-hover-card:hover,
    .exam-hover-card:hover a,
    .exam-hover-card:hover button {
        transform: none;
    }
}
