/* Design System Tokens */
:root {
    --bg-dark: #0b0f19;
    --card-bg: rgba(17, 24, 39, 0.65);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --gradient-primary: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

/* Dynamic Radial Glow Background */
.glow-bg {
    position: absolute;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 140%;
    background: radial-gradient(circle at 60% 30%, rgba(6, 182, 212, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 20% 70%, rgba(59, 130, 246, 0.08) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

header .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

header h1 {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header .subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Main Grid Layout */
.grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

/* Cards (Glassmorphism) */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1rem;
}

/* Form Styling */
form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

textarea {
    width: 100%;
    height: 180px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.875rem;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

/* Tabs */
.tab-group {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1.25rem;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
    font-weight: 500;
}

.hidden {
    display: none !important;
}

/* File Zone */
.file-dropzone {
    border: 2px dashed var(--card-border);
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.file-dropzone:hover {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.03);
}

.file-dropzone svg {
    color: var(--text-secondary);
}

.file-dropzone p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.file-dropzone .highlight {
    color: var(--accent-cyan);
    font-weight: 500;
}

.file-dropzone .file-name {
    font-size: 0.85rem;
    color: var(--accent-blue);
    font-family: monospace;
    word-break: break-all;
}

/* Searchable Select */
.searchable-select {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#voice-search {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
}

#voice-search:focus {
    border-color: var(--accent-cyan);
}

select {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

/* Sliders Grid */
.sliders-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-cyan);
    cursor: pointer;
    transition: transform 0.1s ease;
}

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

#gap-input {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    width: 100%;
    outline: none;
}

/* Buttons */
.btn-primary {
    background: var(--gradient-primary);
    color: #0b0f19;
    border: none;
    border-radius: 8px;
    padding: 1rem;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 0.875rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    justify-content: center;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-secondary);
}

/* Spinner Loader */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(11, 15, 25, 0.2);
    border-top-color: #0b0f19;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Placeholder Box */
.placeholder-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 5rem 2rem;
    text-align: center;
    color: var(--text-secondary);
    border: 1px dashed rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    flex-grow: 1;
}

.placeholder-state svg {
    color: rgba(255, 255, 255, 0.15);
}

.placeholder-state p {
    font-size: 0.95rem;
}

/* Output Box & Player */
.output-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.outputs-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-height: 700px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.output-item-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: box-shadow 0.2s ease;
}

.output-item-card:hover {
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.05);
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.75rem;
}

.output-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-cyan);
    word-break: break-all;
}

.output-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.output-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.actions-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.accordion-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s ease;
}

.accordion-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

.accordion-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: max-height 0.3s ease;
}

/* Subtitle Preview Monitor */
.subtitles-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.subtitles-section h3 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.subtitles-list {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    max-height: 250px;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.subtitle-item {
    padding: 0.75rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    line-height: 1.4;
}

.subtitle-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.subtitle-item.active {
    background: rgba(6, 182, 212, 0.06);
    border-left-color: var(--accent-cyan);
    color: #fff;
    font-weight: 500;
}

.subtitle-item .time {
    display: block;
    font-size: 0.75rem;
    color: var(--accent-blue);
    margin-bottom: 0.25rem;
}

.progress-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* Progress Bar Styling */
.progress-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: opacity 0.5s ease, transform 0.5s ease;
    opacity: 1;
    transform: translateY(0);
}

.progress-container.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

.progress-bar-wrapper {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

/* Custom Searchable Dropdown */
.voice-dropdown-list {
    position: absolute;
    top: 105%;
    left: 0;
    right: 0;
    background: #0f172a;
    border: 1px solid var(--accent-cyan);
    border-radius: 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.voice-dropdown-list.hidden {
    display: none;
}

.voice-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.2s ease;
    text-align: left;
}

.voice-item:hover {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
}

.voice-item.selected {
    background: rgba(6, 182, 212, 0.15);
    border-left: 3px solid var(--accent-cyan);
    font-weight: 500;
}

