/* ---------------------------------------------------------------
   Simple Translate — "Editorial" theme
   Palette: warm off-white + editorial blue + buttery gold accent
   Typography: Geist Sans (UI) + Geist Mono (model output)
   --------------------------------------------------------------- */

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

:root {
    /* Brand tokens */
    --st-bg:            #FAFAF7;
    --st-surface:       #FFFFFF;
    --st-text:          #0B1220;
    --st-text-muted:    #5B6473;
    --st-border:        #ECECEC;
    --st-divider:       #EDEEF1;
    --st-primary:       #2F5BFF;
    --st-primary-hover: #1E3FD8;
    --st-primary-ring:  rgba(47, 91, 255, 0.15);
    --st-accent:        #F5C451;
    --st-accent-hover:  #EBB73A;

    /* Bootstrap overrides */
    --bs-primary:       #2F5BFF;
    --bs-primary-rgb:   47, 91, 255;
    --bs-body-bg:       #FAFAF7;
    --bs-body-color:    #0B1220;
    --bs-secondary-color: #5B6473;
    --bs-border-color:  #ECECEC;
    --bs-link-color:    #2F5BFF;
    --bs-link-hover-color: #1E3FD8;
}

/* ------------------------------- Base ------------------------------- */

html, body {
    background-color: var(--st-bg);
    color: var(--st-text);
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-feature-settings: "cv11", "ss01", "ss03";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Geist', sans-serif;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--st-text);
}

a {
    color: var(--st-primary);
    text-decoration: none;
}
a:hover {
    color: var(--st-primary-hover);
    text-decoration: underline;
}

.text-muted {
    color: var(--st-text-muted) !important;
}

/* ---------------------------- Layout frame -------------------------- */

.app-container {
    max-width: 900px !important;
    margin: 0 auto;
    padding: 1rem 1.5rem 3rem;
}

/* ----------------------------- App title ---------------------------- */

.app-title {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--st-text-muted);
    margin-top: 3.5rem;
    margin-bottom: 2.5rem;
}

/* -------------------------- About Section --------------------------- */

.about-wrapper {
    text-align: center;
    margin-bottom: 3.5rem;
}

.about-content {
    max-width: 650px;
    margin: 1.5rem auto 0;
    text-align: left;
    padding: 1.5rem;
    background-color: var(--st-surface);
    border: 1px solid var(--st-border);
    border-radius: 12px;
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--st-text-muted);
    box-shadow: 0 4px 12px rgba(11, 18, 32, 0.03);
}

.info-icon {
    font-size: 1rem;
    line-height: 1;
}

/* --------------------------- Language label ------------------------- */

.lang-label {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--st-text-muted);
}
#source-label {
    text-align: left;
}
#target-label {
    text-align: right;
}

/* ------------------------------ Buttons ----------------------------- */

