/* =========================================================
   APMaths - Gemini Text to Speech
   style.css
   ========================================================= */


/* ---------------------------------------------------------
   1. System Variables & Theme
   --------------------------------------------------------- */

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;

    --bg-main: #f8fafc;
    --card-bg: #ffffff;

    --text-main: #0f172a;
    --text-muted: #64748b;

    --border-color: #e2e8f0;
    --border-focus: #818cf8;

    --radius-lg: 18px;
    --radius-md: 10px;
    --radius-sm: 6px;

    --shadow-sm:
        0 1px 2px 0 rgba(0, 0, 0, 0.05);

    --shadow-md:
        0 4px 6px -1px rgba(0, 0, 0, 0.06),
        0 2px 4px -1px rgba(0, 0, 0, 0.04);

    --shadow-lg:
        0 8px 30px rgba(15, 23, 42, 0.08);

    --transition-fast:
        all 0.2s ease;
}


/* ---------------------------------------------------------
   2. Global Reset & Base
   --------------------------------------------------------- */

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


html {
    font-family:
        "Times New Roman",
        Times,
        serif;
}


body {
    background-color: var(--bg-main);
    color: var(--text-main);

    font-family:
        "Times New Roman",
        Times,
        serif;

    line-height: 1.5;
    margin: 0;
}


/* Form controls inherit Times New Roman */

button,
input,
textarea,
select {
    font-family: inherit;
}


.container {
    width: min(92%, 1320px);
    margin-inline: auto;
}


/* ---------------------------------------------------------
   3. Header
   --------------------------------------------------------- */

.site-header {
    padding: 22px 0 12px;
    text-align: center;
}


.site-header h1 {
    font-size: 2rem;
    font-weight: 800;

    letter-spacing: -0.025em;

    color: var(--text-main);

    margin: 0 0 4px;
}


.site-header p {
    color: var(--text-muted);
    font-size: 0.98rem;

    margin: 0;
}


/* ---------------------------------------------------------
   4. Main TTS Card
   --------------------------------------------------------- */

.tts-card {
    background: var(--card-bg);

    border: 1px solid var(--border-color);

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-lg);

    padding: 24px;

    margin-top: 8px;
}


/* ---------------------------------------------------------
   5. Two-column Layout
   --------------------------------------------------------- */

.tts-layout {
    display: grid;

    grid-template-columns:
        minmax(0, 1.65fr)
        minmax(360px, 0.85fr);

    gap: 28px;
}


/* ---------------------------------------------------------
   6. Form Groups
   --------------------------------------------------------- */

.form-group {
    display: flex;
    flex-direction: column;

    gap: 6px;

    margin-bottom: 0;
}


.form-group label {
    font-size: 0.98rem;
    font-weight: 600;

    color: var(--text-main);
}


/* ---------------------------------------------------------
   7. Inputs / Textarea / Select
   --------------------------------------------------------- */

textarea,
input[type="text"],
select {
    width: 100%;

    border: 1px solid var(--border-color);

    border-radius: var(--radius-md);

    padding: 11px 13px;

    font-size: 1.05rem;

    color: var(--text-main);

    background-color: #ffffff;

    outline: none;

    transition: var(--transition-fast);
}


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

    box-shadow:
        0 0 0 3px
        rgba(99, 102, 241, 0.15);
}


/* ---------------------------------------------------------
   8. Main Text Input
   --------------------------------------------------------- */

#textInput {
    height: clamp(280px, 38vh, 360px);

    min-height: 280px;

    resize: vertical;

    line-height: 1.6;
   font-size: 1.08rem;
}


/* ---------------------------------------------------------
   9. Settings Column
   --------------------------------------------------------- */

.settings-column {
    display: flex;

    flex-direction: column;

    gap: 14px;
}


/* ---------------------------------------------------------
   10. Instructions
   --------------------------------------------------------- */

.instructions-input {
    height: 72px;

    min-height: 64px;

    resize: vertical;
}


/* ---------------------------------------------------------
   11. Control Row
   --------------------------------------------------------- */

.control-row {
    display: flex;

    align-items: flex-end;

    gap: 14px;

    margin-top: 2px;

    background: var(--bg-main);

    padding: 13px;

    border-radius: var(--radius-md);

    border: 1px solid var(--border-color);
}


.speed-control {
    flex: 1;

    min-width: 0;
}


.speed-control input[type="range"] {
    width: 100%;

    accent-color: var(--primary-color);

    cursor: pointer;
}


/* ---------------------------------------------------------
   12. Action Buttons
   --------------------------------------------------------- */

.control-row .actions {
    display: flex;

    gap: 8px;

    flex-shrink: 0;
}


button,
.button {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    padding: 9px 16px;

    font-size: 1rem;
    font-weight: 600;

    border-radius: var(--radius-md);

    border: 1px solid transparent;

    cursor: pointer;

    transition: var(--transition-fast);

    white-space: nowrap;
}


/* ---------------------------------------------------------
   13. Primary Button
   --------------------------------------------------------- */

button:not(.secondary-button) {
    background-color: var(--primary-color);

    color: #ffffff;

    box-shadow: var(--shadow-sm);
}


button:not(.secondary-button):hover {
    background-color: var(--primary-hover);

    transform: translateY(-1px);

    box-shadow: var(--shadow-md);
}


button:not(.secondary-button):active {
    transform: translateY(0);
}


/* ---------------------------------------------------------
   14. Secondary Button
   --------------------------------------------------------- */

