/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #121212;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
}

/* Typography */
h1, h3 { font-weight: 600; margin-bottom: 0.5rem; }
p { color: #9e9e9e; font-size: 0.875rem; }

/* Utilities */
.hidden { display: none !important; }

/* Glassmorphism Panel */
.glass-panel {
    background: rgba(30, 30, 30, 0.65);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 600px;
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}
.title {
    font-size: 1.875rem;
    background: linear-gradient(to right, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.subtitle {
    color: #9ca3af;
    font-size: 0.875rem;
}

/* State Transitions */
.state-panel {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}
.state-panel.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dropzone */
.dropzone {
    border: 2px dashed #4b5563;
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.dropzone:hover, .dropzone.dragover {
    border-color: #3b82f6;
    background: rgba(31, 41, 55, 0.5);
}
.icon-container {
    margin-bottom: 1rem;
}
.drop-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    color: #6b7280;
    transition: color 0.2s;
}
.dropzone:hover .drop-icon, .dropzone.dragover .drop-icon {
    color: #60a5fa;
}
.dropzone h3 {
    font-size: 1.125rem;
    color: #d1d5db;
}
.dropzone:hover h3, .dropzone.dragover h3 {
    color: #ffffff;
}
.dropzone p {
    color: #6b7280;
    margin-top: 0.5rem;
}

/* Configuration & File List */
.file-list-section { margin-bottom: 1.5rem; }
.file-list {
    max-height: 160px;
    overflow-y: auto;
    background: rgba(31, 41, 55, 0.5);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #374151;
}
.file-item {
    display: flex;
    flex-direction: column;
    font-size: 0.875rem;
    color: #d1d5db;
    margin-bottom: 0.75rem;
    background: #1f2937;
    padding: 0.75rem;
    border-radius: 6px;
}
.file-item:last-child { margin-bottom: 0; }
.file-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    width: 100%;
}
.file-info-main {
    display: flex;
    align-items: center;
    overflow: hidden;
}
.file-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
.btn-remove-file {
    background: transparent;
    color: #ef4444;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s;
}
.btn-trim-file, .btn-resize-file {
    background: transparent;
    color: #a78bfa;
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 4px;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-trim-file:hover, .btn-resize-file:hover {
    background: rgba(167, 139, 250, 0.1);
    color: #c4b5fd;
}
.file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 1rem;
}
.file-size {
    color: #6b7280;
    font-size: 0.75rem;
    flex-shrink: 0;
}
.file-progress-container {
    width: 100%;
    background: #374151;
    border-radius: 9999px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}
.file-progress-bar {
    height: 100%;
    background: linear-gradient(to right, #3b82f6, #a855f7);
    border-radius: 9999px;
    width: 0%;
    transition: width 0.2s ease;
}
.file-status {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.4); }

/* Format Selectors */
.config-section { display: flex; flex-direction: column; gap: 1.5rem; }
.format-selectors { display: flex; flex-direction: column; gap: 1rem; }
.format-group { display: flex; flex-direction: column; gap: 0.5rem; }
.format-group-label { font-size: 0.85rem; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.format-group-buttons { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.extract-audio .format-badge { border-color: #8b5cf6; color: #c4b5fd; }
.extract-audio .format-badge:hover { background: rgba(139, 92, 246, 0.15); border-color: #a78bfa; color: white; }
.extract-audio .format-badge.selected { background: #8b5cf6; border-color: #8b5cf6; color: white; box-shadow: 0 0 12px rgba(139, 92, 246, 0.6); }
.format-badge {
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    border: 1px solid #4b5563;
    background: #1f2937;
    color: #d1d5db;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    font-size: 0.875rem;
}
.format-badge:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.15);
}
.format-badge.selected {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
}

/* Select Input */
.select-input {
    width: 100%;
    background: #1f2937;
    border: 1px solid #4b5563;
    color: white;
    border-radius: 8px;
    padding: 0.75rem;
    outline: none;
    transition: border-color 0.2s;
    font-size: 1rem;
}
.select-input:focus { border-color: #3b82f6; }

/* Trim Selector */
.trim-selector {
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 1rem;
}
.trim-time-display {
    font-size: 0.85rem;
    color: #a78bfa;
    font-variant-numeric: tabular-nums;
}
/* Dual Range Slider */
.range-slider {
    position: relative;
    width: 100%;
    height: 30px;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
}
.range-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background: #374151;
    border-radius: 999px;
    z-index: 1;
}
.range-fill {
    position: absolute;
    height: 6px;
    background: #8b5cf6;
    border-radius: 999px;
    z-index: 2;
}
.range-slider input[type="range"] {
    position: absolute;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    z-index: 3;
    outline: none;
    margin: 0;
}
.range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #c4b5fd;
    border: 2px solid #8b5cf6;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
    transition: transform 0.1s;
}
.range-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
.range-slider input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #c4b5fd;
    border: 2px solid #8b5cf6;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
    transition: transform 0.1s;
}
.range-slider input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
}

/* Buttons */
button { border: none; font-family: inherit; font-size: 1rem; cursor: pointer; }
.btn-primary, .btn-success, .btn-secondary {
    width: 100%;
    padding: 1rem;
    font-weight: bold;
    border-radius: 12px;
    color: white;
    transition: all 0.2s ease;
}
.btn-primary {
    background: linear-gradient(to right, #2563eb, #9333ea);
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.39);
}
.btn-primary:hover { background: linear-gradient(to right, #3b82f6, #a855f7); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-success { background: #16a34a; box-shadow: 0 4px 14px 0 rgba(22, 163, 74, 0.39); }
.btn-success:hover { background: #22c55e; }
.btn-success:active { transform: scale(0.98); }

.btn-secondary { background: #374151; margin-top: 1rem; }
.btn-secondary:hover { background: #4b5563; }
.btn-secondary:active { transform: scale(0.98); }

/* Processing */
.process-header { text-align: center; margin-bottom: 1.5rem; }
.process-header h3 { color: white; font-size: 1.25rem; }
.progress-container {
    width: 100%;
    background: #374151;
    border-radius: 9999px;
    height: 1.5rem;
    margin-bottom: 2rem;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
}
.progress-text {
    position: absolute;
    width: 100%;
    text-align: center;
    line-height: 1.5rem;
    font-size: 0.85rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    z-index: 10;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(to right, #3b82f6, #a855f7);
    border-radius: 9999px;
    width: 0%;
    transition: width 0.3s ease;
}
.result-actions { display: flex; flex-direction: column; }

/* Overlays & Toasts */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    border-radius: 16px;
}
.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(239, 68, 68, 0.95);
    backdrop-filter: blur(8px);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.toast.show { opacity: 1; }

/* Footer & Privacy */
.footer-privacy {
    text-align: center;
    margin-top: 2rem;
    margin-bottom: 7rem; /* Ensure space for sticky ad */
}
.privacy-badge {
    background: rgba(16, 185, 129, 0.08);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.1);
}

/* Floating Coffee */
.floating-coffee {
    position: fixed;
    bottom: calc(90px + 1.5rem);
    right: 1.5rem;
    display: flex;
    align-items: center;
    background: rgba(30, 30, 30, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    text-decoration: none;
    border-radius: 9999px;
    padding: 0.5rem;
    transition: all 0.3s ease;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}
.floating-coffee .coffee-icon {
    font-size: 1.25rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.floating-coffee .coffee-text {
    font-size: 0.875rem;
    font-weight: 500;
    max-width: 0;
    opacity: 0;
    white-space: nowrap;
    transition: all 0.3s ease;
    display: block;
}
.floating-coffee:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
}
.floating-coffee:hover .coffee-text {
    max-width: 100px;
    opacity: 1;
    padding-right: 0.5rem;
}

/* Sticky Ad Container */
.sticky-ad-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    background: rgba(18, 18, 18, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 50;
}
.sticky-ad-container .ad-slot {
    width: 100%;
    max-width: 728px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4b5563;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: transparent;
    border-left: 1px dashed rgba(255, 255, 255, 0.05);
    border-right: 1px dashed rgba(255, 255, 255, 0.05);
}
