:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Navbar ── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.navbar-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-brand span { color: var(--text); }

.navbar-actions { display: flex; gap: 8px; align-items: center; }

/* ── Hero Header ── */
.hero-header {
  display: flex;
  align-items: center;
  gap: 18px;
  background: linear-gradient(135deg, #8b0000 0%, #dc2626 100%);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
}

.hero-logo {
  height: 56px;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}

.hero-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.hero-title span {
  font-weight: 400;
  opacity: .75;
}

.hero-subtitle {
  font-size: 13px;
  color: rgba(255,255,255,.65);
  margin-top: 2px;
}

/* ── Layout ── */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

@media (max-width: 900px) {
  .app-container { grid-template-columns: 1fr; }
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 14px;
}

/* ── Form ── */
.form-group { margin-bottom: 14px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Quill Editor ── */
#editor-wrapper {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

#editor-wrapper .ql-toolbar {
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

#editor-wrapper .ql-container {
  border: none;
  font-size: 15px;
  min-height: 300px;
}

#editor-wrapper .ql-editor { min-height: 300px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, transform .1s, box-shadow .15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover:not(:disabled) { background: var(--surface-2); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Language Tabs ── */
.lang-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.lang-tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.lang-tab .flag { font-size: 16px; }

.lang-tab .status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #cbd5e1;
  display: inline-block;
}

.lang-tab.translated .status-dot { background: #22c55e; }

/* ── Photo Upload ── */
.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
}

.photo-upload-area:hover { border-color: var(--primary); background: #eff6ff; }

.photo-upload-area input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

.photo-preview {
  max-width: 100%;
  max-height: 180px;
  border-radius: 6px;
  margin-top: 10px;
  display: none;
}

.photo-preview.visible { display: block; margin: 8px auto 0; }

/* ── Translation Panel ── */
.translate-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* ── Status / Toast ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn .2s ease;
  max-width: 360px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Publish Status ── */
.publish-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  margin-bottom: 8px;
  background: var(--surface-2);
}

.publish-item .lang-name {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-loading { background: #dbeafe; color: #1e40af; }
.badge-success { background: #dcfce7; color: #14532d; }
.badge-error { background: #fee2e2; color: #7f1d1d; }

/* ── Spinner ── */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Settings page ── */
.settings-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}

.settings-section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── Log Panel ── */
.log-container {
  height: 495px;
  overflow-y: auto;
  background: #0f172a;
  border-radius: 8px;
  padding: 10px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
}

.log-container::-webkit-scrollbar { width: 4px; }
.log-container::-webkit-scrollbar-track { background: transparent; }
.log-container::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.log-entry {
  display: flex;
  gap: 8px;
  padding: 1px 0;
}

.log-entry .log-time { color: #475569; flex-shrink: 0; }
.log-entry.log-success .log-msg { color: #4ade80; }
.log-entry.log-error   .log-msg { color: #f87171; }
.log-entry.log-warning .log-msg { color: #fbbf24; }
.log-entry.log-info    .log-msg { color: #94a3b8; }

.log-clear-btn {
  background: none;
  border: 1px solid #334155;
  color: #64748b;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  float: right;
}
.log-clear-btn:hover { border-color: #475569; color: #94a3b8; }

/* ── HTML Modal ── */
.html-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.html-modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 600px;
  max-width: 92vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.html-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
}

.html-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}
.html-modal-close:hover { color: var(--danger); }

.html-modal textarea {
  margin: 14px 18px;
  flex: 1;
  resize: vertical;
  min-height: 200px;
}

.html-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

/* Quill toolbar HTML button */
.ql-html-btn {
  font-size: 13px !important;
  font-weight: 600 !important;
  width: auto !important;
  padding: 0 6px !important;
}

/* ── Auth Pages ── */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 56px);
  padding: 24px;
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.auth-link {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.auth-link a:hover { text-decoration: underline; }

/* ── Dashboard ── */
.dashboard-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.stat-card {
  text-align: center;
  padding: 24px 16px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

/* ── Plan Badge ── */
.badge-plan {
  background: #dbeafe;
  color: #1e40af;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

/* ── Plans Page ── */
.plans-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 24px;
}

.plan-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  transition: border-color .2s, box-shadow .2s;
}

.plan-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.plan-card.active {
  border-color: var(--primary);
  background: #eff6ff;
}

.plan-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.plan-price {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

.plan-period {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.plan-features {
  list-style: none;
  text-align: left;
  font-size: 14px;
  margin-bottom: 24px;
}

.plan-features li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.plan-features li::before {
  content: "✓ ";
  color: var(--success);
  font-weight: 600;
}

/* ── Section Tiles ── */
.section-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.section-tile {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s, transform .15s;
  display: block;
  position: relative;
}

.section-tile:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.section-icon {
  font-size: 36px;
  margin-bottom: 12px;
  line-height: 1;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.section-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.section-tile-soon {
  opacity: .55;
  cursor: default;
}

.section-tile-soon:hover {
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}

.soon-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .plans-grid { grid-template-columns: 1fr; }
  .section-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .navbar { padding: 0 12px; }
  .card { padding: 14px; }
}
