/* ============================================================
   CHABATRADING.COM - ANIMATIONS STYLESHEET
   Reveal, Scroll, Hover Effects & Special Animations
   ============================================================ */

/* ---------- SCROLL REVEAL ---------- */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.reveal-fade {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.reveal-fade.visible {
    opacity: 1;
}

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* ---------- DELAYS ---------- */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }
.delay-6 { transition-delay: 0.6s; }

/* ---------- LOADING ANIMATIONS ---------- */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
}

.loader-logo {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 2rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.loader-bar {
    width: 200px;
    height: 2px;
    background: var(--bg-tertiary);
    border-radius: 1px;
    overflow: hidden;
    margin: 0 auto;
}

.loader-progress {
    height: 100%;
    background: var(--gradient-primary);
    animation: loader-fill 1.5s ease forwards;
    box-shadow: var(--glow-cyan);
}

@keyframes loader-fill {
    0% { width: 0; }
    100% { width: 100%; }
}

.loader-text {
    margin-top: 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-tertiary);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

/* ---------- MATRIX RAIN ---------- */
.matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.06;
}

#matrix-canvas {
    width: 100%;
    height: 100%;
}

/* ---------- GLOWING BORDER ---------- */
.glow-border {
    position: relative;
}

.glow-border::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg,
        var(--accent-cyan),
        var(--accent-blue),
        var(--accent-purple),
        var(--accent-magenta),
        var(--accent-cyan));
    background-size: 400% 400%;
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-base);
    animation: glow-rotate 6s linear infinite;
}

.glow-border:hover::after {
    opacity: 1;
}

@keyframes glow-rotate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ---------- ICON ROTATE HOVER ---------- */
.icon-rotate-hover {
    display: inline-block;
    transition: transform var(--transition-base);
}

.icon-rotate-hover:hover {
    transform: rotate(360deg);
}

/* ---------- TYPEWRITER ---------- */
.typewriter {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--accent-cyan);
    animation: typewriter 3s steps(30) 1s 1 normal both,
               blink 0.8s infinite;
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

/* ---------- SHAKE HOVER ---------- */
.shake-hover {
    display: inline-block;
    transition: transform var(--transition-base);
}

.shake-hover:hover {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

/* ---------- COUNTER ANIMATION ---------- */
.counter {
    display: inline-block;
}

/* ---------- RIPPLE EFFECT ---------- */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(circle, currentColor 10%, transparent 10.01%);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 0 0;
    opacity: 0.3;
    transition: background-size 0.5s, opacity 0.5s;
    pointer-events: none;
}

.ripple:active::after {
    background-size: 1000% 1000%;
    opacity: 0;
    transition: 0s;
}

/* ---------- ORBIT ANIMATION ---------- */
.orbit {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.orbit-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 50%;
    box-shadow: var(--glow-cyan);
}

.orbit-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid var(--border-glow);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.orbit-ring-1 {
    width: 100px;
    height: 100px;
    animation: spin-slow 8s linear infinite;
}

.orbit-ring-2 {
    width: 160px;
    height: 160px;
    animation: spin-slow 14s linear infinite reverse;
}

.orbit-ring-3 {
    width: 200px;
    height: 200px;
    animation: spin-slow 20s linear infinite;
}

.orbit-dot {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: var(--accent-cyan);
    border-radius: 50%;
    box-shadow: var(--glow-cyan);
}

/* ---------- NEON FLICKER ---------- */
.neon-flicker {
    animation: neon-flicker 3s infinite;
}

@keyframes neon-flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        text-shadow:
            0 0 4px var(--accent-cyan),
            0 0 11px var(--accent-cyan),
            0 0 19px var(--accent-cyan);
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

/* ---------- FLOATING ANIMATION ---------- */
.float-up-down {
    animation: float 4s ease-in-out infinite;
}

.float-rotate {
    animation: spin-slow 20s linear infinite;
}

/* ---------- PULSE GLOW ---------- */
.pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(0, 240, 255, 0.8), 0 0 60px rgba(0, 240, 255, 0.4);
    }
}

/* ---------- SCAN LINE OVERLAY ---------- */
.scanline-overlay {
    position: relative;
}

.scanline-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(0, 240, 255, 0.1) 50%,
        transparent 100%);
    background-size: 100% 4px;
    animation: scan 8s linear infinite;
    pointer-events: none;
    opacity: 0.5;
}

/* ---------- TEXT SCRAMBLE EFFECT ---------- */
.text-scramble {
    display: inline-block;
    font-family: var(--font-mono);
}

/* ---------- GRADIENT BORDER ON HOVER ---------- */
.gradient-border-hover {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid transparent;
    background-clip: padding-box;
}

