/* ── Video Transcriber — Premium Dark Theme ──────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    
    --text-primary: #f0f0f5;
    --text-secondary: #8a8a9a;
    --text-muted: #55556a;
    
    --accent-primary: #7c5cff;
    --accent-secondary: #5b8def;
    --accent-gradient: linear-gradient(135deg, #7c5cff, #5b8def);
    --accent-glow: rgba(124, 92, 255, 0.3);
    
    --success: #34d399;
    --warning: #fbbf24;
    --error: #f87171;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

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

/* ── Background Effects ──────────────────────────────────────────────── */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-gradient::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(124, 92, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(91, 141, 239, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(124, 92, 255, 0.03) 0%, transparent 70%);
    animation: bgPulse 15s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% { transform: scale(1) rotate(0deg); }
    100% { transform: scale(1.1) rotate(5deg); }
}

/* ── Container ───────────────────────────────────────────────────────── */
.container {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ── Header ──────────────────────────────────────────────────────────── */
.header {
    text-align: center;
    margin-bottom: 48px;
}

.header-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: var(--accent-gradient);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 24px var(--accent-glow);
    animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
}

/* ── Glass Card ──────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
    margin-bottom: 24px;
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.12);
}

/* ── Drop Zone ───────────────────────────────────────────────────────── */
.drop-zone {
    border: 2px dashed rgba(124, 92, 255, 0.3);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent-primary);
    transform: scale(1.01);
}

.drop-zone:hover::before,
.drop-zone.drag-over::before {
    opacity: 0.05;
}

.drop-zone-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
    filter: grayscale(0.3);
    transition: var(--transition);
}

.drop-zone:hover .drop-zone-icon {
    transform: scale(1.1);
    filter: grayscale(0);
}

.drop-zone-text {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 8px;
}

.drop-zone-text strong {
    color: var(--accent-primary);
    cursor: pointer;
}

.drop-zone-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.drop-zone.hidden {
    display: none;
}

#file-input {
    display: none;
}

/* ── File Info ────────────────────────────────────────────────────────── */
.file-info {
    display: none;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(124, 92, 255, 0.06);
    border: 1px solid rgba(124, 92, 255, 0.15);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.file-info.visible {
    display: flex;
}

.file-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 2px;
}

.file-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.file-remove:hover {
    color: var(--error);
    background: rgba(248, 113, 113, 0.1);
}

/* ── Upload Button ───────────────────────────────────────────────────── */
.btn-upload {
    display: none;
    width: 100%;
    padding: 16px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.btn-upload.visible {
    display: block;
}

.btn-upload:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

.btn-upload:active:not(:disabled) {
    transform: translateY(0);
}

.btn-upload:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Progress Section ────────────────────────────────────────────────── */
.progress-section {
    display: none;
}

.progress-section.visible {
    display: block;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-label {
    font-weight: 500;
    font-size: 0.9rem;
}

.progress-value {
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.progress-bar-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

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

.progress-message {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-message .spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(124, 92, 255, 0.3);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Result Section ──────────────────────────────────────────────────── */
.result-section {
    display: none;
}

.result-section.visible {
    display: block;
    animation: fadeUp 0.5s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.result-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.result-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
}

.result-meta-item span {
    color: var(--text-primary);
    font-weight: 500;
}

.transcript-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.92rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.transcript-box::-webkit-scrollbar {
    width: 6px;
}

.transcript-box::-webkit-scrollbar-track {
    background: transparent;
}

.transcript-box::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.transcript-box::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── Action Buttons ──────────────────────────────────────────────────── */
.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-action {
    flex: 1;
    min-width: 120px;
    padding: 12px 16px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-action:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.btn-action.primary {
    background: var(--accent-gradient);
    border: none;
    color: white;
}

.btn-action.primary:hover {
    box-shadow: 0 4px 16px var(--accent-glow);
}

/* ── Status Badge ────────────────────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.success {
    background: rgba(52, 211, 153, 0.1);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.status-badge.error {
    background: rgba(248, 113, 113, 0.1);
    color: var(--error);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

/* ── Error Section ───────────────────────────────────────────────────── */
.error-section {
    display: none;
    padding: 16px;
    background: rgba(248, 113, 113, 0.06);
    border: 1px solid rgba(248, 113, 113, 0.15);
    border-radius: var(--radius-md);
    color: var(--error);
    font-size: 0.9rem;
}

.error-section.visible {
    display: block;
    animation: fadeUp 0.3s ease;
}

/* ── New Transcription Button ────────────────────────────────────────── */
.btn-new {
    display: none;
    width: 100%;
    padding: 14px;
    margin-top: 16px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-new.visible {
    display: block;
}

.btn-new:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    background: rgba(124, 92, 255, 0.04);
}

/* ── Footer ──────────────────────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 24px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .container {
        padding: 24px 16px;
    }

    .card {
        padding: 20px;
    }

    .drop-zone {
        padding: 32px 16px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .actions {
        flex-direction: column;
    }

    .btn-action {
        min-width: auto;
    }
}
