:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #64748b;
    --background: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --radius: 0.75rem;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --card: #1e293b;
        --text: #f1f5f9;
        --text-muted: #94a3b8;
        --border: #334155;
    }
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Auth Layout */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    text-align: center;
}

.login-card {
    background: var(--card);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 450px;
    width: 100%;
}

.login-logo {
    width: 100px;
    height: 100px;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
}

/* Main Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 100;
}

.content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.content-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-header {
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-header .logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.nav-items {
    list-style: none;
    padding: 0 1rem;
    flex: 1;
}

.nav-items li {
    margin-bottom: 0.5rem;
}

.nav-items a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-items li.active a,
.nav-items a:hover {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.nav-footer {
    padding: 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.logout-link {
    color: var(--error);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

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

.btn-secondary {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.btn-secondary:hover {
    background: rgba(79, 70, 229, 0.2);
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
}

select,
input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    font-size: 1rem;
}

/* Views */
.view.hidden {
    display: none;
}

/* Glassmorphism accent */
.card-glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@media (prefers-color-scheme: dark) {
    .card-glass {
        background: rgba(30, 41, 59, 0.7);
    }
}

/* History & Audio */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.history-item {
    background: var(--card);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.history-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-date {
    font-weight: 600;
}

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

.history-status {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    background: var(--border);
    width: fit-content;
    font-weight: 700;
    text-transform: uppercase;
}

.status-completed {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-failed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.status-processing {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.audio-player {
    width: 100%;
    margin: 1.5rem 0;
    height: 40px;
}

/* Job Metadata & Management */
.job-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0.5rem 0 1.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.result-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.redo-section {
    background: rgba(79, 70, 229, 0.03);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--primary);
    margin-bottom: 2rem;
    animation: slideDown 0.3s ease-out;
}

.redo-section h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.settings-card {
    background: var(--card);
    padding: 2.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    max-width: 600px;
    margin: 0 auto;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem;
}

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

/* Responsive side nav toggle */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }
}