/* TranslateGemma UI — RTL Persian, Vazir font.
   Colors carried over from the legacy project:
   body #154f67 · grid #b3b3b3 + border #50b9bf · panel #AADFEF · output #e9ecef · accent #27A09E */

@font-face {
  font-family: 'vazir';
  src: url('/static/fonts/Vazir.woff2') format('woff2'),
       url('/static/fonts/Vazir.woff') format('woff'),
       url('/static/fonts/Vazir.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}

:root {
  --body-bg: #154f67;      /* old page background */
  --grid-bg: #b3b3b3;      /* old grid-container-ai-sub background */
  --grid-border: #50b9bf;  /* old grid border */
  --panel: #aadfef;        /* old book-card-ai-answer-back */
  --surface: #ffffff;      /* old book-card */
  --output-bg: #e9ecef;    /* old translated-text box */
  --border: #c3ccd4;       /* neutral input border */
  --text: #000000;
  --muted: #6c757d;        /* bootstrap gray */
  --accent: #27a09e;       /* old teal */
  --accent-hover: #1f7e7c;
  --accent-bright: #02b1e8;
  --danger: #c0392b;
  --radius: 12px;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.1); /* old card shadow */
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--body-bg);
  color: var(--text);
  font-family: 'vazir', 'Segoe UI', Tahoma, sans-serif;
  line-height: 1.8;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* ---------- header ---------- */

.app-header { text-align: center; margin: 8px 0 24px; }
.app-logo { height: 72px; width: auto; }
.app-header h1 { margin: 10px 0 0; font-size: 1.5rem; color: #ffffff; }

/* ---------- cards (legacy layered look: gray grid → white card) ---------- */

.card {
  background: var(--grid-bg);
  border: 3px solid var(--grid-border);
  border-radius: 15px;
  padding: 4px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card-inner {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
}

/* ---------- controls ---------- */

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.controls-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

select, textarea {
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.field-label {
  display: block;
  margin: 4px 0 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

textarea {
  width: 100%;
  min-height: 140px;
  resize: vertical;
}

/* ---------- actions ---------- */

.actions { display: flex; gap: 12px; margin-top: 14px; }

.btn {
  font-family: inherit;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  padding: 10px 28px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary { background: var(--output-bg); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: #d5dadd; }

/* ---------- status / error ---------- */

.status { min-height: 1.5em; color: var(--muted); font-size: 0.9rem; margin: 12px 0 0; }
.error { color: var(--danger); font-size: 0.9rem; margin: 12px 0 0; }

/* ---------- output (legacy translated-text box) ---------- */

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.output-header h2 { margin: 0; font-size: 1.05rem; }

.log-file {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.75rem;
  color: var(--muted);
  direction: ltr;
  unicode-bidi: isolate;
}

.output {
  background: var(--output-bg);
  border-radius: 10px;
  min-height: 120px;
  max-height: 480px;
  overflow-y: auto;
  padding: 20px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 1.0em;
  line-height: 1.6rem;
}

/* blinking caret while the stream is active */
.output.is-streaming::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-inline-start: 4px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink { to { visibility: hidden; } }

/* ---------- responsive ---------- */

@media (max-width: 600px) {
  .container { padding: 12px 8px 40px; }
  .controls-grid { grid-template-columns: 1fr 1fr; }
}
