:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: radial-gradient(circle at top right, #1e1b4b, #0f172a);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.container {
    width: 100%;
    max-width: 900px;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    background: rgba(15, 23, 42, 0.5);
    padding: 0.5rem;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.content-section {
    display: none;
    animation: slideIn 0.4s ease-out;
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

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

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

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

textarea,
input[type="text"],
select {
    width: 100%;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

textarea:focus,
input[type="text"]:focus,
select:focus {
    border-color: var(--primary);
}

.file-input-wrapper {
    position: relative;
    width: 100%;
    height: 100px;
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
}

.file-input-wrapper:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.file-input-wrapper input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-label {
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.btn-generate {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 1rem;
}

.btn-generate:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.5);
}

.btn-generate:disabled {
    background: #475569;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.result-area {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
    display: none;
}

.audio-player {
    width: 100%;
    margin-top: 1rem;
}

.loader {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-top: 1.5rem;
    min-height: 100px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: main-spin 1s linear infinite;
    display: inline-block;
}

/* Field Specific Loader */
.input-wrapper {
    position: relative;
    width: 100%;
}

.field-loader {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: field-spin 0.8s linear infinite;
    display: none;
}

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

@keyframes field-spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

input.loading-field {
    padding-right: 40px;
}

/* Language Switcher */
.lang-switcher {
    position: absolute;
    top: 1.5rem;
    right: 2.5rem;
    z-index: 100;
}

.lang-toggle {
    position: relative;
    display: flex;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 3px;
    width: 100px;
    height: 38px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.lang-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    background: linear-gradient(135deg, var(--primary), #c084fc);
    border-radius: 11px;
    transition: transform 0.4s cubic-bezier(0.68, -0.6, 0.32, 1.6);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.lang-btn {
    position: relative;
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    z-index: 2;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
}

.lang-btn:active {
    transform: scale(0.95);
}

.lang-btn.active {
    color: white;
}

.lang-toggle.en-active .lang-slider {
    transform: translateX(100%);
}

.lang-btn:hover:not(.active) {
    color: var(--text-main);
}

/* Modern Recording UI - Mic Icon Style */
.record-container {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    margin-bottom: 1.5rem;
    width: fit-content;
}

.record-btn-new {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.record-btn-new i {
    width: 24px;
    height: 24px;
    color: white;
    stroke-width: 2.5;
}

.record-btn-new:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.record-btn-new.recording {
    background: linear-gradient(135deg, #ef4444, #f87171);
    animation: pulse-glow 1.5s infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
    }

    50% {
        box-shadow: 0 4px 24px rgba(239, 68, 68, 0.8), 0 0 40px rgba(239, 68, 68, 0.4);
    }
}

.record-status-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.record-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    transition: color 0.3s ease;
}

.record-btn-new.recording+.record-status-group .record-label {
    color: #ef4444;
}

.record-timer {
    font-family: 'Inter', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* OAuth Auth Section */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    min-height: 45px;
    /* Prevent layout jitter */
}

.auth-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hf-login-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #FF9D00, #FFB84D);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 157, 0, 0.3);
}

.hf-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 157, 0, 0.4);
}

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

.service-status {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #22c55e;
    cursor: help;
}

.status-pulse {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(34, 197, 94, 0.4);
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.status-tier {
    padding-left: 0.5rem;
    border-left: 1px solid rgba(34, 197, 94, 0.3);
    color: rgba(34, 197, 94, 0.8);
}

.status-tooltip {
    position: absolute;
    top: 130%;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    padding: 0.75rem;
    background: #1e293b;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 400;
    line-height: 1.4;
    text-align: center;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
}

.service-status:hover .status-tooltip {
    opacity: 1;
    visibility: visible;
    top: 120%;
}

.user-badge {
    padding: 0.4rem 0.8rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--primary);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.logout-btn {
    padding: 0.4rem 0.8rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    border-radius: 6px;
    color: #ef4444;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: #ef4444;
    color: white;
}

/* Login Wall Overlay */
.login-wall {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.4s ease;
    opacity: 1;
}

.login-content {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 4rem;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.6);
}

.login-content h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

.login-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

.hf-login-btn-large {
    width: 100%;
    padding: 1.2rem;
    background: linear-gradient(135deg, #FF9D00, #FFB84D);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px -5px rgba(255, 157, 0, 0.4);
    margin-bottom: 2rem;
}

.hf-login-btn-large:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px -5px rgba(255, 157, 0, 0.6);
}

.login-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-main);
}

.feature-item i {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

/* Quota Display */
.quota-info {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 1rem;
    padding-right: 1rem;
    border-right: 1px solid var(--glass-border);
}

.quota-count {
    color: var(--primary);
    font-weight: 800;
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 400px;
    padding: 1rem 1.25rem;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.4s cubic-bezier(0.7, 0, 0.84, 0) forwards;
    animation-delay: 0s, 3s;
}

.toast.success {
    border-left: 4px solid #22c55e;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.info {
    border-left: 4px solid var(--primary);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(20%) scale(0.9);
    }
}