/* ============================================
   ScanChecker 2.0 — Animations & Micro-interactions
   ============================================ */

/* ===== KEYFRAMES ===== */

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(-12px) scale(0.95); }
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-6px); }
}

@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0 var(--primary-glow); }
    70%  { box-shadow: 0 0 0 10px rgba(200,16,46,0); }
    100% { box-shadow: 0 0 0 0 rgba(200,16,46,0); }
}

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

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

@keyframes scanLine {
    0%   { top: 5%; }
    50%  { top: 90%; }
    100% { top: 5%; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes bounceIn {
    0%   { transform: scale(0.3); opacity: 0; }
    50%  { transform: scale(1.05); }
    70%  { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes ripple {
    0%   { transform: scale(0); opacity: 1; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* ===== PAGE TRANSITIONS ===== */

.page-enter {
    animation: fadeInUp 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.slide-in-right {
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ===== SKELETON LOADING ===== */

.skeleton {
    background: linear-gradient(90deg,
        var(--bg-card) 25%,
        var(--bg-card-hover) 50%,
        var(--bg-card) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-line {
    height: 14px;
    margin-bottom: 8px;
}
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }
.skeleton-line.long { width: 100%; }

.skeleton-card {
    height: 80px;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

/* ===== LOADING SPINNER ===== */

.spinner {
    width: 24px; height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9000;
    opacity: 0; pointer-events: none;
    transition: opacity var(--transition-base);
}
.loading-overlay.show { opacity: 1; pointer-events: auto; }
.loading-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    box-shadow: var(--shadow-lg);
}
.loading-text { font-size: 0.85rem; color: var(--text-secondary); }

/* ===== QR SCANNER ANIMATION ===== */

.qr-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 220px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
}

.qr-corner {
    position: absolute;
    width: 24px; height: 24px;
    border-color: var(--primary);
    border-style: solid;
}
.qr-corner-tl { top: 10px; left: 10px; border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }
.qr-corner-tr { top: 10px; right: 10px; border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }
.qr-corner-bl { bottom: 10px; left: 10px; border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }
.qr-corner-br { bottom: 10px; right: 10px; border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }

.qr-scan-line {
    position: absolute;
    left: 10px; right: 10px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: scanLine 2s ease-in-out infinite;
    border-radius: 1px;
    box-shadow: 0 0 8px var(--primary-glow);
}

/* ===== BUTTON PRESS RIPPLE ===== */

.ripple-btn {
    position: relative;
    overflow: hidden;
}
.ripple-btn::after {
    content: '';
    position: absolute;
    width: 100%; height: 100%;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    transform: scale(0);
    pointer-events: none;
}
.ripple-btn:active::after {
    animation: ripple 0.4s ease;
}

/* ===== SCAN SUCCESS ANIMATION ===== */

.scan-success-flash {
    animation: successFlash 0.4s ease;
}

@keyframes successFlash {
    0%   { background-color: transparent; }
    30%  { background-color: rgba(200,16,46,0.15); }
    100% { background-color: transparent; }
}

/* ===== COUNTER ANIMATION ===== */

.count-animate {
    animation: countUp 0.3s ease;
}

/* ===== EXPEDITION CARD HOVER ===== */

.expedition-card {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

/* ===== CAROUSEL SWIPE INDICATOR ===== */

.swipe-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
    animation: fadeIn 0.5s ease 1s both;
}

.swipe-hint svg {
    animation: swipeHint 1.5s ease-in-out infinite;
}

@keyframes swipeHint {
    0%, 100% { transform: translateX(0); opacity: 1; }
    50%       { transform: translateX(6px); opacity: 0.5; }
}

/* ===== STAGGERED ANIMATION DELAY ===== */

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.10s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.20s; }
.stagger-5 { animation-delay: 0.25s; }

/* ===== FOCUS RING ===== */

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===== PRINT STYLES ===== */

@media print {
    .navbar, .btn-qr-scan, .scan-item-actions, .filter-bar,
    .modal-overlay, .toast-container, .user-menu { display: none !important; }
    .main-content { padding-top: 0; }
    body { background: white; color: black; }
    .table th, .table td { border: 1px solid #ddd; }
}
