/* ── AI Translator Frontend Toolbar ────────────────────────── */

#ait-toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  background: #1e1b4b;
  color: #e0e7ff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  border-top: 3px solid #6366f1;
  box-shadow: 0 -4px 24px rgba(0,0,0,.35);
  transition: transform .3s ease;
}
#ait-toolbar.ait-toolbar-hidden { transform: translateY(100%); }

.ait-toolbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  flex-wrap: wrap;
}

.ait-toolbar-logo {
  font-weight: 700;
  font-size: 13px;
  color: #a5b4fc;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.ait-toolbar-logo .dashicons { color: #818cf8; font-size: 18px; }

.ait-toolbar-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c7d2fe;
  flex: 1;
}
.ait-tb-label { color: #818cf8; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }

.ait-toolbar-actions { display: flex; align-items: center; gap: 8px; }

.ait-tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 13px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.08);
  color: #e0e7ff;
  text-decoration: none;
  transition: background .15s;
}
.ait-tb-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.ait-tb-btn-primary { background: #6366f1; border-color: #6366f1; color: #fff; }
.ait-tb-btn-primary:hover { background: #4f46e5; color: #fff; }
.ait-tb-btn-xs { padding: 2px 8px; font-size: 11px; margin-left: 6px; }

.ait-toolbar-status { font-size: 12px; color: #a5b4fc; font-style: italic; }
.ait-toolbar-close {
  background: none;
  border: none;
  color: #6366f1;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  margin-left: auto;
}
.ait-toolbar-close:hover { color: #a5b4fc; }

/* ── Edit mode highlight ─────────────────────────────────────── */
body.ait-edit-mode [data-ait-idx] {
  outline: 2px dashed #6366f1 !important;
  outline-offset: 2px;
  cursor: pointer !important;
  transition: outline-color .2s;
}
body.ait-edit-mode [data-ait-idx]:hover {
  outline-color: #f59e0b !important;
  background: rgba(245,158,11,.08);
}

/* ── Edit popup ──────────────────────────────────────────────── */
.ait-edit-popup {
  background: #1e1b4b;
  border-top: 1px solid #3730a3;
  padding: 14px 18px;
}
.ait-edit-popup-inner {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.ait-edit-source, .ait-edit-target { flex: 1; min-width: 220px; }
.ait-edit-source label, .ait-edit-target label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #818cf8;
  margin-bottom: 5px;
}
.ait-edit-box {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 13px;
  color: #e0e7ff;
  min-height: 60px;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.5;
}
.ait-edit-box-readonly { opacity: .65; user-select: none; }
.ait-edit-box[contenteditable="true"]:focus {
  outline: none;
  border-color: #6366f1;
  background: rgba(99,102,241,.08);
}
.ait-edit-actions { display: flex; align-items: center; gap: 8px; padding-bottom: 2px; }
#ait-snippet-status { font-size: 12px; color: #a5b4fc; font-style: italic; }

/* ════════════════════════════════════════════════════════════
   Automatic Language Bar
   — sits below the translation banner, styled as a matching
   purple variant. Not dismissable.
════════════════════════════════════════════════════════════ */

.ait-banner-lang {
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-left: 4px solid #7F77DD;
  color: #4c1d95;
  margin-bottom: 0 !important;
}

.ait-lb-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.ait-lb-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.ait-lb-divider {
  height: 1px;
  background: #ddd6fe;
  margin: 2px 0;
}

.ait-lb-label {
  font-weight: 600;
  white-space: nowrap;
  color: #5b21b6;
}

.ait-lb-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ait-lb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid #c4b5fd;
  background: #fff;
  color: #5b21b6;
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  line-height: 1.4;
  transition: background .15s, border-color .15s;
}
.ait-lb-btn:hover {
  background: #ede9fe;
  border-color: #7F77DD;
  color: #4c1d95;
  text-decoration: none;
}

.ait-lb-btn--current {
  background: #7F77DD;
  border-color: #7F77DD;
  color: #fff;
  font-weight: 600;
  pointer-events: none;
  cursor: default;
}
.ait-lb-btn--current:hover {
  background: #7F77DD;
  color: #fff;
}

.ait-lb-flag { font-size: 14px; line-height: 1; font-style: normal; }
.ait-lb-name { font-style: normal; }
.ait-lb-star { font-size: 9px; opacity: .7; margin-left: 1px; }

/* ── On-the-fly dropdown ────────────────────────────────────── */
.ait-lb-fly-sel {
  padding: 4px 10px;
  border: 1px dashed #c4b5fd;
  border-radius: 6px;
  background: #faf5ff;
  color: #5b21b6;
  font-size: 13px;
  cursor: pointer;
  max-width: 240px;
}
.ait-lb-fly-sel:focus {
  outline: none;
  border-color: #7F77DD;
  border-style: solid;
}
.ait-lb-fly-status {
  font-size: 12px;
  color: #7F77DD;
  font-style: italic;
  margin-left: 6px;
}

/* ── Original-page link inside any banner variant ───────────── */
.ait-banner-original-link {
  display: inline-block;
  margin-top: 6px;
  font-weight: 600;
  white-space: nowrap;
}
.ait-banner-info    .ait-banner-original-link { color: #1d4ed8; }
.ait-banner-warning .ait-banner-original-link { color: #b45309; }
.ait-banner-minimal .ait-banner-original-link { color: #4b5563; }
.ait-banner-original-link:hover { text-decoration: underline; }

/*
 * Action button row — used in both the live-translate disclaimer (#ait-fly-revert)
 * and the pre-translated disclaimer. Nested inside .ait-banner-text so the
 * buttons always render below the disclosure text, not beside it. This keeps
 * the banner compact on all screen sizes, especially mobile.
 */
.ait-banner-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

/*
 * Revert button — live-translate disclaimer only.
 */
.ait-fly-revert-btn {
  background: none;
  border: 1px solid currentColor;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  padding: 3px 10px;
  color: inherit;
  opacity: .75;
  white-space: nowrap;
  transition: opacity .15s;
}
.ait-fly-revert-btn:hover { opacity: 1; }

/* Refresh button — secondary action, slightly subtler than revert. */
.ait-fly-refresh-btn {
  background: none;
  border: 1px solid currentColor;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  padding: 3px 10px;
  color: inherit;
  opacity: .55;
  white-space: nowrap;
  transition: opacity .15s;
}
.ait-fly-refresh-btn:hover { opacity: .85; }
.ait-fly-refresh-btn:disabled {
  cursor: not-allowed;
  opacity: .3;
}

/* ── Language Switcher ──────────────────────────────────────── */
.ait-lang-switcher { display: inline-block; }

.ait-lang-switcher-dropdown select {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}

.ait-lang-switcher-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ait-lang-switcher-list li a {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  font-size: 13px;
  color: #374151;
  text-decoration: none;
}
.ait-lang-switcher-list li a:hover       { background: #f3f4f6; }
.ait-lang-switcher-list li.ait-lang-current a {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
  font-weight: 600;
}

/* ════════════════════════════════════════════════════════════
   Translation Disclosure Banner
════════════════════════════════════════════════════════════ */

.ait-translation-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 8px;
  margin: 0 0 28px;
  font-size: 14px;
  line-height: 1.6;
  position: relative;
}

/* ── Info style (default — blue) ────────────────────────── */
.ait-banner-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #3b82f6;
  color: #1e40af;
}
.ait-banner-info a  { color: #1d4ed8; font-weight: 600; }
.ait-banner-info a:hover { text-decoration: underline; }

/* ── Warning style (amber) ──────────────────────────────── */
.ait-banner-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  color: #92400e;
}
.ait-banner-warning a { color: #b45309; font-weight: 600; }

/* ── Minimal style (grey) ───────────────────────────────── */
.ait-banner-minimal {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #9ca3af;
  color: #6b7280;
}
.ait-banner-minimal a { color: #4b5563; font-weight: 600; }

/* ── Custom style — no default colours, user styles with CSS ── */
.ait-banner-custom {
  border-left: 4px solid currentColor;
}

/* ── Shared elements ─────────────────────────────────────── */
.ait-banner-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1.4;
}
.ait-banner-text    { flex: 1; }
.ait-banner-text strong { font-weight: 700; }

.ait-banner-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  opacity: .45;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  color: inherit;
}
.ait-banner-dismiss:hover { opacity: 1; }

/* ── Stale / out-of-sync warning ─────────────────────────── */
.ait-stale-warning {
  display: block;
  margin-top: 6px;
  padding: 5px 10px;
  background: rgba(245,158,11,.12);
  border-left: 3px solid #f59e0b;
  border-radius: 0 4px 4px 0;
  color: #92400e;
  font-weight: 600;
  font-size: 13px;
}

/* ── Bottom position ─────────────────────────────────────── */
.ait-translation-banner + * { /* spacing when at bottom */ }
* + .ait-translation-banner { margin-top: 32px; margin-bottom: 0; }

/* ════════════════════════════════════════════════════════════
   Mandatory Translation Footer Notice
   — cannot be dismissed, always visible on screen and print
════════════════════════════════════════════════════════════ */

.ait-translation-footer {
  margin-top: 40px;
}

.ait-footer-rule {
  height: 1px;
  background: linear-gradient(to right, #d1d5db, transparent);
  margin-bottom: 18px;
}

.ait-footer-body {
  display: flex !important;
  gap: 12px !important;
  align-items: flex-start !important;
  background: #f9fafb !important;
  border: 1px solid #e5e7eb !important;
  border-left: 4px solid #6b7280 !important;
  border-radius: 8px !important;
  padding: 16px 18px !important;
  font-size: 11px !important;
}

.ait-footer-icon {
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1.6;
}

.ait-footer-notice {
  flex: 1;
  font-size: 11px !important;
  color: #6b7280 !important;
  margin: 0 !important;
  line-height: 1.65 !important;
}
.ait-footer-notice strong { font-weight: 600; color: #374151; }
.ait-footer-notice a { color: #4f46e5; }
.ait-footer-notice a:hover { text-decoration: underline; }


/* ════════════════════════════════════════════════════════════
   PRINT STYLES
   — footer is always printed, top banner is hidden on print
     (since it may already be dismissed by the user)
════════════════════════════════════════════════════════════ */

@media print {

  /* Hide the dismissible top banner — it may already be gone */
  .ait-translation-banner {
    display: none !important;
  }

  /* Force the mandatory footer to always print */
  .ait-translation-footer {
    display: block !important;
    visibility: visible !important;
    margin-top: 32pt;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .ait-footer-body {
    background: #fff !important;
    border: 1px solid #999 !important;
    border-left: 3pt solid #555 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    padding: 10pt 12pt;
  }

  .ait-footer-rule {
    background: #ccc !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ait-footer-line        { font-size: 9pt !important; color: #000 !important; }
  .ait-footer-disclaimer  { font-size: 8pt !important; color: #333 !important; border-color: #ccc !important; }
  .ait-footer-notice      { font-size: 8pt !important; color: #000 !important; }
  .ait-footer-icon        { display: none !important; } /* emoji unreliable in print */
  .ait-footer-line a      { color: #000 !important; text-decoration: underline; }

  /* Show the full URL next to links when printing */
  .ait-footer-line a[href]::after {
    content: " (" attr(href) ")";
    font-size: 7pt;
    color: #555;
  }
}
