/* ==========================================================================
   HATTY'S GIF MAKER - MODERN STUDIO THEME
   ========================================================================== */

:root {
    --bg-dark: #07090e;
    --bg-surface: rgba(15, 20, 32, 0.75);
    --bg-surface-elevated: rgba(23, 31, 50, 0.85);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(56, 189, 248, 0.3);
    --accent-cyan: #00f0ff;
    --accent-indigo: #6366f1;
    --accent-violet: #8b5cf6;
    --accent-emerald: #10b981;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Ambient Studio Background Glow */
.studio-bg {
    background: 
        radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 85% 25%, rgba(0, 240, 255, 0.10) 0%, transparent 40%),
        radial-gradient(circle at 50% 85%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
        #07090e;
    background-attachment: fixed;
}

/* Subtle grid texture overlay */
.bg-grid-pattern {
    background-size: 32px 32px;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.glass-card {
    background: rgba(18, 25, 41, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.glass-card:hover {
    border-color: rgba(56, 189, 248, 0.25);
}

/* Splash Screen & Canvas */
#splash-screen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background-color: #05070a;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

#splash-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Glowing Typography */
.text-glow-cyan {
    text-shadow: 0 0 25px rgba(0, 240, 255, 0.5), 0 0 50px rgba(0, 240, 255, 0.2);
}

.text-glow-indigo {
    text-shadow: 0 0 25px rgba(99, 102, 241, 0.6), 0 0 50px rgba(99, 102, 241, 0.25);
}

.shimmer-text {
    background: linear-gradient(90deg, #00f0ff 0%, #a855f7 40%, #ec4899 60%, #00f0ff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textShimmer 6s linear infinite;
}

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

/* Pulsing Ambient Glow */
.pulse-glow {
    animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 240, 255, 0.2), 0 0 40px rgba(99, 102, 241, 0.15);
    }
    50% {
        box-shadow: 0 0 35px rgba(0, 240, 255, 0.4), 0 0 65px rgba(99, 102, 241, 0.3);
    }
}

/* Futuristic Cyber Hat Floating & Ambient Lighting */
@keyframes cyberHatFloat {
    0%, 100% {
        transform: translateY(0px) rotate(-1.5deg);
        filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 25px rgba(0, 240, 255, 0.2));
    }
    50% {
        transform: translateY(-9px) rotate(2deg);
        filter: drop-shadow(0 25px 35px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 40px rgba(99, 102, 241, 0.35));
    }
}

.cyber-hat-float {
    animation: cyberHatFloat 5s ease-in-out infinite;
    transform-origin: center center;
}

/* ==========================================================================
   CYBERPUNK GLITCH SYSTEM
   ========================================================================== */
.glitch-wrapper {
    position: relative;
    display: inline-block;
}

.glitch-text {
    position: relative;
    display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
}

/* Glitching Active State */
.is-glitching .glitch-text {
    animation: glitchJitter 0.55s steps(2, start) both;
}

.is-glitching .glitch-text::before {
    opacity: 0.95;
    color: #00f0ff;
    z-index: -1;
    animation: glitchAnimCyan 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.is-glitching .glitch-text::after {
    opacity: 0.95;
    color: #ff0055;
    z-index: -2;
    animation: glitchAnimMagenta 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes glitchJitter {
    0% { transform: translate(0, 0) skew(0deg); }
    10% { transform: translate(-4px, 2px) skew(-3deg); filter: blur(0.5px); }
    25% { transform: translate(4px, -2px) skew(4deg); }
    40% { transform: translate(-3px, -1px) skew(-2deg); }
    55% { transform: translate(5px, 2px) skew(3deg); filter: blur(1px); }
    70% { transform: translate(-2px, 3px) skew(-1deg); }
    85% { transform: translate(3px, -1px) skew(2deg); filter: blur(0px); }
    100% { transform: translate(0, 0) skew(0deg); }
}

@keyframes glitchAnimCyan {
    0% {
        clip-path: polygon(0 20%, 100% 20%, 100% 35%, 0 35%);
        transform: translate(-5px, -2px);
    }
    15% {
        clip-path: polygon(0 65%, 100% 65%, 100% 80%, 0 80%);
        transform: translate(4px, 2px);
    }
    30% {
        clip-path: polygon(0 10%, 100% 10%, 100% 25%, 0 25%);
        transform: translate(-4px, 1px);
    }
    50% {
        clip-path: polygon(0 40%, 100% 40%, 100% 55%, 0 55%);
        transform: translate(5px, -2px);
    }
    70% {
        clip-path: polygon(0 80%, 100% 80%, 100% 95%, 0 95%);
        transform: translate(-3px, 0px);
    }
    90% {
        clip-path: polygon(0 5%, 100% 5%, 100% 15%, 0 15%);
        transform: translate(2px, -1px);
    }
    100% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
        transform: translate(0, 0);
        opacity: 0;
    }
}

@keyframes glitchAnimMagenta {
    0% {
        clip-path: polygon(0 50%, 100% 50%, 100% 65%, 0 65%);
        transform: translate(5px, 2px);
    }
    15% {
        clip-path: polygon(0 15%, 100% 15%, 100% 30%, 0 30%);
        transform: translate(-4px, -2px);
    }
    30% {
        clip-path: polygon(0 75%, 100% 75%, 100% 90%, 0 90%);
        transform: translate(4px, -1px);
    }
    50% {
        clip-path: polygon(0 25%, 100% 25%, 100% 40%, 0 40%);
        transform: translate(-5px, 2px);
    }
    70% {
        clip-path: polygon(0 60%, 100% 60%, 100% 75%, 0 75%);
        transform: translate(3px, 1px);
    }
    90% {
        clip-path: polygon(0 35%, 100% 35%, 100% 45%, 0 45%);
        transform: translate(-2px, 0);
    }
    100% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
        transform: translate(0, 0);
        opacity: 0;
    }
}

/* Subtle periodic cyber pulse on settled title */
.cyber-title-glow {
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.4), 0 0 40px rgba(99, 102, 241, 0.25);
}

/* Drop Zone Animation */
.drop-zone {
    background: rgba(15, 23, 42, 0.4);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.05);
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.15), inset 0 0 20px rgba(0, 240, 255, 0.05);
    transform: scale(1.008);
}

