/* CẤU HÌNH THIẾT KẾ HỆ THỐNG - DESIGN SYSTEM */
:root {
    --bg-dark: #090d16;
    --bg-gradient: radial-gradient(circle at 50% 50%, #151a30 0%, #070913 100%);
    --card-bg: rgba(16, 22, 42, 0.65);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-glow: rgba(99, 102, 241, 0.05);
    
    --accent-primary: #6366f1; /* Indigo */
    --accent-secondary: #a855f7; /* Purple */
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --accent-glow: rgba(99, 102, 241, 0.45);
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --success: #10b981;
    --error: #ef4444;
    
    --font-main: 'Outfit', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* DECORATIVE BACKGROUND BLOBS */
.decor-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 0;
    opacity: 0.15;
    pointer-events: none;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-primary);
    top: 10%;
    left: -10%;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-secondary);
    bottom: 10%;
    right: -10%;
}

/* APP CONTAINER */
.app-container {
    width: 100%;
    max-width: 720px;
    z-index: 1;
}

/* HEADER */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 0 10px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 2rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.3));
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo h1 span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* MAIN CARD (GLASSMORPHISM) */
.main-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 36px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 40px var(--card-glow);
    transition: var(--transition-smooth);
}

.main-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 50px rgba(99, 102, 241, 0.08);
}

/* FORM ELEMENTS */
.form-group {
    margin-bottom: 24px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

textarea {
    width: 100%;
    height: 140px;
    background: rgba(8, 12, 24, 0.7);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 18px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: var(--transition-smooth);
}

textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
    background: rgba(8, 12, 24, 0.85);
}

.char-counter {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* VOICE FILTERS SECTION */
.voice-filters {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
}

.filter-title {
    margin-bottom: 12px;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1.8fr 1fr 1fr;
    gap: 12px;
}

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

/* INPUTS WITH ICONS */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.input-with-icon input {
    width: 100%;
    padding: 12px 12px 12px 38px;
}

input[type="text"], input[type="password"], select {
    background: rgba(8, 12, 24, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-smooth);
    width: 100%;
}

select {
    padding: 12px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
}

input[type="text"]:focus, input[type="password"]:focus, select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
}

/* CONTROLS GRID */
.controls-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    margin-bottom: 24px;
}

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

/* SLIDER DESIGN */
.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 46px;
}

input[type="range"] {
    flex-grow: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-glow);
    transition: var(--transition-smooth);
}

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

.slider-badge {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #818cf8;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    min-width: 65px;
    text-align: center;
}

/* DELIVERY MODE (RADIO BUTTONS) */
.delivery-mode {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 14px 20px;
    border-radius: 12px;
}

.mode-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    user-select: none;
}

.radio-label input {
    display: none;
}

.radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    display: inline-block;
    position: relative;
    transition: var(--transition-smooth);
}

.radio-label input:checked + .radio-custom {
    border-color: var(--accent-primary);
}

.radio-label input:checked + .radio-custom::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* BUTTONS */
.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

.btn-icon:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.btn-submit {
    width: 100%;
    background: var(--accent-gradient);
    border: none;
    border-radius: 14px;
    padding: 16px;
    color: white;
    font-family: var(--font-main);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
    transition: var(--transition-smooth);
    overflow: hidden;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

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

.btn-submit:disabled {
    background: #1e293b;
    color: #475569;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* SETTINGS PANEL */
.settings-panel {
    background: rgba(13, 19, 38, 0.95);
    border: 1px solid var(--accent-primary);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 25px rgba(99, 102, 241, 0.2);
    animation: slideDown 0.3s ease-out forwards;
}

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

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

.settings-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #818cf8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

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

.settings-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.btn-save {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--accent-primary);
    color: #a5b4fc;
    padding: 10px 20px;
    border-radius: 10px;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    width: 100%;
    transition: var(--transition-smooth);
}

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

/* ALERTS & STATUSES */
.alert {
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.alert-icon {
    font-size: 1.2rem;
}

/* RESULTS SECTION (AUDIO PLAYER) */
.result-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--card-border);
    animation: fadeIn 0.4s ease-out forwards;
}

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

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

.result-header h4 {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-active {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #34d399;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.player-wrapper {
    background: rgba(8, 12, 24, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

audio {
    width: 100%;
    outline: none;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.btn-action {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-radius: 10px;
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition-smooth);
}

.btn-play-pause {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.btn-play-pause:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-download {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #a7f3d0;
}

.btn-download:hover {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

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

/* SPINNER */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

/* FOOTER */
.app-footer {
    text-align: center;
    margin-top: 30px;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.6;
}

.app-footer strong {
    color: var(--text-secondary);
}
