/* Catalog by Ovvro — compiled stylesheet (no build step)
   Hand-rolled utility + component system matching app.ovvro.com's visual language. */

:root {
  --primary: #6C3FC5;
  --primary-dark: #522F99;
  --primary-light: #EDE9FB;
  --accent: #E63B75;
  --accent-dark: #C72F61;
  --gold: #F5A623;
  --text-dark: #1A1A2E;
  --text-muted: #6B7280;
  --bg: #F8F7FF;
  --card-bg: #FFFFFF;
  --border: #E5E7EB;
  --card-radius: 16px;
  --card-shadow: 0 2px 8px rgba(108, 63, 197, 0.08);
  --sidebar-width: 260px;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-dark);
  font-family: 'Tajawal', sans-serif;
  direction: rtl;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: 'Cairo', sans-serif;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Icons ---------- */
.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
.icon-lg { width: 24px; height: 24px; }
.icon-sm { width: 14px; height: 14px; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-main { flex: 1; min-width: 0; padding: 24px; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo { display: flex; align-items: center; gap: 8px; padding: 0 8px 20px; font-family: 'Cairo', sans-serif; font-weight: 700; font-size: 18px; }

.sidebar-section-title { font-size: 12px; color: rgba(255,255,255,0.6); padding: 16px 12px 6px; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
  margin-bottom: 2px;
}

.sidebar-item:hover { background: rgba(255,255,255,0.08); }

.sidebar-item.active {
  background: #fff;
  color: var(--primary);
  font-weight: 700;
}

.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.15); }

/* ---------- Top header ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.topbar-icons { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card-bg); border: 1px solid var(--border);
  color: var(--text-dark);
}
.icon-btn:hover { background: #F3F4F6; }

/* ---------- Company switcher (admin sidebar) ---------- */
.company-switcher { position: relative; margin-bottom: 8px; }
.company-switcher-box {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.company-switcher-box:hover { background: rgba(255,255,255,0.18); }
.company-switcher-name { font-size: 13px; font-weight: 700; color: #fff; display:flex; align-items:center; gap:6px; }
.company-switcher-sub { font-size: 11px; color: rgba(255,255,255,0.65); margin-top: 2px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #22C55E; display: inline-block; flex-shrink:0; }

.company-switcher-panel {
  position: absolute; top: calc(100% + 6px); right: 0; left: 0;
  background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  padding: 10px; z-index: 50; color: var(--text-dark); max-height: 320px; overflow-y: auto;
}
.company-switcher-panel input { margin-bottom: 8px; }
.company-switcher-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.company-switcher-item:hover { background: var(--primary-light); }
.company-switcher-empty { padding: 10px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ---------- Block reorder list (landing builder) ---------- */
.block-row { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; background: #fff; }
.block-row.dragging { opacity: 0.4; }
.block-drag-handle { cursor: grab; color: var(--text-muted); }
.block-row .block-name { flex: 1; font-weight: 600; }

/* ---------- Toggle switch ---------- */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track { position: absolute; inset: 0; background: #D1D5DB; border-radius: 999px; transition: .15s; }
.switch-track::before { content: ""; position: absolute; width: 16px; height: 16px; right: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::before { transform: translateX(-18px); }

/* ---------- Cards ---------- */
.card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 20px;
}

.stat-card { text-align: center; padding: 24px 16px; }
.stat-card .stat-value { font-size: 28px; font-weight: 800; font-family: 'Cairo', sans-serif; color: var(--text-dark); }
.stat-card .stat-label { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  border: none;
  transition: opacity .15s ease, transform .05s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary { background: #fff; color: var(--text-dark); border: 1px solid var(--border); }
.btn-secondary:hover { background: #F3F4F6; }

.btn-purple { background: var(--primary); color: #fff; }
.btn-purple:hover { background: var(--primary-dark); }

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

.btn-danger { background: #fff; color: #DC2626; border: 1px solid #FCA5A5; }
.btn-danger:hover { background: #FEF2F2; }

.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-dark);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: #DC2626; margin-top: 4px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-purple { background: var(--primary-light); color: var(--primary); }
.badge-gold { background: #FDF0DA; color: var(--gold); }
.badge-green { background: #DCFCE7; color: #16A34A; }
.badge-red { background: #FEE2E2; color: #DC2626; }
.badge-gray { background: #F3F4F6; color: var(--text-muted); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th {
  text-align: right;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
table.data-table td { padding: 14px; border-bottom: 1px solid var(--border); }
table.data-table tr:last-child td { border-bottom: none; }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
}
.bottom-nav-inner { display: flex; justify-content: space-around; }
.bottom-nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--text-muted); padding: 4px 8px; }
.bottom-nav-item.active { color: var(--primary); font-weight: 700; }

/* ---------- Utilities ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.grid { display: grid; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; } .text-lg { font-size: 18px; } .text-xl { font-size: 22px; } .text-2xl { font-size: 28px; }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; }
.mb-1{margin-bottom:4px;} .mb-2{margin-bottom:8px;} .mb-3{margin-bottom:12px;} .mb-4{margin-bottom:16px;} .mb-6{margin-bottom:24px;}
.mt-1{margin-top:4px;} .mt-2{margin-top:8px;} .mt-3{margin-top:12px;} .mt-4{margin-top:16px;} .mt-6{margin-top:24px;}
.w-full { width: 100%; }
.rounded { border-radius: var(--card-radius); }
.hidden { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .app-main { padding: 16px; padding-bottom: 90px; }
  .bottom-nav { display: block; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