/* Custom Dual-Slider Range Scrubber with Visual Filmstrip */
.timeline-track-container {
    position: relative;
    height: 54px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    overflow: hidden;
    user-select: none;
    cursor: pointer;
}

.timeline-filmstrip {
    position: absolute;
    inset: 0;
    display: flex;
    width: 100%;
    height: 100%;
    opacity: 0.65;
    pointer-events: none;
    z-index: 1;
}

.filmstrip-thumb {
    flex: 1;
    height: 100%;
    object-fit: cover;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    filter: saturate(0.9) contrast(1.05);
}

.timeline-highlight-bar {
    position: absolute;
    top: 3px;
    bottom: 3px;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.28), rgba(0, 240, 255, 0.28));
    border-top: 2px solid rgba(0, 240, 255, 0.85);
    border-bottom: 2px solid rgba(0, 240, 255, 0.85);
    border-radius: 8px;
    pointer-events: none;
    z-index: 5;
    transition: width 0.03s linear, left 0.03s linear;
}

.timeline-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #00f0ff;
    box-shadow: 0 0 12px #00f0ff, 0 0 4px #ffffff;
    pointer-events: none;
    z-index: 15;
    transition: left 0.03s linear;
}

.timeline-slider {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
    margin: 0;
    z-index: 20;
}

.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 46px;
    border-radius: 6px;
    background: #00f0ff;
    cursor: ew-resize;
    pointer-events: auto;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.85), 0 2px 6px rgba(0,0,0,0.6);
    border: 2px solid #ffffff;
    transition: transform 0.1s ease;
}