.gradient-border-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg,
        var(--accent-cyan),
        var(--accent-purple),
        var(--accent-magenta));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

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

/* ---------- SHIMMER LOADING ---------- */
.shimmer {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 0%,
        var(--bg-tertiary) 50%,
        var(--bg-secondary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
}

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

/* ---------- BACK TO TOP ---------- */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-glow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
    cursor: pointer;
    transition: all var(--transition-base);
    z-index: var(--z-elevated);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    backdrop-filter: blur(10px);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--gradient-primary);
    color: var(--bg-primary);
    box-shadow: var(--glow-cyan);
    transform: translateY(-4px);
}

.back-to-top svg {
    width: 20px;
    height: 20px;
}

/* ---------- PROGRESS BAR ---------- */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent);
    animation: progress-shine 2s linear infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ---------- TABS ---------- */
.tabs-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-line);
    flex-wrap: wrap;
}

.tab-button {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all var(--transition-base);
}

.tab-button:hover {
    color: var(--accent-cyan);
}

.tab-button.active {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
    box-shadow: 0 1px 0 var(--accent-cyan);
}

.tab-content {
    display: none;
    animation: fadeInUp 0.5s ease;
}

.tab-content.active {
    display: block;
}

/* ---------- ACCORDION ---------- */
.accordion {
    border: 1px solid var(--border-line);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    background: var(--bg-secondary);
}

.accordion-header {
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.accordion-header:hover {
    background: var(--bg-tertiary);
}

.accordion-icon {
    width: 16px;
    height: 16px;
    color: var(--accent-cyan);
    transition: transform var(--transition-base);
    flex-shrink: 0;
}

.accordion.active .accordion-icon {
    transform: rotate(45deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.accordion.active .accordion-content {
    max-height: 2000px;
}

.accordion-body {
    padding: 0 1.5rem 1.5rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ---------- NOTIFICATION TOAST ---------- */
.toast {
    position: fixed;
    top: 100px;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-glow);
    border-radius: 8px;
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-elevated), var(--glow-cyan);
    z-index: var(--z-modal);
    animation: slideInRight 0.4s ease, fadeOut 0.4s ease 4s forwards;
    max-width: 380px;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(50px);
    }
}

.toast-icon {
    width: 24px;
    height: 24px;
    color: var(--accent-green);
    flex-shrink: 0;
}

.toast-message {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ---------- CODE BLOCK ---------- */
.code-block {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-line);
    border-radius: 8px;
    padding: 1.25rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 1.5rem 0;
}

.code-block pre {
    margin: 0;
    color: inherit;
}

.code-block .comment {
    color: var(--text-muted);
}

.code-block .keyword {
    color: var(--accent-purple);
}

.code-block .string {
    color: var(--accent-green);
}

.code-block .function {
    color: var(--accent-cyan);
}

.code-block .number {
    color: var(--accent-orange);
}

/* ---------- COMPASS / RADAR ---------- */
.radar {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 0 auto;
    border-radius: 50%;
    border: 1px solid var(--border-glow);
    background:
        radial-gradient(circle, transparent 30%, rgba(0, 240, 255, 0.05) 30%, rgba(0, 240, 255, 0.05) 31%, transparent 31%),
        radial-gradient(circle, transparent 60%, rgba(0, 240, 255, 0.05) 60%, rgba(0, 240, 255, 0.05) 61%, transparent 61%),
        var(--bg-secondary);
    overflow: hidden;
}

.radar::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-cyan), transparent);
    transform-origin: left center;
    animation: radar-sweep 4s linear infinite;
    box-shadow: 0 0 10px var(--accent-cyan);
}

@keyframes radar-sweep {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.radar-target {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    box-shadow: var(--glow-green);
    animation: pulse 2s infinite;
}

.radar-target-1 { top: 30%; left: 60%; }
.radar-target-2 { top: 65%; left: 35%; animation-delay: 0.5s; }
.radar-target-3 { top: 50%; left: 75%; animation-delay: 1s; }
.radar-target-4 { top: 75%; left: 60%; animation-delay: 1.5s; }

/* ---------- BAR CHART ANIMATION ---------- */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    height: 200px;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-line);
}

.bar {
    flex: 1;
    background: var(--gradient-primary);
    border-radius: 4px 4px 0 0;
    position: relative;
    transition: all var(--transition-base);
    cursor: pointer;
    min-height: 20px;
    animation: bar-grow 1s ease forwards;
    transform-origin: bottom;
}

@keyframes bar-grow {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}

.bar:hover {
    background: var(--gradient-secondary);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
}

.bar-label {
    position: absolute;
    bottom: -1.75rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.bar-value {
    position: absolute;
    top: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-cyan);
    font-weight: 700;
}