/* Transcriber UI — RTL Persian, Vazir font.
   Layout carried over from the OCR project (ocr.css), recolored from the
   violet/plum family to a crimson/red family (teal/blue/green/orange/violet
   were all rejected for this project's theme):
   body #a1392f · grid #b3b3b3 + border #e0a39a · panel #e0a39a ·
   output #e9ecef · primary button #b03a2e/#e0a39a ·
   cancel button #e9ecef/#c3ccd4/#495057 (neutral gray) · accent #6d1f18 */

@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: #a1392f;        /* crimson page background (was violet #7b52ab) */
  --grid-bg: #b3b3b3;
  --grid-border: #e0a39a;    /* soft rose (was lavender #b794d6) */
  --panel: #e0a39a;
  --surface: #ffffff;
  --output-bg: #e9ecef;
  --border: #c3ccd4;
  --text: #000000;
  --muted: #6c757d;
  --accent: #6d1f18;         /* deep crimson (was deep violet #4a2580) */
  --accent-bright: #f0b4ab;  /* light rose (was #c9a4e8) */
  --accent-dark: #581813;    /* dark maroon hover (was #3c1f68) */
  --primary: #b03a2e;        /* crimson action button (was violet #6a3fa0) */
  --primary-border: #e0a39a;
  --secondary: #e9ecef;      /* neutral gray cancel (was amber #eec17a) */
  --secondary-border: #c3ccd4;
  --secondary-text: #495057;
  --fieldset-bg: #b03a2e;    /* crimson labels + copy button (was #6a3fa0) */
  --danger: #c0392b;
  --radius: 12px;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

* { 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-title { margin: 0; font-size: 1.6rem; color: #ffffff; }
.app-subtitle { margin: 6px 0 0; font-size: 0.95rem; color: #f3dcd6; }

/* ---------- 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;
}

/* ---------- dropzone ---------- */

.dropzone {
  border: 2px dashed var(--grid-border);
  border-radius: var(--radius);
  background: #fdf4f2;
  text-align: center;
  padding: 28px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--accent-dark);
  background: #f9e9e6;
  outline: none;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: #f4ddd8;
}

.drop-icon { font-size: 2rem; line-height: 1; }
.drop-text { margin: 10px 0 2px; font-weight: 600; color: var(--text); }
.drop-hint { margin: 0; font-size: 0.8rem; color: var(--muted); }

.preview-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text);
}

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

/* ---------- divider ("یا") ---------- */

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- fields ---------- */

.field-label {
  display: block;
  margin: 4px 0 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fieldset-bg);
}

input[type="url"], textarea {
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

input[type="url"] { width: 100%; direction: ltr; text-align: left; }
input[type="url"]::placeholder { text-align: right; direction: rtl; }

input[type="url"]:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

select.language-select {
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
  cursor: pointer;
}

/* ---------- 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(--primary);
  border: 2px solid var(--primary-border);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }

.btn-secondary {
  background: var(--secondary);
  border: 2px solid var(--secondary-border);
  color: var(--secondary-text);
}
.btn-secondary:hover:not(:disabled) { background: #dde3e8; }

.btn-copy {
  background: var(--fieldset-bg);
  border: 1px solid var(--grid-border);
  color: #fff;
  font-size: 0.8rem;
  padding: 4px 16px;
  border-radius: 6px;
}
.btn-copy:hover:not(:disabled) { background: var(--accent-dark); }

.btn-translate {
  background: #fff;
  border: 1px solid var(--grid-border);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 6px;
}
.btn-translate:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-translate:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-mini {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--danger);
  font-size: 0.78rem;
  padding: 3px 12px;
  border-radius: 6px;
}
.btn-mini:hover:not(:disabled) { border-color: var(--danger); }

.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8rem;
  padding: 3px 10px 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-share:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-share:hover:not(:disabled) { border-color: var(--accent-dark); }
.btn-share .share-icon { width: 18px; height: 18px; object-fit: contain; border-radius: 4px; }

/* ---------- 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 ---------- */

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

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

.output-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.log-file {
  display: block;
  margin: 10px 2px 0;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.72rem;
  color: var(--muted);
  direction: ltr;
  unicode-bidi: isolate;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.output {
  background: var(--output-bg);
  border-radius: 10px;
  min-height: 120px;
  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; }
  .app-title { font-size: 1.25rem; }
  .output-actions { flex-wrap: wrap; }
}