.timeline-slider::-webkit-slider-thumb:hover {
    transform: scale(1.12);
    background: #ffffff;
    border-color: #00f0ff;
}

.timeline-slider::-moz-range-thumb {
    width: 16px;
    height: 46px;
    border-radius: 6px;
    background: #00f0ff;
    cursor: ew-resize;
    pointer-events: auto;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.85);
    border: 2px solid #ffffff;
}

/* Hotkey Legend Badge */
.hotkey-kbd {
    display: inline-block;
    padding: 1px 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    margin-right: 2px;
}

/* Interactive Draggable & Resizable Crop Frame Overlay */
.crop-overlay-box {
    position: absolute;
    border: 2px solid #00f0ff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.62), inset 0 0 12px rgba(0, 240, 255, 0.2);
    cursor: move;
    z-index: 25;
    touch-action: none;
}

.crop-grid-lines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.22) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.22) 1px, transparent 1px);
    background-size: 33.333% 33.333%;
}

.crop-dimensions-pill {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(5, 7, 12, 0.85);
    border: 1px solid rgba(0, 240, 255, 0.45);
    color: #00f0ff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    pointer-events: none;
    white-space: nowrap;
}

.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #00f0ff;
    border: 2px solid #ffffff;
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.9);
    z-index: 30;
}

.crop-handle:hover {
    transform: scale(1.25);
    background: #ffffff;
}

.crop-handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.crop-handle-n  { top: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.crop-handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.crop-handle-e  { top: calc(50% - 6px); right: -6px; cursor: ew-resize; }
.crop-handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.crop-handle-s  { bottom: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.crop-handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.crop-handle-w  { top: calc(50% - 6px); left: -6px; cursor: ew-resize; }

#meme-canvas-overlay {
    z-index: 20;
    touch-action: none;
}

/* Styled Range Inputs */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 4px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00f0ff;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.8);
    transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.25);
}

/* Custom number input hide arrows */
input[type="number"]::-webkit-inner-spin-button, 
input[type="number"]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* Tab Navigation */
.tab-btn {
    position: relative;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 0.75rem;
    transition: all 0.25s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(0, 240, 255, 0.2));
    border: 1px solid rgba(0, 240, 255, 0.3);
    box-shadow: 0 4px 15px -2px rgba(0, 240, 255, 0.15);
}

/* Circular Progress Ring */
.progress-ring-circle {
    transition: stroke-dashoffset 0.2s ease-out;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(15, 20, 32, 0.8);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 240, 255, 0.4);
}

/* Shimmer Button */
.btn-shimmer {
    position: relative;
    overflow: hidden;
}

.btn-shimmer::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        60deg,
        transparent 30%,
        rgba(255, 255, 255, 0.25) 50%,
        transparent 70%
    );
    transform: rotate(25deg) translateY(-100%);
    animation: btnShimmerAnim 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes btnShimmerAnim {
    0% { transform: rotate(25deg) translateY(-100%); }
    20%, 100% { transform: rotate(25deg) translateY(100%); }
}

/* Image sequence thumbnail card */
.img-sequence-card {
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.img-sequence-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 240, 255, 0.5);
}

/* Recent Creations Gallery Card */
.gallery-card {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.25s ease;
}

.gallery-card:hover {
    border-color: rgba(0, 240, 255, 0.4);
    box-shadow: 0 10px 25px -5px rgba(0, 240, 255, 0.15);
    transform: translateY(-3px);
}

/* Live Palette Simulation Overlay Badge */
.simulation-active-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 35;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid #00f0ff;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
    border-radius: 8px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    color: #00f0ff;
    font-family: 'JetBrains Mono', monospace;
    pointer-events: none;
    animation: pulseGlow 2s infinite ease-in-out;
}
