/* ── OCR Admin — Vuexy‑Inspired Light Theme ── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Core palette */
  --bg-body: #fafafa;
  --bg-card: #ffffff;
  --bg-sidebar: #0a0a0a;
  --bg-sidebar-hover: #171717;

  /* Text */
  --text-heading: #111827;
  --text-body: #4b5563;
  --text-muted: #9ca3af;
  --text-sidebar: #888888;
  --text-sidebar-muted: #555555;

  /* Accent */
  --primary: #000000;
  --primary-light: #f3f4f6;
  --primary-dark: #374151;

  /* Status */
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-light: rgba(59, 130, 246, 0.1);

  /* Borders & Shadows */
  --border: #eaeaea;
  --shadow-card: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  --shadow-card-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -2px rgba(0, 0, 0, 0.02);

  /* Layout */
  --sidebar-width: 260px;
  --radius-lg: 8px;
  --radius-md: 6px;
  --radius-sm: 4px;
  --transition: all 0.15s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-body);
  color: var(--text-body);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  padding: 24px 16px;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
}

.sidebar-brand .logo-img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px;
}

.sidebar-brand h1 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.sidebar-brand .subtitle {
  font-size: 11px;
  color: var(--text-sidebar-muted);
  font-weight: 400;
}

.sidebar-nav {
  list-style: none;
  flex: 1;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--text-sidebar);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 400;
  transition: var(--transition);
  margin-bottom: 2px;
}

.sidebar-nav li a:hover {
  background: var(--bg-sidebar-hover);
  color: #ededed;
}

.sidebar-nav li a.active {
  background: #ededed;
  color: #000000;
  font-weight: 500;
  box-shadow: none;
}

.sidebar-nav li a .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.sidebar-nav li a .icon svg {
  opacity: 0.7;
  transition: var(--transition);
}

.sidebar-nav li a:hover .icon svg,
.sidebar-nav li a.active .icon svg {
  opacity: 1;
}

/* ── Main Content ── */

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 28px 32px;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 4px;
}

.page-header p {
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Cards ── */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Stat Cards (Dashboard) ── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  border: 1px solid var(--border);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.stat-card .icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.5px;
}

.stat-card .label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ── Forms ── */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-heading);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-heading);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236d6b77' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.6;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--bg-body);
  color: var(--primary);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #21b862;
  box-shadow: 0 3px 12px rgba(40, 199, 111, 0.3);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-ghost {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-heading);
  box-shadow: var(--shadow-card);
}

.btn-ghost:hover {
  background: var(--bg-body);
  border-color: #d1d5db;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ── Tables ── */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-body);
}

tr:hover td {
  background: var(--bg-body);
}

/* ── Badge ── */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.badge-accent {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-info {
  background: var(--info-light);
  color: var(--info);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

/* ── Toggle Switch ── */

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
}

.toggle input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #d4d3d9;
  border-radius: 24px;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle input:checked + .toggle-slider::after {
  transform: translateX(20px);
}

/* ── Code Editor Panel ── */

.editor-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  min-height: 600px;
}

.file-tree {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  overflow-y: auto;
  max-height: 700px;
  box-shadow: var(--shadow-card);
}

.file-tree h4 {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  padding: 8px 12px;
  margin-top: 12px;
}

.file-tree h4:first-child { margin-top: 0; }

.file-tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-body);
  transition: var(--transition);
  text-decoration: none;
}

.file-tree-item:hover {
  background: var(--bg-body);
  color: var(--text-heading);
}

.file-tree-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}

.editor-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.editor-toolbar .file-name {
  font-size: 13px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.code-editor {
  flex: 1;
  width: 100%;
  min-height: 500px;
  padding: 16px;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: #ededed;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.7;
  resize: vertical;
  tab-size: 4;
}

.code-editor:focus {
  outline: none;
  border-color: #666;
}

/* ── Tags Input ── */

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-height: 48px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
}

.tag .remove {
  cursor: pointer;
  opacity: 0.6;
  transition: var(--transition);
}

.tag .remove:hover {
  opacity: 1;
  color: var(--danger);
}

.tag-input {
  border: none;
  background: transparent;
  color: var(--text-heading);
  font-size: 14px;
  outline: none;
  min-width: 120px;
  flex: 1;
}

/* ── Slider ── */

.range-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.range-group input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #e4e3e8;
  border-radius: 6px;
  outline: none;
}

.range-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 4px var(--primary-light);
}

.range-value {
  min-width: 44px;
  text-align: center;
  font-weight: 600;
  color: var(--primary);
  font-size: 15px;
}

/* ── Toast Notification ── */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  color: var(--text-heading);
  font-size: 14px;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }

/* ── Modal ── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(47, 43, 61, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.show { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 32px;
  width: 560px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 12px 24px -12px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.modal h3 {
  font-size: 18px;
  color: var(--text-heading);
  margin-bottom: 24px;
}

/* ── Checkbox List ── */

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-body);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  color: var(--text-body);
}

.checkbox-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.checkbox-item input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

/* ── Empty State ── */

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
}

/* ── Text Helpers ── */

.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }
.text-warning { color: var(--warning); }

/* ── Utility Classes ── */
.flex-align { display: flex; align-items: center; gap: 6px; }
.flex-align-lg { display: flex; align-items: center; gap: 8px; }

.icon-text-align {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}

.icon-sm { width: 14px; height: 14px; display: inline-block; }
.icon-md { width: 16px; height: 16px; display: inline-block; }
.icon-lg { width: 20px; height: 20px; display: inline-block; }
.icon-xl { width: 48px; height: 48px; display: inline-block; }

/* ── Responsive ── */

@media (max-width: 1024px) {
  .editor-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 16px; }
}
