/* ===================================================================
   LLAMABUZ ADMIN — ADMIN.CSS
   =================================================================== */

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

:root {
  --primary:        #e87a2a;
  --primary-dark:   #c96018;
  --primary-soft:   #fef3e8;
  --primary-glow:   rgba(232,122,42,0.22);

  --bg:             #f4f2ef;
  --bg-alt:         #eceae6;
  --card:           #ffffff;
  --border:         #e4e0d8;
  --border-strong:  #cdc7bc;

  --sidebar-bg:     #1c1814;
  --sidebar-text:   #c8bfb3;
  --sidebar-hover:  rgba(255,255,255,0.07);
  --sidebar-active: rgba(232,122,42,0.18);

  --text:           #1a1410;
  --text-muted:     #7a6f65;
  --text-light:     #b0a89d;

  --success:        #2ea855;
  --success-bg:     #edf8f2;
  --warning:        #c77d0a;
  --warning-bg:     #fff8e7;
  --danger:         #d93025;
  --danger-bg:      #fdf0ef;

  --sidebar-w:      230px;
  --header-h:       60px;
  --radius:         9px;
  --radius-lg:      15px;
  --radius-xl:      20px;

  --shadow-sm:      0 1px 4px rgba(0,0,0,0.07);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.09);
  --shadow-orange:  0 6px 20px -4px rgba(232,122,42,0.3);
  --shadow-card:    0 2px 10px rgba(0,0,0,0.06);

  --transition:     0.16s ease;
  --font-sans:      'Inter', system-ui, sans-serif;
  --font-display:   'Space Grotesk', 'Inter', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text); line-height: 1.6; font-size: 14px; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

/* ── Admin Sidebar (dark) ── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
  transition: transform 0.2s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-brand-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-orange);
}
.sidebar-brand-icon svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.5; }

.sidebar-brand-text { display: flex; flex-direction: column; }
.sidebar-brand-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: #fff; line-height: 1; }
.sidebar-brand-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav { flex: 1; padding: 10px 10px; }

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.25);
  padding: 0 7px;
  margin: 14px 0 5px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--sidebar-text);
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.6; }
.sidebar-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-link:hover svg { opacity: 1; }
.sidebar-link.active { background: var(--sidebar-active); color: #fff; }
.sidebar-link.active svg { opacity: 1; stroke: var(--primary); }

.sidebar-footer {
  padding: 10px 10px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

/* ── Auth overlay ── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

/* ── Main ── */
.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-h);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.hamburger {
  display: none;
  background: none;
  border: none;
  width: 34px; height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  cursor: pointer;
}
.hamburger:hover { background: var(--bg-alt); }
.hamburger svg { width: 18px; height: 18px; }

.content { padding: 28px 24px; max-width: 1080px; }

/* ── Page header ── */
.page-header { margin-bottom: 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.page-sub { color: var(--text-muted); font-size: 13px; margin-top: 3px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 600;
  border: 1.5px solid transparent;
  transition: all var(--transition); cursor: pointer;
  white-space: nowrap; font-family: inherit;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: #fff; border-color: transparent; box-shadow: var(--shadow-orange); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--bg-alt); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-alt); color: var(--text); }
.btn-success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }
.btn-lg { padding: 11px 22px; font-size: 14px; border-radius: 11px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Cards ── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); }
.card-body { padding: 20px 22px; }
.card-header { padding: 14px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat-card-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); display: flex; align-items: center; justify-content: space-between; }
.stat-card-label svg { width: 14px; height: 14px; }
.stat-card-value { font-family: var(--font-display); font-size: 24px; font-weight: 700; margin-top: 7px; line-height: 1.1; }
.stat-card.primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border-color: transparent; color: #fff; box-shadow: var(--shadow-orange); }
.stat-card.primary .stat-card-label { color: rgba(255,255,255,0.75); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.form-label.required::after { content: ' *'; color: var(--danger); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 13.5px; font-family: inherit; color: var(--text); background: var(--card);
  transition: border-color var(--transition), box-shadow var(--transition); outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.form-input::placeholder { color: var(--text-light); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a6f65' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-error { font-size: 11.5px; color: var(--danger); margin-top: 4px; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-active, .badge-validated, .badge-completed, .badge-paid { background: var(--success-bg); color: var(--success); }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-draft, .badge-rejected, .badge-cancelled, .badge-failed { background: var(--bg-alt); color: var(--text-muted); }
.badge-suspended { background: var(--danger-bg); color: var(--danger); }
.badge-approved { background: var(--primary-soft); color: var(--primary-dark); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th { background: var(--bg-alt); padding: 10px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-alt); }

/* ── Filters bar ── */
.filters-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.filters-bar .form-select { width: auto; min-width: 140px; }
.filters-bar .form-input { width: auto; flex: 1; min-width: 180px; }

/* ── Toolbar ── */
.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.modal { background: var(--card); border-radius: var(--radius-xl); width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.22); animation: slideUp 0.2s ease; }
.modal-header { padding: 20px 22px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.modal-close { width: 30px; height: 30px; border-radius: 7px; border: none; background: var(--bg-alt); cursor: pointer; display: grid; place-items: center; color: var(--text-muted); flex-shrink: 0; font-size: 18px; line-height: 1; transition: all var(--transition); }
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 20px 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 16px; box-shadow: var(--shadow-md); font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 9px; pointer-events: all; animation: slideUp 0.2s ease; max-width: 320px; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }

/* ── Skeleton ── */
.skeleton { background: linear-gradient(90deg, var(--bg-alt) 25%, var(--border) 50%, var(--bg-alt) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 7px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.45; }
.empty-state h3 { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.empty-state p { font-size: 13px; }

/* ── Chart bars ── */
.chart-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.chart-bar-label { width: 80px; font-size: 12px; color: var(--text-muted); text-align: right; flex-shrink: 0; }
.chart-bar-track { flex: 1; height: 22px; background: var(--bg-alt); border-radius: 5px; overflow: hidden; }
.chart-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); border-radius: 5px; transition: width 0.6s ease; display: flex; align-items: center; padding-left: 8px; }
.chart-bar-fill span { font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.9); }
.chart-bar-val { width: 40px; font-size: 12px; font-weight: 700; text-align: left; flex-shrink: 0; }

/* ── Spinner ── */
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utility ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.text-sm { font-size: 12.5px; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.font-bold { font-weight: 700; }
.font-display { font-family: var(--font-display); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.sep { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Sidebar overlay ── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 40; }

/* ── Responsive ── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-230px); width: 230px; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-md); }
  .sidebar-overlay.visible { display: block; }
  .main { margin-left: 0; }
  .hamburger { display: flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 580px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ── Accessibility & motion ── */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

#content { animation: contentFadeIn 0.25s ease both; }
@keyframes contentFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
