/* 
 * ══════════════════════════════════════════════════════════════════════════════
 * HAC ACCESS - Animations & Keyframes
 * ══════════════════════════════════════════════════════════════════════════════
 */

/* ═══════════════════════════════════════════════════════════════════════════════
 * EASING CURVES REFERENCE (for JS usage)
 * ═══════════════════════════════════════════════════════════════════════════════
 * InOutCirc  → cubic-bezier(0.785, 0.135, 0.15, 0.86)
 * OutQuint   → cubic-bezier(0.22, 1, 0.36, 1)
 * InExpo     → cubic-bezier(0.95, 0.05, 0.795, 0.035)
 * OutExpo    → cubic-bezier(0.19, 1, 0.22, 1)
 * InSine     → cubic-bezier(0.47, 0, 0.745, 0.715)
 * OutCubic   → cubic-bezier(0.33, 1, 0.68, 1)
 * InCubic    → cubic-bezier(0.32, 0, 0.67, 0)
 * InQuart    → cubic-bezier(0.5, 0, 0.75, 0)
 * InCirc     → cubic-bezier(0.6, 0.04, 0.98, 0.335)
 */

/* ═══════════════════════════════════════════════════════════════════════════════
 * CURSOR BLINK
 * ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes cursor-blink {
    0%    { opacity: 1; }
    45%   { opacity: 1; }
    50%   { opacity: 0; }
    72%   { opacity: 0; }
    77%   { opacity: 1; }
    100%  { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * SPINNER CHASE (8-cell clockwise)
 * ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes spinner-chase {
    0%, 100% { background: var(--text-secondary); }
    12.5%    { background: var(--background); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * BREATHING (confirmation text pulse)
 * ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes breathe {
    0%   { opacity: 1; }
    50%  { opacity: 0.8; }
    100% { opacity: 1; }
}

.breathing {
    animation: breathe 3s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * PROGRESS BAR ANIMATIONS
 * ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes progress-grow-phase1 {
    from { width: 0%; }
    to   { width: 40%; }
}

@keyframes progress-grow-phase2 {
    from { width: 40%; }
    to   { width: 100%; }
}

@keyframes progress-scale-y {
    from { transform: scaleY(0.02); }
    to   { transform: scaleY(1); }
}

@keyframes progress-retract {
    from { width: 100%; }
    to   { width: 73%; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * SPLASH SLIDE
 * ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes splash-slide-up {
    from { top: 50%; }
    to   { top: 40.6%; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * FADE ANIMATIONS
 * ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * SURFACE ANIMATIONS
 * ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes surface-bar-scale {
    from { transform: scaleY(0); }
    to   { transform: scaleY(1); }
}

@keyframes surface-content-expand {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * GLOW PULSE
 * ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes glow-pulse {
    0%, 100% {
        text-shadow: 
            0 0 5px rgba(var(--color_r), var(--color_g), var(--color_b), 0.5),
            0 0 10px rgba(var(--color_r), var(--color_g), var(--color_b), 0.3);
    }
    50% {
        text-shadow: 
            0 0 10px rgba(var(--color_r), var(--color_g), var(--color_b), 0.8),
            0 0 20px rgba(var(--color_r), var(--color_g), var(--color_b), 0.5),
            0 0 30px rgba(var(--color_r), var(--color_g), var(--color_b), 0.3);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * SLIDE IN ANIMATIONS
 * ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes slide-in-bottom {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ═══════════════════════════════════════════════════════════════════════════════
 * SVG GLITCH EFFECT
 * ═══════════════════════════════════════════════════════════════════════════════ */
