/* ============================================================
   ANIMATIONS CSS - Auth System v1.0
   Advanced keyframes and page animations
   ============================================================ */

/* ─── Page Load Animations ───────────────────────────────────────────────────── */
.animate-fade-in    { animation: fadeIn 0.5s ease forwards; }
.animate-slide-up   { animation: slideInUp 0.4s ease forwards; }
.animate-slide-in   { animation: slideInRight 0.4s ease forwards; }
.animate-scale-in   { animation: scaleIn 0.3s ease forwards; }

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

/* Staggered children */
.stagger-children > * { opacity: 0; animation: slideInUp 0.4s ease forwards; }
.stagger-children > *:nth-child(1) { animation-delay: 0.0s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.08s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.16s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.24s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.32s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.40s; }

/* ─── Glitch Effect (for security violation screens) ────────────────────────── */
@keyframes glitch {
    0%   { clip-path: polygon(0 2%, 100% 2%, 100% 5%, 0 5%); transform: translate(-2px, 0); }
    20%  { clip-path: polygon(0 15%, 100% 15%, 100% 15%, 0 15%); }
    30%  { clip-path: polygon(0 80%, 100% 80%, 100% 85%, 0 85%); transform: translate(2px, 0); }
    40%  { clip-path: polygon(0 50%, 100% 50%, 100% 55%, 0 55%); transform: translate(-2px, 0); }
    70%  { clip-path: polygon(0 65%, 100% 65%, 100% 75%, 0 75%); transform: translate(2px, 0); }
    100% { clip-path: polygon(0 0, 0 0, 0 0, 0 0); transform: translate(0, 0); }
}

.glitch-text {
    position: relative;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
}

.glitch-text::before {
    animation: glitch 0.3s infinite linear;
    color: #0099ff;
    left: 2px;
}

.glitch-text::after {
    animation: glitch 0.3s infinite linear reverse;
    color: #00ffaa;
    left: -2px;
}

/* ─── Typing Cursor ──────────────────────────────────────────────────────────── */
.typing-cursor::after {
    content: '|';
    animation: blink 0.8s step-end infinite;
    color: var(--crimson);
}

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

/* ─── Number Counter Animation ───────────────────────────────────────────────── */
.count-up {
    display: inline-block;
    transition: opacity 0.3s;
}

/* ─── Progress Bar Animations ────────────────────────────────────────────────── */
.progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    transform-origin: left;
    animation: progressIn 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes progressIn {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* ─── Ripple Effect on Buttons ───────────────────────────────────────────────── */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

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

@keyframes ripple {
    to { transform: scale(4); opacity: 0; }
}

/* ─── Loading Bar (top of page) ──────────────────────────────────────────────── */
.loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--gradient-primary);
    z-index: 9999;
    box-shadow: 0 0 10px rgba(0, 153, 255, 0.8);
    transition: width 0.3s ease;
}

/* ─── Hover Reveal Buttons ───────────────────────────────────────────────────── */
.hover-reveal {
    opacity: 0;
    transform: translateY(5px);
    transition: all var(--transition-fast);
}

.parent-hover:hover .hover-reveal {
    opacity: 1;
    transform: translateY(0);
}

/* ─── Particle Grid Background ───────────────────────────────────────────────── */
.particle-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(0,153,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,153,255,0.04) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

/* ─── Floating Icons ─────────────────────────────────────────────────────────── */
.floating-icon {
    animation: float var(--duration, 6s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

/* ─── Heartbeat Animation ────────────────────────────────────────────────────── */
.heartbeat {
    animation: heartbeat 1.5s ease infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    14%       { transform: scale(1.1); }
    28%       { transform: scale(1); }
    42%       { transform: scale(1.1); }
    70%       { transform: scale(1); }
}

/* ─── Glow Pulse ─────────────────────────────────────────────────────────────── */
.glow-pulse {
    animation: glow 2s ease-in-out infinite;
}

/* ─── Bounce Subtle ──────────────────────────────────────────────────────────── */
.bounce {
    animation: bounce 2s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
    50%       { transform: translateY(-8px); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
}

/* ─── Radar Effect (Security Monitor) ───────────────────────────────────────── */
@keyframes radar {
    from { transform: scale(0.5); opacity: 0.8; }
    to   { transform: scale(2.5); opacity: 0; }
}

.radar-ring {
    position: absolute;
    border: 1px solid rgba(0, 153, 255, 0.5);
    border-radius: 50%;
    animation: radar 2s ease-out infinite;
}

.radar-ring:nth-child(2) { animation-delay: 0.7s; }
.radar-ring:nth-child(3) { animation-delay: 1.4s; }

/* ─── Activity Dot ───────────────────────────────────────────────────────────── */
@keyframes activity-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
    50%       { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    animation: activity-pulse 2s ease infinite;
}

/* ─── Gradient Border Animation ──────────────────────────────────────────────── */
@keyframes gradient-border {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.gradient-border-animated {
    position: relative;
}

.gradient-border-animated::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(45deg, #0099ff, #0055b3, #FF4466, #0055b3, #0099ff);
    background-size: 300% 300%;
    animation: gradient-border 4s ease infinite;
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.gradient-border-animated:hover::before { opacity: 1; }

/* ─── Matrix Rain Effect (optional for dark mode) ────────────────────────────── */
.matrix-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.03;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--crimson);
    z-index: 0;
}
