/* Custom animations and styles beyond Tailwind */

/* ── Animated Background ────────────────────────────────────── */
html {
    background: #06070f;
}

body {
    background: transparent;
    overflow-x: hidden;
}

.bg-scene {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

/* Subtle grid lines for depth */
.bg-scene::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 60px 60px;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.22;
    will-change: transform;
}

.blob-1 {
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, #6d28d9 0%, transparent 65%);
    top: -15%;
    left: -15%;
    animation: blob-drift-1 28s ease-in-out infinite alternate;
}

.blob-2 {
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, #0891b2 0%, transparent 65%);
    bottom: -12%;
    right: -10%;
    animation: blob-drift-2 22s ease-in-out infinite alternate;
}

.blob-3 {
    width: 460px;
    height: 460px;
    background: radial-gradient(circle, #b45309 0%, transparent 65%);
    top: 42%;
    left: 36%;
    animation: blob-drift-3 18s ease-in-out infinite alternate;
}

@keyframes blob-drift-1 {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(80px, 60px) scale(1.12); }
}

@keyframes blob-drift-2 {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(-60px, -80px) scale(1.08); }
}

@keyframes blob-drift-3 {
    from { transform: translate(0, 0) scale(0.9); }
    to   { transform: translate(50px, -60px) scale(1.1); }
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0.75rem;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

/* Shine sweep on hover */
.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -80%;
    width: 55%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.18),
        transparent
    );
    transform: skewX(-18deg);
    transition: left 0.55s ease;
    pointer-events: none;
}

.btn:hover::after {
    left: 140%;
}

/* Press glow — expands from center on click */
.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.12) 45%, transparent 70%);
    opacity: 0;
    pointer-events: none;
    transition: none;
}

.btn:active::before {
    animation: press-glow 0.45s ease-out forwards;
}

@keyframes press-glow {
    0%   { opacity: 1; transform: scale(0.3); }
    40%  { opacity: 0.9; }
    100% { opacity: 0; transform: scale(2.6); }
}

/* Primary variant */
.btn-primary {
    background: linear-gradient(135deg, #7c3aed 0%, #c026d3 100%);
    color: #fff;
    box-shadow: 0 4px 24px rgba(124, 58, 237, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 8px 36px rgba(124, 58, 237, 0.55), 0 0 0 1px rgba(192, 38, 211, 0.35);
}

.btn-primary:active {
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.4);
}

/* Secondary variant */
.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #d1d5db;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    color: #f3f4f6;
}

.btn-secondary:active {
    background: rgba(255, 255, 255, 0.06);
    box-shadow: none;
}


@keyframes fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── App loader ─────────────────────────────────────────────── */

#app-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b0d13;
    transition: opacity 0.35s ease-out;
}

#app-loader.hide {
    opacity: 0;
    pointer-events: none;
}

#app-loader .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: rgba(139, 92, 246, 0.8);
    border-radius: 50%;
    animation: loader-spin 0.7s linear infinite;
}

@keyframes loader-spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse-border {
    0%, 100% { border-color: rgba(139, 92, 246, 0.3); }
    50% { border-color: rgba(139, 92, 246, 0.7); }
}

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

.animate-fade-in {
    animation: fade-in 0.4s ease-out;
}

.drop-zone-idle {
    animation: pulse-border 3s ease-in-out infinite;
}

#drop-zone {
    transform-origin: center;
}

.drop-hover-hint {
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 10px);
    transition:
        opacity 0.18s ease,
        visibility 0.18s ease,
        transform 0.18s ease;
}

.drop-zone-drag-active {
    animation: none;
    border-color: rgba(52, 211, 153, 0.85) !important;
    background:
        radial-gradient(circle at top, rgba(16, 185, 129, 0.18), transparent 58%),
        rgba(16, 185, 129, 0.08) !important;
    box-shadow:
        0 0 0 1px rgba(52, 211, 153, 0.18),
        0 24px 70px rgba(16, 185, 129, 0.18);
    transform: translateY(-4px) scale(1.015);
}

.drop-zone-drag-active > svg {
    color: rgb(110, 231, 183);
    transform: scale(1.12);
}

.drop-zone-drag-active p[data-i18n="dropTitle"] {
    color: rgb(236, 253, 245);
}

.drop-zone-drag-active p[data-i18n="dropSubtitle"] {
    color: rgb(167, 243, 208);
}

.drop-zone-drag-active .drop-hover-hint {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.progress-bar-shimmer {
    background: linear-gradient(
        90deg,
        rgba(139, 92, 246, 1) 0%,
        rgba(167, 139, 250, 1) 50%,
        rgba(139, 92, 246, 1) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s linear infinite;
}

.progress-bar-indeterminate {
    width: 30% !important;
    animation:
        shimmer 1.5s linear infinite,
        progress-indeterminate 1.2s ease-in-out infinite;
    transform: translateX(-120%);
    will-change: transform;
}

@keyframes progress-indeterminate {
    0% {
        transform: translateX(-120%);
    }
    100% {
        transform: translateX(320%);
    }
}

/* Smooth transitions for panels */
#file-info,
#settings-panel,
#progress-panel,
#result-panel,
#error-panel {
    animation: fade-in 0.3s ease-out;
}

/* Custom select styling */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2.5rem;
}

/* Glassmorphism card effect */
.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ── Trim range slider ──────────────────────────────────────── */
.trim-range-input {
    height: 1.25rem; /* 20px — gives enough click area */
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    pointer-events: none; /* re-enabled per-thumb below */
}

/* Thumb: re-enable pointer events and center on the 6px track.
   WebKit formula: margin-top = -(thumbHeight - trackHeight) / 2 = -(18 - 6) / 2 = -6px */
.trim-range-input::-webkit-slider-thumb {
    pointer-events: all;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -6px;
    border-radius: 50%;
    background: #a78bfa;
    border: 2px solid #1e1b4b;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.4);
    cursor: ew-resize;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.trim-range-input::-webkit-slider-thumb:hover {
    background: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.3);
}

/* Track: hide — we draw our own fill bar */
.trim-range-input::-webkit-slider-runnable-track {
    background: transparent;
    height: 6px;
}

/* ── Batch file list scrollbar ───────────────────────────────── */
#batch-file-list::-webkit-scrollbar {
    width: 4px;
}

#batch-file-list::-webkit-scrollbar-track {
    background: transparent;
}

#batch-file-list::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.25);
    border-radius: 9999px;
}

#batch-file-list::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.55);
}

/* Shake animation – used to highlight missing output folder */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15%       { transform: translateX(-6px); }
    30%       { transform: translateX(5px); }
    45%       { transform: translateX(-4px); }
    60%       { transform: translateX(3px); }
    75%       { transform: translateX(-2px); }
    90%       { transform: translateX(1px); }
}

.shake {
    animation: shake 0.45s ease-in-out;
}

/* ── Preset icons (SVG via CSS mask for currentColor support) ── */
.preset-icon-mask {
    display: block;
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

/* ── Preset card description — clamp to 2 lines ── */
.preset-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