button.secondary-button {
    background-color: #ffffff;

    color: var(--text-muted);

    border-color: var(--border-color);
}


button.secondary-button:hover:not(:disabled) {
    background-color: #f8fafc;

    color: var(--text-main);

    border-color: #cbd5e1;
}


/* ---------------------------------------------------------
   15. Disabled Button
   --------------------------------------------------------- */

button:disabled {
    opacity: 0.5;

    cursor: not-allowed;

    transform: none !important;

    box-shadow: none !important;
}


/* ---------------------------------------------------------
   16. Status
   --------------------------------------------------------- */

.status {
    min-height: 20px;

    margin-top: 2px;

    font-size: 0.85rem;

    color: var(--text-muted);
}


.status.error {
    color: #dc2626;
}


.status.success {
    color: #16a34a;
}


/* ---------------------------------------------------------
   17. Audio Section
   --------------------------------------------------------- */

.audio-section {
    margin-top: 20px;

    padding-top: 16px;

    border-top:
        1px solid var(--border-color);
}


.audio-section h2 {
    margin: 0 0 8px;

    font-size: 1.15rem;

    font-weight: 700;

    color: var(--text-main);
}


.audio-row {
    display: flex;

    align-items: center;

    gap: 12px;

    background: var(--primary-light);

    padding: 10px 12px;

    border-radius: var(--radius-md);
}


.audio-row audio {
    flex: 1;

    min-width: 0;

    height: 40px;
}


/* ---------------------------------------------------------
   18. Download Button
   --------------------------------------------------------- */

.audio-row .download-button {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

    white-space: nowrap;

    padding: 9px 15px;

    background-color: #ffffff;

    color: var(--primary-color);

    border: 1px solid var(--border-color);

    border-radius: var(--radius-md);

    text-decoration: none;

    font-family: inherit;

    font-size: 0.9rem;

    font-weight: 600;

    transition: var(--transition-fast);
}


.audio-row .download-button:hover {
    background-color: var(--primary-color);

    color: #ffffff;

    text-decoration: none;

    transform: translateY(-1px);

    box-shadow: var(--shadow-sm);
}


.audio-row .download-button:active {
    transform: translateY(0);
}


/* ---------------------------------------------------------
   19. Footer
   --------------------------------------------------------- */

.site-footer {
    margin-top: 32px;

    padding: 26px 0 22px;

    border-top:
        1px solid var(--border-color);

    background:
        var(--card-bg);

    text-align: center;
}


.footer-brand {
    font-size: 1.15rem;

    font-weight: 700;

    letter-spacing: -0.01em;

    color: var(--text-main);

    margin-bottom: 8px;
}


.footer-description {
    max-width: 680px;

    margin: 0 auto;

    font-size: 0.88rem;

    line-height: 1.6;

    color: var(--text-muted);
}


.footer-models {
    margin-top: 12px;

    font-size: 0.82rem;

    font-weight: 600;

    color: var(--text-muted);
}


.footer-models span {
    margin: 0 8px;

    opacity: 0.4;
}


.footer-meta {
    display: flex;

    justify-content: center;
    align-items: center;

    flex-wrap: wrap;

    gap: 8px 20px;

    margin-top: 16px;

    padding-top: 13px;

    border-top:
        1px solid var(--border-color);

    font-size: 0.8rem;

    color: var(--text-muted);
}


.footer-meta strong {
    color: var(--text-main);

    font-weight: 600;
}


/* ---------------------------------------------------------
   20. Short Desktop Screens
   --------------------------------------------------------- */

@media (
    min-width: 900px
) and (
    max-height: 700px
) {

    .site-header {
        padding: 14px 0 8px;
    }


    .tts-card {
        margin-top: 6px;

        padding: 18px;
    }


    .tts-layout {
        gap: 18px;
    }


    #textInput {
        height: 280px;

        min-height: 280px;
    }


    .instructions-input {
        height: 60px;

        min-height: 60px;
    }


    .settings-column {
        gap: 11px;
    }


    .control-row {
        padding: 11px;
    }


    .audio-section {
        margin-top: 14px;

        padding-top: 12px;
    }


    .site-footer {
        margin-top: 20px;

        padding: 20px 0 18px;
    }

}


/* ---------------------------------------------------------
   21. Tablet / Mobile
   --------------------------------------------------------- */

@media (max-width: 899px) {

    .container {
        width: min(94%, 700px);
    }


    .site-header {
        padding: 20px 0 12px;
    }


    .tts-card {
        padding: 16px;

        margin-top: 6px;
    }


    .tts-layout {
        grid-template-columns: 1fr;

        gap: 20px;
    }


    #textInput {
        height: 260px;

        min-height: 240px;
    }


    .control-row {
        flex-direction: column;

        align-items: stretch;

        gap: 12px;
    }


    .control-row .actions {
        width: 100%;
    }


    .control-row button {
        flex: 1;
    }


    .audio-row {
    flex-direction: column;

    align-items: stretch;

    gap: 10px;
}

.audio-row audio {
    display: block;

    width: 100%;

    min-width: 100%;

    height: 40px;

    flex: none;
}

.audio-row .download-button {
    width: 100%;

    text-align: center;
}


/* ---------------------------------------------------------
   22. Small Mobile
   --------------------------------------------------------- */

@media (max-width: 600px) {

    .site-footer {
        padding: 22px 0 18px;
    }


    .footer-description {
        font-size: 0.84rem;
    }


    .footer-meta {
        flex-direction: column;

        gap: 6px;
    }

}
