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

:root {
    /* Premium Dark Palette - "Midnight Nebula" */
    --bg-core: #030712;
    /* Rich black-blue */
    --bg-surface: #0f172a;
    /* Slate 900 */
    --bg-surface-glass: rgba(15, 23, 42, 0.7);

    --primary-400: #38bdf8;
    /* Sky Blue */
    --primary-500: #0ea5e9;
    --primary-glow: rgba(56, 189, 248, 0.4);

    --accent-pink: #f472b6;
    --accent-purple: #a855f7;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-active: rgba(56, 189, 248, 0.3);

    --success: #10b981;
    --grad-main: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
    --grad-surface: linear-gradient(145deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.7) 100%);

    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px -10px rgba(56, 189, 248, 0.15);
}

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

body {
    background-color: var(--bg-core);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
    /* Tech-focused font */
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* --- Ambient Background System --- */
.app-wrapper {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

.grid-pattern {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
    pointer-events: none;
    z-index: 0;
}

.ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    z-index: 0;
    animation: floatOrb 10s ease-in-out infinite;
}

.orb-1 {
    top: -10%;
    left: 20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-purple), transparent 70%);
}

.orb-2 {
    bottom: 10%;
    right: 10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--primary-500), transparent 70%);
    animation-delay: -5s;
}

@keyframes floatOrb {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, -30px);
    }
}

/* --- Container & Layout --- */
.container {
    position: relative;
    z-index: 10;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- Header Designs --- */
.header {
    text-align: center;
    margin-bottom: 3.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.badge-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    padding: 0.4rem 1rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-400);
    letter-spacing: 1px;
    text-transform: uppercase;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-group h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
}

.text-gradient {
    background: var(--grad-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 400;
    max-width: 500px;
}

/* --- Main Card Glassmorphism --- */
.card {
    width: 100%;
    background: var(--grad-surface);
    border: 1px solid var(--border-subtle);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    /* Top Highlight */
    border-radius: 24px;
    padding: 2px;
    /* For Inner border logic if needed, or just padding */
    padding: 2rem;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

/* Decorative top glow line */
.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-400), transparent);
    background-clip: padding-box;
    -webkit-background-clip: padding-box;
    /* Fix compatibility */
    opacity: 0.5;
}

/* --- Input Area --- */
.text-area-wrapper {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.text-area-wrapper:focus-within {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15);
    background: rgba(0, 0, 0, 0.3);
}

/* --- Input Header Grid (Restored) --- */
.input-header-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Enforce 3 columns */
    gap: 1.5rem;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

@media (max-width: 900px) {
    .input-header-grid {
        grid-template-columns: repeat(1, 1fr);
        /* Stack conveniently on mobile */
    }
}

.control-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.75rem;
    height: 100%;
}

.control-label {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-main);
}

.badge-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* --- Interactive Mode Buttons --- */
.mode-btn {
    cursor: pointer;
    position: relative;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: rgba(56, 189, 248, 0.08);
    /* Light blue tint */
    border-color: var(--primary-400);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
}

/* Mic specific active animation */
.mode-btn.pulse-active {
    border-color: #ef4444;
    /* Red border */
    background: rgba(239, 68, 68, 0.1);
    animation: pulseBorder 1.5s infinite;
}

@keyframes pulseBorder {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

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

.mic-status-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-400);
    font-weight: 600;
    margin-top: 0.5rem;
}

.active .mic-status-row {
    color: var(--primary-500);
}

.pulse-active .mic-status-row {
    color: #ef4444;
}

/* Hide redundant badge row */
.badge-row {
    margin-bottom: 0.5rem;
}

.control-info {
    display: flex;
    flex-direction: column;
}

.info-title {
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: 600;
}

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

/* Action Button (Mic) */
.action-btn {
    width: 100%;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    color: var(--primary-400);
    padding: 0.6rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
}

.action-btn.recording {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
    animation: pulseMic 1.5s infinite;
}

/* Enhanced Badges */
.option-badge {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.option-badge::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

/* Specific Colors for Dots */
.option-badge:first-child {
    color: var(--text-main);
}

/* Option 1 */
.option-badge:first-child::before {
    background-color: var(--primary-400);
    box-shadow: 0 0 8px var(--primary-400);
}

.option-badge.option-2-badge {
    color: var(--accent-pink);
}

.option-badge.option-2-badge::before {
    background-color: var(--accent-pink);
    box-shadow: 0 0 8px var(--accent-pink);
}

.option-badge.option-3-badge {
    color: var(--accent-purple);
}

.option-badge.option-3-badge::before {
    background-color: var(--accent-purple);
    box-shadow: 0 0 8px var(--accent-purple);
}


/* Toggle Switch Redesign (Larger) */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    /* Increased from 44px */
    height: 34px;
    /* Increased from 24px */
    border: none;
    outline: none;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 34px;
    /* Rounded */
    border: 1px solid var(--border-subtle);
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    /* Increased from 16px */
    width: 26px;
    /* Increased from 16px */
    left: 4px;
    bottom: 3px;
    background-color: #cbd5e1;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: var(--accent-pink);
    border-color: var(--accent-pink);
}

input:checked+.slider:before {
    background-color: white;
    transform: translateX(26px);
    /* Adjusted for new width */
}

