/* ============================================
   FILE: public/style.css
   DESCRIPTION: Shopify-admin-inspired styling for ils-translator UI.
   Palette: white base, #e1e3e5 borders, #008060 accent.
   ============================================ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  font-size: 14px;
  color: #202223;
  background: #f6f6f7;
}

.hidden { display: none !important; }
.muted { color: #6d7175; }

/* ---------------- login gate ---------------- */
.login-gate {
  position: fixed;
  inset: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
/* Mobile keyboard open: shrink gate to the visual viewport and pin the card
   to the bottom so there's a minimal (~5px) gap between the Sign in button
   and the top of the software keyboard. Toggled by JS via visualViewport. */
.login-gate--kb {
  align-items: flex-end;
  justify-content: center;
}
.login-gate--kb .login-card {
  padding-top: 16px;
  padding-bottom: 5px;
}
.login-card {
  background: #fff;
  border: none;
  box-shadow: none;
  padding: 32px 24px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.login-logo {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
  margin: 0 auto 10px;
}
.login-sublogo {
  font-size: 11px;
  letter-spacing: 0.35em;
  color: #202223;
  margin-bottom: 40px;
  text-transform: uppercase;
}
.login-title {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 6px;
  color: #202223;
}
.login-hint {
  font-size: 14px;
  color: #6d7175;
  margin: 0 0 20px;
}
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #d5d7da;
  border-radius: 10px;
  margin: 0 0 12px;
  font-size: 14px;
  background: #f4f4f2;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
  color: #202223;
  -webkit-appearance: none;
  appearance: none;
}
.login-card input:focus {
  border-color: #c60404;
}
.login-card input:invalid {
  box-shadow: none;
}
.login-card button {
  width: 100%;
  padding: 12px 14px;
  background: #c60404;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s;
  font-family: inherit;
}
.login-card button:hover { background: #a80303; }
.login-error {
  color: #c60404;
  font-size: 13px;
  margin-top: 12px;
  min-height: 18px;
  width: 100%;
  text-align: center;
}

/* ---------------- app shell ---------------- */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* topbar */
.topbar {
  height: 56px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid #e1e3e5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 20px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.logo {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}
.logo-accent { color: #008060; }
.breadcrumbs {
  color: #6d7175;
  font-size: 13px;
}
.breadcrumbs .crumb::after {
  content: " / ";
  color: #c9cccf;
  padding: 0 2px;
}
.breadcrumbs .crumb:last-child::after { content: ""; }
.breadcrumbs .crumb--current {
  color: #202223;
  font-weight: 500;
}

.save-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #6d7175;
}
.save-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.save-dot--clean { background: #b1dccc; }
.save-dot--dirty { background: #ffb800; box-shadow: 0 0 0 3px rgba(255, 184, 0, 0.15); }
.save-dot--saving { background: #006ee6; animation: pulse 1s infinite; }
.save-dot--error  { background: #c9291f; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

.btn {
  padding: 8px 16px;
  border: 1px solid #c9cccf;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 120ms;
}
.btn:hover { background: #f6f6f7; }
.btn--primary {
  background: #008060;
  color: #fff;
  border-color: #008060;
}
.btn--primary:hover { background: #006e51; }
.btn--primary:disabled {
  background: #b1dccc;
  border-color: #b1dccc;
  cursor: not-allowed;
}

/* tabs */
.tabs {
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid #e1e3e5;
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.tab {
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
  color: #6d7175;
  margin-bottom: -1px;
}
.tab:hover { color: #202223; }
.tab--active {
  color: #202223;
  border-bottom-color: #008060;
  font-weight: 500;
}

/* search */
.searchbar {
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #e1e3e5;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}
.searchbar input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #c9cccf;
  border-radius: 6px;
  font-size: 14px;
}
.searchbar input:focus {
  outline: none;
  border-color: #008060;
  box-shadow: 0 0 0 3px rgba(0, 128, 96, 0.15);
}
.search-status {
  font-size: 12px;
  color: #6d7175;
  min-width: 120px;
  text-align: right;
}

/* langbar */
.langbar {
  padding: 10px 20px;
  background: #fafbfb;
  border-bottom: 1px solid #e1e3e5;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}
.langbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.langbar-label {
  color: #6d7175;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.langbar select {
  padding: 6px 8px;
  border: 1px solid #c9cccf;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  min-width: 140px;
}
.base-locale-fixed {
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f1f2f3;
  color: #202223;
  font-size: 13px;
  font-weight: 500;
  min-width: 140px;
  display: inline-block;
  cursor: default;
  user-select: none;
}
.autotranslate-indicator {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #6d7175;
  font-size: 13px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot--on  { background: #008060; }
.dot--off { background: #c9cccf; }
.dot--mixed { background: #ffb800; }

/* main */
.main {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* sidebar */
.sidebar {
  width: 280px;
  min-width: 200px;
  background: #fff;
  border-right: 1px solid #e1e3e5;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-status {
  padding: 14px 16px;
  font-size: 13px;
}
.resource-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.resource-item {
  padding: 10px 16px;
  border-bottom: 1px solid #f0f0f1;
  cursor: pointer;
  transition: background 100ms;
}
.resource-item:hover { background: #f6f6f7; }
.resource-item--open { background: #f6f6f7; }
.resource-title {
  font-weight: 500;
  font-size: 13px;
  color: #202223;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.resource-sub {
  font-size: 11px;
  color: #6d7175;
  margin-top: 2px;
}
.field-list {
  list-style: none;
  padding: 6px 0 10px 26px;
  margin: 0;
  border-top: 1px solid #f0f0f1;
  background: #fafbfb;
}
.field-item {
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  color: #202223;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.field-item:hover { background: #eef2f0; }
.field-item--active {
  background: #d8ece4;
  color: #005e4a;
  font-weight: 500;
}
.field-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.field-badge--dirty { background: #fff2cc; color: #8a6100; }
.field-badge--translated { background: #d8ece4; color: #005e4a; }

.section-header {
  padding: 8px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #6d7175;
  background: #fafbfb;
  border-bottom: 1px solid #e1e3e5;
  border-top: 1px solid #e1e3e5;
  font-weight: 600;
}

/* editor / panes */
.editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.editor-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6d7175;
  padding: 40px;
  text-align: center;
}
.editor-empty h2 { margin: 0 0 6px; color: #202223; font-weight: 500; }

.panes {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}
.pane {
  display: flex;
  flex-direction: column;
  min-width: 150px;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}
.pane-head {
  padding: 8px 12px;
  background: #fafbfb;
  border-bottom: 1px solid #e1e3e5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  font-size: 12px;
}
.pane-title { font-weight: 600; color: #202223; }
.pane-meta { color: #6d7175; font-size: 11px; text-align: right; }
.pane-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
}
.pane-body--preview {
  background: #fff;
  outline: none;
}
.pane-body--preview:focus { background: #fdfeff; }
.pane-body--code {
  background: #fbfbfb;
  border: none;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  resize: none;
  color: #202223;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}
.pane-body--code:focus { background: #fff; }
.pane-body img { max-width: 100%; height: auto; }

.pane-divider {
  width: 5px;
  background: #e1e3e5;
  cursor: col-resize;
  transition: background 120ms;
  flex-shrink: 0;
}
.pane-divider:hover, .pane-divider.dragging { background: #008060; }

/* search results dropdown */
.search-results {
  position: absolute;
  top: 100%;
  left: 20px;
  right: 20px;
  background: #fff;
  border: 1px solid #e1e3e5;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
  margin-top: 4px;
}
.search-result {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f1;
  cursor: pointer;
}
.search-result:hover { background: #f6f6f7; }
.search-result:last-child { border-bottom: none; }
.search-result-title {
  font-size: 13px;
  font-weight: 500;
  color: #202223;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-meta {
  font-size: 11px;
  color: #6d7175;
  margin-top: 3px;
}
.search-result-hit {
  font-size: 12px;
  color: #005e4a;
  margin-top: 3px;
}
.search-result mark {
  background: #fff2cc;
  color: #202223;
  padding: 0 2px;
  border-radius: 2px;
}
.searchbar-wrap { position: relative; flex: 1; }

/* ---------------- pane head actions (LLM buttons + lock) ---------------- */
.pane-head {
  align-items: center;
}
.pane-head-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.pane-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}
.btn--small {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid #c9cccf;
  background: #fff;
  cursor: pointer;
  color: #202223;
}
.btn--small:hover { background: #f6f6f7; border-color: #008060; color: #008060; }
.btn--small:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--icon { padding: 4px 6px; font-size: 13px; }
.btn--locked { background: #ffe4d6; border-color: #d47a3d; color: #7a3d0a; }
.btn--locked:hover { background: #ffd4c0; }
.btn--danger { background: #fff; color: #c9291f; border-color: #eab2ad; }
.btn--danger:hover { background: #ffeceb; border-color: #c9291f; }

/* ---------------- modal ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 34, 35, 0.35);
}
.modal-panel {
  position: relative;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  width: min(960px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head {
  padding: 14px 20px;
  border-bottom: 1px solid #e1e3e5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { margin: 0; font-size: 16px; font-weight: 600; }
.modal-close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: #6d7175;
  padding: 4px 8px;
  border-radius: 4px;
}
.modal-close:hover { background: #f6f6f7; color: #202223; }
.modal-tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  background: #fafbfb;
  border-bottom: 1px solid #e1e3e5;
}
.modal-tab {
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  color: #6d7175;
  margin-bottom: -1px;
}
.modal-tab:hover { color: #202223; }
.modal-tab--active {
  color: #202223;
  border-bottom-color: #008060;
  font-weight: 500;
}
.modal-body {
  overflow-y: auto;
  padding: 20px;
}
.settings-section p.muted { margin: 0 0 14px; font-size: 13px; }

.settings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 14px;
}
.settings-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #e1e3e5;
  color: #6d7175;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.settings-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f1;
  vertical-align: middle;
}
.settings-table tr:last-child td { border-bottom: none; }
.settings-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.settings-form {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid #e1e3e5;
  flex-wrap: wrap;
}
.settings-form input {
  padding: 6px 8px;
  border: 1px solid #c9cccf;
  border-radius: 4px;
  font-size: 13px;
  min-width: 140px;
}
.settings-error {
  color: #c9291f;
  font-size: 12px;
  min-height: 16px;
  padding-top: 4px;
}