.btn-primary {
    background-color: var(--st-primary);
    border-color: var(--st-primary);
    font-weight: 500;
    letter-spacing: -0.01em;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary:focus-visible {
    background-color: var(--st-primary-hover) !important;
    border-color: var(--st-primary-hover) !important;
    box-shadow: 0 0 0 3px var(--st-primary-ring) !important;
}

.btn-link {
    color: var(--st-text-muted);
    text-decoration: none;
}
.btn-link:hover {
    color: var(--st-primary);
}

/* Translate primary CTA — fixed width, centered, soft blue shadow */
.translate-button-row {
    display: flex;
    justify-content: center;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}
.translate-button {
    min-width: 220px;
    padding: 0.6rem 1.75rem !important;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(47, 91, 255, 0.18);
    transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.translate-button:hover {
    box-shadow: 0 6px 16px rgba(47, 91, 255, 0.24);
    transform: translateY(-1px);
}
.translate-button:active {
    transform: translateY(0);
}

/* Option 1: Button Loading State */
.translate-button[data-dash-is-loading="true"] {
    opacity: 0.85;
    cursor: wait;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}

/* Change text to "TRANSLATING..." and add space for the spinner */
.translate-button[data-dash-is-loading="true"] #translate-btn-text {
    visibility: hidden;
}

.translate-button[data-dash-is-loading="true"] .dash-spinner {
    margin-right: 8px;
}

.translate-button[data-dash-is-loading="true"]::after {
    content: "TRANSLATING...";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    letter-spacing: 0.12em;
}

/* Hide the dot spinner and just use the button's native dash-loading class if needed,
   but Dash's dcc.Loading adds its own div. Let's style it. */
.translate-button .dash-loading {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

/* Ensure the button doesn't jump in size */
.translate-button {
    min-width: 220px;
    height: 48px; /* Fixed height for stability */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Swap button — circular, neutral default, yellow on hover with a spin */
.swap-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    line-height: 1;
    background-color: var(--st-surface);
    border: 1px solid var(--st-border);
    color: var(--st-text);
    box-shadow: 0 1px 2px rgba(11, 18, 32, 0.04);
    cursor: pointer;
    transition: background-color 0.2s ease,
                border-color 0.2s ease,
                box-shadow 0.2s ease,
                transform 0.35s ease;
    font-family: 'Geist', sans-serif;
}
.swap-button:hover,
.swap-button:focus {
    background-color: var(--st-accent);
    border-color: var(--st-accent);
    color: var(--st-text);
    box-shadow: 0 0 0 4px rgba(245, 196, 81, 0.28);
    transform: rotate(180deg);
    outline: none;
}
.swap-button:active {
    transform: rotate(180deg) scale(0.95);
}

/* ----------------------------- Textareas ---------------------------- */

textarea.form-control {
    background-color: var(--st-surface);
    color: var(--st-text);
    border: 1px solid var(--st-border);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    font-family: 'Geist', sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(11, 18, 32, 0.03);
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.3s ease;
}

/* Shimmer Loading State (Option 2)
   Dash automatically adds [data-dash-is-loading="true"] to components being updated. */
#target-output[data-dash-is-loading="true"] {
    color: transparent !important;
    background: linear-gradient(
        90deg,
        var(--st-surface) 25%,
        #f2f2f0 50%,
        var(--st-surface) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 4s infinite linear;
    border-color: var(--st-border);
    pointer-events: none;
}

#target-output[data-dash-is-loading="true"]::placeholder {
    color: transparent !important;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}
textarea.form-control::placeholder {
    color: var(--st-text-muted);
    opacity: 0.7;
}
textarea.form-control:focus {
    background-color: var(--st-surface);
    color: var(--st-text);
    border-color: var(--st-primary);
    box-shadow: 0 0 0 3px var(--st-primary-ring);
}

/* Model output gets Geist Mono to subtly signal "generated text" */
#target-output {
    font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.95rem;
}

/* ------------------------------- Card ------------------------------- */

.card {
    background-color: var(--st-surface);
    border-color: var(--st-border);
    color: var(--st-text);
    border-radius: 12px;
}

/* ------------------------------ Settings ---------------------------- */

.settings-wrapper {
    margin-top: 0.75rem;
    text-align: center;
}
.secondary-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    font-family: 'Geist', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--st-text-muted);
    background-color: var(--st-surface);
    border: 1px solid var(--st-border);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.secondary-pill:hover {
    color: var(--st-text);
    border-color: #D6D8DC;
    background-color: #fafaf9;
}
.secondary-pill:focus,
.secondary-pill:focus-visible {
    outline: none;
    border-color: var(--st-primary);
    box-shadow: 0 0 0 3px var(--st-primary-ring);
}
.secondary-pill.active {
    color: var(--st-primary);
    background-color: rgba(47, 91, 255, 0.08);
    border-color: var(--st-primary);
}
.secondary-pill.active:hover {
    background-color: rgba(47, 91, 255, 0.12);
}
.secondary-pill .gear, .secondary-pill .info-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}
.secondary-pill.active .gear {
    transform: rotate(90deg);
}
.secondary-pill.active .info-icon {
    transform: scale(1.1);
}
.settings-inline {
    max-width: 460px;
    margin: 0.75rem auto 0;
    padding: 0.5rem 0.25rem 0;
    text-align: left;
}
.settings-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--st-text-muted);
    margin-bottom: 0.5rem;
}

/* --------------------------- dcc.Slider ----------------------------- */

.rc-slider-rail {
    background-color: var(--st-divider);
}
.rc-slider-track {
    background-color: var(--st-primary);
}
.rc-slider-handle {
    border-color: var(--st-primary) !important;
    background-color: var(--st-primary);
    opacity: 1;
}
.rc-slider-handle:hover,
.rc-slider-handle:focus,
.rc-slider-handle-click-focused:focus {
    border-color: var(--st-primary-hover) !important;
    box-shadow: 0 0 0 5px var(--st-primary-ring) !important;
}
.rc-slider-dot-active {
    border-color: var(--st-primary);
}
.rc-slider-mark-text {
    color: var(--st-text-muted);
    font-family: 'Geist Mono', ui-monospace, monospace;
    font-size: 0.75rem;
}