/* Ensure no artifacts on the right */
.badge-row {
    border-right: none !important;
}

/* Text Area */
.textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-size: 1.15rem;
    line-height: 1.7;
    min-height: 150px;
    resize: vertical;
    font-family: 'Noto Sans Telugu', sans-serif;
    outline: none;
}

.textarea::placeholder {
    color: rgba(148, 163, 184, 0.4);
}

/* Bottom Bar */
.input-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-subtle);
}

.char-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
}

/* --- Voice Selection --- */
.voice-selection-bar {
    margin: 2rem 0;
}

.voice-group {
    width: 100%;
}

.voice-label-text {
    display: block;
    margin-bottom: 0.8rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.voice-pills {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Fixed Grid */
    gap: 1rem;
}

.voice-pill {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.voice-pill:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.voice-pill.selected {
    background: rgba(56, 189, 248, 0.1);
    border-color: var(--primary-500);
    box-shadow: 0 4px 20px -5px rgba(56, 189, 248, 0.2);
}

.pill-icon {
    font-size: 1.5rem;
}

.pill-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

/* --- Universal Link Button --- */
.universal-link-btn {
    display: block;
    width: 100%;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(56, 189, 248, 0.05);
    /* Very light blue tint */
    border: 1px dashed var(--primary-400);
    border-radius: 12px;
    color: var(--primary-400);
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
}

.universal-link-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.1);
}

.universal-btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

/* --- Generate Button (The Hero Action) --- */
.generate-btn {
    width: 100%;
    padding: 1.2rem;
    background: var(--grad-main);
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 10px 30px -5px rgba(56, 189, 248, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.generate-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 40px -5px rgba(56, 189, 248, 0.6);
}

.generate-btn:active {
    transform: scale(0.98);
}

/* Button Shine Effect */
.generate-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
}

.generate-btn:hover::after {
    left: 150%;
    transition: 0.7s ease-in-out;
}

/* Loader */
.btn-loader {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

.generate-btn.loading .btn-text,
.generate-btn.loading .btn-icon {
    display: none;
}

.generate-btn.loading .btn-loader {
    display: block;
}

/* --- Status & Audio Player --- */
.status-message {
    text-align: center;
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    display: none;
}

.status-message.show {
    display: block;
    animation: slideIn 0.3s ease;
}

.status-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-message.loading {
    background: rgba(56, 189, 248, 0.1);
    color: #7dd3fc;
}

.audio-player {
    margin-top: 2.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-active);
    border-radius: 16px;
    padding: 1.5rem;
    animation: fadeIn 0.6s ease-out;
}

.audio-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--primary-400);
    font-weight: 600;
}

#audio {
    width: 100%;
    height: 40px;
    margin-bottom: 1rem;
    filter: invert(0.9) hue-rotate(180deg);
    /* Dark mode audio player hack */
    border-radius: 8px;
    opacity: 0.8;
}

.download-btn {
    width: 100%;
    padding: 1rem;
    background: transparent;
    border: 1px solid var(--success);
    color: var(--success);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.download-btn:hover {
    background: var(--success);
    color: #000;
}

/* --- Features Grid --- */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 4rem;
}

.feature-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.1);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
}

.feature-card h3 {
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

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

/* --- Footer --- */
.footer {
    margin-top: auto;
    padding: 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
}

/* Animations */
@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes pulseMic {
    0% {
        opacity: 0.1;
    }

    50% {
        opacity: 0.3;
    }

    100% {
        opacity: 0.1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .logo-group h1 {
        font-size: 2.5rem;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .voice-pills {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 1.5rem 1rem;
    }
}
/* --- Voice Cloning Studio & Debug Terminal --- */
.cloning-studio {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    backdrop-filter: blur(10px);
}

.studio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.studio-title {
    font-weight: 700;
    color: #e2e8f0;
    font-size: 1.1rem;
}

.studio-badge {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.studio-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

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

.control-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: 500;
}

.file-upload-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.file-input {
    font-size: 100px;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
}

.file-label {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(30, 41, 59, 0.8);
    border: 2px dashed #475569;
    border-radius: 8px;
    padding: 12px;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.3s;
}

.file-label:hover {
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
}

.studio-input {
    width: 100%;
    padding: 12px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid #475569;
    border-radius: 8px;
    color: white;
    font-family: inherit;
}

.studio-input:focus {
    outline: none;
    border-color: #a855f7;
}

.hint {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #64748b;
}

/* Debug Terminal */
.debug-terminal {
    background: #0f172a;
    border-radius: 8px;
    border: 1px solid #334155;
    font-family: 'Fira Code', 'Courier New', monospace;
    overflow: hidden;
    margin-top: 15px;
}

.terminal-header {
    background: #1e293b;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: #94a3b8;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}

.terminal-body {
    padding: 12px;
    height: 150px;
    overflow-y: auto;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-line {
    display: flex;
    gap: 8px;
}

.log-time { color: #64748b; font-size: 0.75rem; }
.log-info { color: #cbd5e1; }
.log-success { color: #4ade80; }
.log-warning { color: #facc15; }
.log-error { color: #f87171; }
.log-cmd { color: #a855f7; font-weight: bold; }

