:root {
    --bg-base: #0f111a;
    --bg-surface: rgba(25, 28, 41, 0.6);
    --bg-surface-hover: rgba(35, 39, 56, 0.8);
    --primary: #6d28d9;
    --primary-hover: #7c3aed;
    --primary-glow: rgba(109, 40, 217, 0.5);
    --secondary: #3b82f6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --border: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

/* Dynamic Background Orbs */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: #0f111a;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    animation: float 20s infinite alternate ease-in-out;
}

.orb-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    animation-delay: 0s;
}

.orb-2 {
    bottom: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
    animation-delay: -5s;
}

.orb-3 {
    top: 40%;
    left: 50%;
    width: 30vw;
    height: 30vw;
    background: radial-gradient(circle, #db2777 0%, transparent 70%);
    animation-delay: -10s;
    opacity: 0.3;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(5%, 10%) scale(1.1); }
    100% { transform: translate(-5%, -5%) scale(0.9); }
}

/* Layout container */
.app-container {
    width: 100%;
    max-width: 800px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
header {
    text-align: center;
    animation: fadeInDown 0.8s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.logo i {
    color: var(--primary-hover);
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.logo h1 {
    font-weight: 700;
    letter-spacing: -1px;
}

.logo span {
    color: transparent;
    background: linear-gradient(135deg, var(--primary-hover), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 300;
}

/* Glass Panels */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
    animation: fadeInUp 0.8s ease-out;
}

.glass-panel:hover {
    border-color: var(--border-highlight);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, var(--primary-glow) 0%, transparent 60%);
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary);
    background: rgba(109, 40, 217, 0.1);
}

.upload-area:hover::before, .upload-area.dragover::before {
    opacity: 0.15;
}

.upload-icon {
    font-size: 3.5rem;
    color: var(--primary-hover);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.upload-area:hover .upload-icon {
    transform: translateY(-5px);
    color: var(--secondary);
}

.upload-area h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.upload-area p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.browse-text {
    color: var(--primary-hover);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.file-limits {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    background: rgba(0,0,0,0.3);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: inline-flex;
}

.file-limits i {
    margin-right: 0.4rem;
}

/* File Preview */
.file-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-top: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-icon {
    font-size: 1.8rem;
    color: var(--secondary);
}

.file-details {
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 500;
    font-size: 1.1rem;
}

.file-size {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Buttons */
.primary-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    box-shadow: 0 4px 15px var(--primary-glow);
    font-family: 'Outfit', sans-serif;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

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

.primary-btn.small {
    width: auto;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    margin-top: 0;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    font-family: 'Outfit', sans-serif;
}

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

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--danger);
}

/* Processing Section */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 0;
    text-align: center;
}

.ai-loader {
    width: 80px;
    height: 80px;
    position: relative;
    margin-bottom: 2rem;
}

.ai-loader .circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
}

.ai-loader .circle:nth-child(1) {
    border-top-color: var(--primary);
    animation: spin 1.5s linear infinite;
}

.ai-loader .circle:nth-child(2) {
    border-right-color: var(--secondary);
    animation: spin 2s linear infinite reverse;
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
}

.ai-loader .circle:nth-child(3) {
    border-bottom-color: #db2777;
    animation: spin 2.5s linear infinite;
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
}

.ai-loader .circle:nth-child(4) {
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    width: 40%;
    height: 40%;
    top: 30%;
    left: 30%;
    animation: pulse 1.5s ease-in-out infinite alternate;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(1.2); opacity: 1; }
}

.processing-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--text-main), var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Results Section */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.result-header h2 {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.text-success {
    color: var(--success);
}

.lang-badge {
    background: rgba(59, 130, 246, 0.15);
    color: var(--secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    font-family: 'Outfit', sans-serif;
    transform: translateY(1px);
}

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

.tab-btn.active {
    color: var(--primary-hover);
    border-bottom-color: var(--primary-hover);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

/* Captions List */
.captions-container {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.captions-container::-webkit-scrollbar {
    width: 6px;
}
.captions-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}
.captions-container::-webkit-scrollbar-thumb {
    background: var(--border-highlight);
    border-radius: 4px;
}
.captions-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.caption-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 0.8rem;
    transition: var(--transition);
    border: 1px solid transparent;
}

.caption-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border);
    transform: translateX(4px);
}

.caption-ts {
    font-family: monospace;
    color: var(--primary-hover);
    font-size: 0.9rem;
    font-weight: 600;
    padding-top: 0.2rem;
    min-width: 50px;
}

.caption-text {
    flex: 1;
    line-height: 1.5;
    font-size: 1.05rem;
}

/* Full Text */
.full-text-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    line-height: 1.8;
    font-size: 1.1rem;
    max-height: 400px;
    overflow-y: auto;
}

.full-text-container::-webkit-scrollbar {
    width: 6px;
}
.full-text-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}
.full-text-container::-webkit-scrollbar-thumb {
    background: var(--border-highlight);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-surface-hover);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    border: 1px solid var(--border-highlight);
    z-index: 1000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast i {
    color: var(--primary-hover);
}

.toast.error i {
    color: var(--danger);
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

/* Responsive */
@media (max-width: 600px) {
    .glass-panel {
        padding: 1.5rem;
    }
    .action-bar {
        justify-content: center;
    }
    .secondary-btn {
        flex: 1;
        justify-content: center;
    }
    .result-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* API Settings */
.api-settings {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    transition: var(--transition);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-hover);
    box-shadow: 0 0 0 2px var(--primary-glow);
}
