:root {
    /* Earth Tones Theme */
    --primary: #c2410c;
    --primary-hover: #9a3412;
    --bg: #fdfaf7;
    --surface: #ffffff;
    --text: #111827;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --radius: 12px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111827;
        --surface: #1f2937;
        --text: #f9fafb;
        --text-secondary: #9ca3af;
        --border: #374151;
        --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    }
}

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

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    width: 100%;
    max-width: 800px;
    /* Slightly tighter for cleaner look */
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
    padding: 1rem 0 0.5rem 0;
}

.logo {
    width: 140px;
    height: 120px;
    object-fit: contain;
    object-position: center;
    display: block;
    margin: 0 auto 0.75rem auto;
}

header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.1;
}

header p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 120%;
    max-width: 480px;
    margin: 0 auto;
}

/* --- Input Group (Fixed for Mobile) --- */
.input-group {
    display: flex;
    gap: 0.75rem;
    background: var(--surface);
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, border-color 0.2s;
    flex-wrap: wrap;
    /* Allows wrapping on huge zooms */
}

input {
    flex: 1;
    /* Takes available space */
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1rem;
    padding: 0.5rem;
    outline: none;
    font-family: var(--font);
    min-width: 0;
    /* Prevents overflow */
}

input::placeholder {
    color: #9ca3af;
}

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.75rem;
    border-radius: 8px;
    /* Slightly tighter radius for button */
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: var(--font);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    /* Keep text on one line */
}

button:hover {
    background: var(--primary-hover);
}

button:active {
    transform: translateY(1px);
}

/* Custom Select Component */
.custom-select {
    position: relative;
    display: inline-flex;
    flex-direction: column;
}

.select-trigger {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 2.75rem 0.75rem 1.75rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: var(--font);
    min-width: 140px;
    position: relative;
    white-space: nowrap;
}

.select-trigger:hover {
    background: var(--primary-hover);
}

.select-trigger:active {
    transform: translateY(1px);
}

.select-trigger::after {
    content: '';
    position: absolute;
    right: 1.25rem;
    top: 50%;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #ffffff;
    transform: translateY(-50%);
    pointer-events: none;
    transition: transform 0.2s;
}

.custom-select.open .select-trigger::after {
    transform: translateY(-50%) rotate(180deg);
}

.select-options {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 100;
    min-width: 160px;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    animation: dropdownSlide 0.2s ease-out;
}

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

.select-option {
    padding: 0.625rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text);
    transition: all 0.2s;
    font-weight: 500;
}

.select-option:hover {
    background: var(--bg);
    color: var(--primary);
}

.select-option.selected {
    background: rgba(194, 65, 12, 0.1);
    color: var(--primary);
}

.select-trigger:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-short {
    display: none;
}

/* Mobile Breakpoint for Input */
@media (max-width: 600px) {
    .input-group {
        flex-direction: column;
        /* Stack input and button */
        padding: 0rem;
        gap: 0.5rem;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    input {
        width: 100%;
        background: var(--surface);
        padding: 1rem;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
    }

    input:focus {
        border-color: var(--primary);
    }

    button {
        width: 100%;
        /* Full width button on mobile */
        padding: 1rem;
        border-radius: var(--radius);
    }

    header h1 {
        font-size: 1.75rem;
    }

    .custom-select {
        width: 100%;
    }
    
    .select-trigger {
        width: 100%;
    }

    #langSpinner {
        order: 3;
    }
    
    .select-options {
        width: 100%;
        left: 0;
        right: 0;
    }

    .result-header {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }

    .actions {
        width: 100%;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }

    .result-header h2 {
        display: none;
    }

    .btn-long {
        display: none;
    }

    .btn-short {
        display: inline;
    }
}

/* --- Results --- */
.result-container {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-top: 12px;
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.02);
    /* Very subtle tint */
}

.result-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.actions {
    display: flex;
    gap: 0.75rem;
}

.secondary-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.secondary-btn:hover {
    border-color: var(--text-secondary);
    background: var(--bg);
}

.transcript-content {
    padding: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--text);
    line-height: 1.7;
}

.error-message {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    font-weight: 500;
    margin-top: 1rem;
    width: 100%;
}

.local-reminder {
    background: rgba(194, 65, 12, 0.05);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 1.25rem;
    border-radius: var(--radius);
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#localReminderMessage {
    white-space: pre-line;
}

.local-reminder p:first-child {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.local-reminder a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.local-reminder a:hover {
    color: var(--primary-hover);
}

.hidden {
    display: none !important;
}

.site-footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: auto;
    padding: 2rem 0 2.5rem;
    opacity: 0.85;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.site-footer a {
    color: inherit;
    text-decoration: none;
}

.footer-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-size: 0.8rem;
    margin-top: 1rem;
    color: var(--text-secondary);
    line-height: 120%;
}

.footer-menu a {
    opacity: 0.6;
}

.footer-menu a:hover {
    opacity: 1;
}

.footer-separator {
    opacity: 0.3;
}

.footer-current {
    opacity: 1 !important;
    pointer-events: none;
}

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

.spinner-inline {
    border-color: rgba(17, 24, 39, 0.2);
    border-top-color: var(--primary);
    width: 18px;
    height: 18px;
    align-self: center;
    flex-shrink: 0;
    margin-left: 0.5rem;
    margin-right: 0.5rem;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}
