/* VogChat shared base — tokens, buttons, header controls, modals.
   Used by index.html and chat.html. Legacy pages keep style.css. */

:root {
    --bg: #f7f5f2;
    --bg-elev: #ffffff;
    --bg-sunk: #efeae2;
    --bg-input: #f5f3ef;
    --text: #111b21;
    --text-2: #54656f;
    --text-3: #8696a0;
    --border: rgba(16, 20, 17, 0.09);
    --border-strong: rgba(16, 20, 17, 0.16);
    --accent: #00a884;
    --accent-strong: #008069;
    --accent-ink: #ffffff;
    --accent-soft: rgba(0, 168, 132, 0.12);
    --accent-glow: rgba(0, 168, 132, 0.25);
    --danger: #e5484d;
    --danger-soft: rgba(229, 72, 77, 0.1);
    --bubble-in: #ffffff;
    --bubble-out: #d9fdd3;
    --bubble-out-text: #111b21;
    --shadow-sm: 0 1px 2px rgba(16, 20, 17, 0.06), 0 1px 1px rgba(16, 20, 17, 0.04);
    --shadow-md: 0 8px 28px rgba(16, 20, 17, 0.08), 0 2px 6px rgba(16, 20, 17, 0.05);
    --shadow-lg: 0 24px 60px rgba(16, 20, 17, 0.14);
    --radius: 16px;
    --radius-lg: 24px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0b141a;
    --bg-elev: #111b21;
    --bg-sunk: #202c33;
    --bg-input: #2a3942;
    --text: #e9edef;
    --text-2: #aebac1;
    --text-3: #8696a0;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --accent: #00a884;
    --accent-strong: #21c063;
    --accent-ink: #ffffff;
    --accent-soft: rgba(0, 168, 132, 0.16);
    --accent-glow: rgba(0, 168, 132, 0.25);
    --danger: #ff6369;
    --danger-soft: rgba(255, 99, 105, 0.12);
    --bubble-in: #202c33;
    --bubble-out: #005c4b;
    --bubble-out-text: #e9edef;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
svg { flex-shrink: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    min-height: 48px; padding: 0 1.25rem; border-radius: 14px;
    font-weight: 650; font-size: 0.975rem; letter-spacing: -0.005em;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--bg-elev); border: 1px solid var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-soft { background: var(--accent-soft); color: var(--accent-strong); }
[data-theme="dark"] .btn-soft { color: var(--accent); }
.btn-block { width: 100%; }

.icon-btn {
    width: 40px; height: 40px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-2); background: transparent; transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--bg-sunk); color: var(--text); }

/* ---------- Theme + language controls ---------- */
.theme-toggle { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); border: 1px solid var(--border); background: var(--bg-elev); }
.theme-toggle .moon-icon { display: none; }
[data-theme="dark"] .theme-toggle .sun-icon { display: none; }
[data-theme="dark"] .theme-toggle .moon-icon { display: block; }

.language-selector { position: relative; }
.lang-btn { height: 40px; padding: 0 0.75rem; border-radius: 12px; display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; font-size: 0.85rem; color: var(--text-2); border: 1px solid var(--border); background: var(--bg-elev); }
.lang-dropdown { position: absolute; top: calc(100% + 6px); right: 0; min-width: 150px; padding: 0.35rem; border-radius: 14px; background: var(--bg-elev); border: 1px solid var(--border); box-shadow: var(--shadow-md); display: none; z-index: 50; }
.lang-dropdown.active { display: block; }
.lang-dropdown button { display: block; width: 100%; text-align: left; padding: 0.55rem 0.75rem; border-radius: 10px; font-size: 0.9rem; }
.lang-dropdown button:hover { background: var(--bg-sunk); }

/* ---------- Modals (api.js / app.js create these) ---------- */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(6, 10, 8, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s; }
.modal.active { opacity: 1; visibility: visible; }
.modal-content { width: 100%; max-width: 420px; background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; box-shadow: var(--shadow-lg); transform: translateY(12px) scale(0.98); transition: transform 0.2s ease; max-height: calc(100dvh - 32px); overflow-y: auto; }
.modal.active .modal-content { transform: none; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.modal-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.modal-close { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; color: var(--text-2); background: var(--bg-sunk); }
.modal-body { color: var(--text-2); }
.confirm-btn { width: 100%; min-height: 46px; margin-top: 1rem; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 650; }
.cancel-btn { min-height: 46px; padding: 0 1rem; border-radius: 12px; background: var(--bg-sunk); color: var(--text-2); font-weight: 600; border: 1px solid var(--border); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 0.7rem 1rem; border-radius: 12px; font-size: 0.9rem; font-weight: 550; box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 1200; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* the page is being translated (see the <head> script) — avoids a flash of English */
html.i18n-wait body { opacity: 0; }
