/* ===== VoiceGena — Premium TTS App Styles ===== */

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

/* ---- Inline SVG Icons ---- */
.icon {
    width: 1em; height: 1em;
    display: inline-block;
    vertical-align: -0.125em;
    fill: currentColor;
    flex-shrink: 0;
}
.icon.spin {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

:root {
    --brand-purple: #7c3aed;
    --brand-violet: #6d28d9;
    --brand-indigo: #4f46e5;
    --brand-pink:   #ec4899;
    --gradient: linear-gradient(135deg, #7c3aed 0%, #4f46e5 50%, #ec4899 100%);
    --bg:        #0f0f1a;
    --bg-card:   #1a1a2e;
    --bg-input:  #13131f;
    --border:    rgba(124, 58, 237, 0.25);
    --text:      #f1f0ff;
    --text-muted: #8b8aa8;
    --radius:    14px;
    --shadow:    0 8px 40px rgba(124,58,237,0.18);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Header ---- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15,15,26,0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-icon {
    width: 36px; height: 36px;
    background: var(--gradient);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #fff;
}
.logo-text { font-size: 20px; font-weight: 700; color: var(--text); }
.logo-text.sm { font-size: 16px; }
.logo-accent { color: #a78bfa; }
.badge-pill {
    background: rgba(124,58,237,0.2);
    color: #a78bfa;
    border: 1px solid rgba(124,58,237,0.4);
    border-radius: 999px;
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* ---- Hero ---- */
.hero {
    padding: 64px 24px 40px;
    text-align: center;
}
.hero-inner { max-width: 640px; margin: 0 auto; }
.hero-title {
    font-size: clamp(32px, 6vw, 54px);
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 16px;
}
.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-subtitle {
    font-size: 17px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ---- App Section ---- */
.app-section {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px 80px;
    width: 100%;
    flex: 1;
}

/* ---- Card ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ---- Input Group ---- */
.input-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}
.input-label .icon { margin-right: 6px; color: #a78bfa; }
.textarea-wrapper { position: relative; }
textarea {
    width: 100%;
    min-height: 160px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    padding: 14px 16px 36px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}
textarea:focus { border-color: var(--brand-purple); }
textarea::placeholder { color: #4a4a6a; }
.char-counter {
    position: absolute;
    bottom: 10px; right: 14px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ---- Controls Row ---- */
.controls-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.control-group { flex: 1; min-width: 180px; }
.control-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}
.control-label .icon { margin-right: 6px; color: #a78bfa; }

/* Select */
.select-wrapper { position: relative; }
select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    padding: 11px 40px 11px 14px;
    appearance: none;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
select:focus { border-color: var(--brand-purple); }
.select-arrow {
    position: absolute;
    right: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 14px;
}

/* ---- Sliders ---- */
.slider-value {
    float: right;
    color: #a78bfa;
    font-weight: 600;
    font-size: 12px;
}
.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    outline: none;
    cursor: pointer;
    margin-top: 6px;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--gradient);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(124,58,237,0.5);
}
.slider::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--brand-purple);
    border: none;
    cursor: pointer;
}
.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ---- Generate Button ---- */
.generate-btn {
    width: 100%;
    padding: 16px;
    background: var(--gradient);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    position: relative;
    letter-spacing: 0.02em;
}
.generate-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.generate-btn:active { transform: translateY(0); opacity: 1; }
.generate-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.generate-btn .icon { margin-right: 8px; font-size: 18px; }

/* ---- Error Box ---- */
.error-box {
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.35);
    border-radius: 10px;
    padding: 12px 16px;
    color: #fca5a5;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.error-box i { flex-shrink: 0; }

/* ---- Player ---- */
.player-card {
    background: rgba(124,58,237,0.08);
    border: 1px solid rgba(124,58,237,0.3);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.player-header {
    display: flex;
    align-items: center;
    gap: 14px;
}
.player-icon {
    width: 44px; height: 44px;
    background: var(--gradient);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: #fff;
    flex-shrink: 0;
}
.player-info { flex: 1; }
.player-title { font-weight: 600; font-size: 15px; }
.player-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.download-btn {
    background: rgba(124,58,237,0.2);
    border: 1px solid rgba(124,58,237,0.4);
    color: #a78bfa;
    border-radius: 8px;
    padding: 8px 14px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
    white-space: nowrap;
}
.download-btn:hover { background: rgba(124,58,237,0.35); }
.download-btn .icon { margin-right: 6px; }
audio {
    width: 100%;
    accent-color: var(--brand-purple);
    border-radius: 8px;
}

/* ---- History ---- */
.history-section { margin-top: 40px; }
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.clear-btn {
    background: transparent;
    border: 1px solid rgba(239,68,68,0.35);
    color: #fca5a5;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
}
.clear-btn:hover { background: rgba(239,68,68,0.1); }
.clear-btn .icon { margin-right: 5px; }
.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.history-num {
    width: 28px; height: 28px;
    background: rgba(124,58,237,0.15);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #a78bfa;
    flex-shrink: 0;
}
.history-info { flex: 1; min-width: 0; }
.history-preview {
    font-size: 13px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.history-play {
    background: rgba(124,58,237,0.15);
    border: 1px solid rgba(124,58,237,0.3);
    color: #a78bfa;
    border-radius: 8px;
    padding: 7px 13px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.history-play:hover { background: rgba(124,58,237,0.3); }
.history-play .icon { margin-right: 5px; }

/* ---- How It Works ---- */
.how-it-works { margin-top: 56px; text-align: center; }
.section-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 32px;
    color: var(--text);
}
.steps-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}
.step {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 20px;
    flex: 1;
    min-width: 160px;
    max-width: 200px;
}
.step-num {
    width: 36px; height: 36px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px;
    margin: 0 auto 12px;
}
.step-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.step-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.step-arrow { color: var(--text-muted); font-size: 18px; }

/* ---- Footer ---- */
.footer {
    border-top: 1px solid var(--border);
    padding: 20px 24px;
}
.footer-inner {
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.footer-copy { font-size: 13px; color: var(--text-muted); }

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

/* ---- Responsive ---- */
@media (max-width: 560px) {
    .card { padding: 20px 16px; }
    .controls-row { flex-direction: column; }
    .steps-row { flex-direction: column; align-items: stretch; }
    .step { max-width: 100%; }
    .step-arrow { transform: rotate(90deg); }
    .player-header { flex-wrap: wrap; }
}