.svg-glitch {
    animation: svgGlitch 80ms steps(2, end) infinite;
    filter: drop-shadow(-2px 0 #ff0040) drop-shadow(2px 0 #00ffff);
}

@keyframes svgGlitch {
    0%   { transform: translate(0, 0) skewX(0); }
    20%  { transform: translate(-3px, 1px) skewX(-2deg); }
    40%  { transform: translate(2px, -1px) skewX(1deg); }
    60%  { transform: translate(-1px, 2px) skewX(-1deg); }
    80%  { transform: translate(3px, 0) skewX(2deg); }
    100% { transform: translate(0, -1px) skewX(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * BOOT TITLE LOGO
 * ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes fadeInTitleAlt {
    from { 
        opacity: 0;
        transform: translateY(10px) translateZ(0);
    }
    to { 
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

.boot-title-logo {
    transition: 
        background-color 0.15s ease-out,
        border 0.15s ease-out,
        box-shadow 0.3s ease-out;
    transform: translateZ(0);
    will-change: opacity, transform;
}

.boot-title-logo.glow-active {
    text-shadow: 
        0 0 5px rgba(var(--color_r), var(--color_g), var(--color_b), 0.9),
        0 0 20px rgba(var(--color_r), var(--color_g), var(--color_b), 0.6),
        0 0 40px rgba(var(--color_r), var(--color_g), var(--color_b), 0.3);
    box-shadow: 
        0 0 30px rgba(var(--color_r), var(--color_g), var(--color_b), 0.2),
        inset 0 0 20px rgba(var(--color_r), var(--color_g), var(--color_b), 0.1);
    filter: drop-shadow(0 0 10px rgba(var(--color_r), var(--color_g), var(--color_b), 0.4));
}

.boot-title-logo.glitch {
    animation: glitchMainAlt 0.4s ease-in-out;
}

@keyframes glitchMainAlt {
    0%, 100% { transform: translateX(0) translateZ(0); }
    10% { transform: translateX(-2px) translateZ(0); }
    20% { transform: translateX(2px) translateZ(0); }
    30% { transform: translateX(-1px) translateZ(0); }
    40% { transform: translateX(1px) translateZ(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * REDUCED MOTION
 * ═══════════════════════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════════════════════
 * MODAL/DIALOG SYSTEM
 * ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes modalBackdropFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) translateZ(0);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: modalBackdropFade 200ms ease-out forwards;
    padding: 1rem;
}

.modal {
    background: var(--bg-card, #181818);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.06));
    border-top: 1px solid rgba(0, 212, 212, 0.2);
    border-radius: 0;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 250ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal__header {
    padding: 24px;
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.06));
    background: rgba(0, 212, 212, 0.02);
}

.modal__title {
    font-family: var(--font_main, 'Bai Jamjuree', sans-serif);
    font-size: 18px;
    font-weight: 600;
    color: rgb(0, 212, 212);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 0;
}

.modal__content {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary, #E8E8E8);
}

.modal__content p {
    margin: 0 0 12px 0;
}

.modal__content h3 {
    font-size: 12px;
    font-weight: 600;
    color: rgb(0, 212, 212);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 16px 0 8px 0;
}

.modal__content ul {
    list-style: none;
    padding: 0;
    margin: 8px 0 12px 0;
}

.modal__content li {
    padding: 4px 0 4px 20px;
    position: relative;
}

.modal__content li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: rgb(0, 212, 212);
    opacity: 0.6;
}

.dialog-content {
    font-size: 14px;
    line-height: 1.6;
}

.dialog-content p {
    margin: 0 0 12px 0;
}

.dialog-content strong {
    color: rgb(0, 212, 212);
}

.data-info {
    background: rgba(0, 212, 212, 0.05);
    border: 1px solid rgba(0, 212, 212, 0.15);
    border-radius: 2px;
    padding: 12px;
    margin: 12px 0;
    font-size: 13px;
}

.data-info.warning {
    background: rgba(255, 100, 100, 0.05);
    border-color: rgba(255, 100, 100, 0.2);
}

.data-info strong {
    display: block;
    margin-bottom: 8px;
    color: rgb(0, 212, 212);
}

.data-info.warning strong {
    color: #ff6464;
}

.data-info ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.data-info li {
    padding: 4px 0;
    margin: 0;
}

.data-info li::before {
    content: '—';
    margin-right: 8px;
    color: rgb(0, 212, 212);
}

.data-info.warning li::before {
    color: #ff6464;
}

.event-detail {
    font-size: 14px;
    line-height: 1.7;
}

.event-detail p {
    margin: 0 0 12px 0;
}

.modal__footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border, rgba(255, 255, 255, 0.06));
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    background: rgba(0, 0, 0, 0.2);
}

.modal__btn {
    padding: 10px 20px;
    font-family: var(--font_main, 'Bai Jamjuree', sans-serif);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: var(--text-secondary, #888888);
    cursor: pointer;
    transition: all 200ms ease;
    border-radius: 0;
}

.modal__btn:hover {
    border-color: rgb(0, 212, 212);
    color: rgb(0, 212, 212);
}

.modal__btn--primary {
    border-color: rgb(0, 212, 212);
    color: rgb(0, 212, 212);
    background: rgba(0, 212, 212, 0.1);
}

.modal__btn--primary:hover {
    background: rgba(0, 212, 212, 0.15);
    box-shadow: 0 0 12px rgba(0, 212, 212, 0.2);
}

.modal__btn--secondary {
    color: var(--text-secondary, #888888);
}

.modal__btn--secondary:hover {
    border-color: var(--text-secondary, #888888);
    color: var(--text-primary, #E8E8E8);
}

.modal__btn--danger {
    border-color: #ff6464;
    color: #ff6464;
}

.modal__btn--danger:hover {
    background: rgba(255, 100, 100, 0.1);
    box-shadow: 0 0 12px rgba(255, 100, 100, 0.2);
}

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