/* ============================================================
   ADMIN CSS — Hortifruti
   ============================================================ */
:root {
  --green:   #2d6a4f;
  --green2:  #40916c;
  --lime:    #74c69d;
  --lime2:   #d8f3dc;
  --cream:   #f8fdf9;
  --dark:    #1b1b1b;
  --gray:    #6b7280;
  --border:  #d4edda;
  --red:     #dc2626;
  --yellow:  #d97706;
  --blue:    #2563eb;
  --sidebar: 240px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--cream);
  color: var(--dark);
  min-height: 100vh;
  display: flex;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar);
  background: var(--green);
  min-height: 100vh;
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 200;
  transition: transform .25s;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.brand-icon { font-size: 28px; }
.brand-name { color: #fff; font-size: 17px; font-weight: 700; }
.brand-sub  { color: rgba(255,255,255,.55); font-size: 11px; }

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,.72);
  text-decoration: none; font-size: 14px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .18s;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-link.active { color: #fff; border-left-color: var(--lime); background: rgba(255,255,255,.1); }
.nav-icon { font-size: 16px; }

.sidebar-foot {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.12);
}
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 999px;
  background: rgba(255,255,255,.2); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
  /* Show first letter */
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-name  { color: #fff;  font-size: 13px; font-weight: 600; }
.user-role  { color: rgba(255,255,255,.55); font-size: 11px; text-transform: capitalize; }
.logout-link { color: rgba(255,255,255,.55); font-size: 13px; text-decoration: none; transition: color .15s; }
.logout-link:hover { color: #fff; }

/* ── LAYOUT ── */
.layout-body { margin-left: var(--sidebar); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 100;
}
.menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; }
.page-title  { font-size: 18px; font-weight: 700; flex: 1; }
.topbar-right { display: flex; gap: 10px; }

.main-content { padding: 24px; flex: 1; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none;
  transition: all .18s;
}
.btn-primary   { background: var(--green);  color: #fff; }
.btn-primary:hover { background: #1a4731; }
.btn-ghost     { background: #f3f4f6; color: var(--dark); }
.btn-ghost:hover   { background: #e5e7eb; }
.btn-danger    { background: #fee2e2; color: var(--red); }
.btn-whatsapp  { background: #25d366; color: #fff; }
.btn-whatsapp:hover { background: #1ebe5d; }
.btn-sm   { padding: 6px 13px; font-size: 13px; }
.btn-block{ width: 100%; justify-content: center; padding: 12px; }

/* ── FORMS ── */
.form-group   { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--green); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 10px 13px;
  border: 2px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 15px; background: #fff;
  transition: border-color .18s;
}
.form-control:focus { outline: none; border-color: var(--lime); }
.form-control-sm { padding: 6px 10px; font-size: 13px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── CARDS ── */
.card {
  background: #fff; border: 1.5px solid var(--border);
  border-radius: 12px; padding: 20px;
}
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--green); }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge.pendente  { background: #fef9c3; color: #a16207; }
.badge.separando { background: #dbeafe; color: #1d4ed8; }
.badge.pronto    { background: #dcfce7; color: #15803d; }
.badge.entregue  { background: #f3f4f6; color: var(--gray); }
.badge.cancelado { background: #fee2e2; color: var(--red); }

/* ── ALERTS ── */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-danger { background: #fee2e2; color: var(--red); }

/* ── FILTER BAR ── */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff; font-size: 13px; font-weight: 600;
  text-decoration: none; color: var(--dark); transition: all .18s;
}
.filter-chip:hover  { border-color: var(--lime); }
.filter-chip.active { background: var(--green); border-color: var(--green); color: #fff; }
.chip-count { background: rgba(255,255,255,.3); border-radius: 999px; padding: 1px 6px; font-size: 11px; }
.filter-chip:not(.active) .chip-count { background: var(--lime2); color: var(--green); }

/* ── PEDIDO CARDS ── */
.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 14px; }
.pedido-card {
  background: #fff; border: 1.5px solid var(--border);
  border-radius: 12px; overflow: hidden;
  border-left: 4px solid var(--border);
  transition: box-shadow .18s;
}
.pedido-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.pedido-card.status-pendente  { border-left-color: #fbbf24; }
.pedido-card.status-separando { border-left-color: #60a5fa; }
.pedido-card.status-pronto    { border-left-color: #4ade80; }
.pedido-card.status-entregue  { border-left-color: var(--gray); }
.pedido-card.status-cancelado { border-left-color: var(--red); opacity: .7; }

.pedido-card-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 8px; }
.pedido-card-body { padding: 0 14px 10px; }
.pedido-card-foot { padding: 10px 14px; border-top: 1px solid #f3f4f6; }
.pedido-num  { font-family: 'Space Mono', monospace; font-weight: 700; font-size: 14px; margin-right: 8px; }
.pedido-hora { font-size: 11px; color: var(--gray); }
.cliente-info { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.pedido-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--gray); margin-bottom: 6px; }
.pedido-valor { font-weight: 700; color: var(--green); }

/* ── PROGRESS ── */
.progress-bar { background: #f3f4f6; border-radius: 999px; height: 6px; overflow: hidden; }
.progress-fill { background: var(--green2); height: 100%; border-radius: 999px; transition: width .4s; }

/* ── DETALHE PEDIDO ── */
.detalhe-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.detalhe-title  { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.detalhe-meta   { font-size: 13px; color: var(--gray); margin-top: 4px; display: flex; gap: 16px; }
.detalhe-actions{ display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.detalhe-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid #f3f4f6; font-size: 14px; }
.info-row:last-child { border-bottom: none; }
.info-row label { color: var(--gray); font-size: 12px; }
.text-green { color: var(--green2); font-weight: 600; }
.text-red   { color: var(--red);    font-weight: 600; }

/* ── ITENS LIST ── */
.itens-list { display: flex; flex-direction: column; gap: 2px; }
.item-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid #f9fafb;
  transition: background .15s;
}
.item-row.status-separado { background: #f0fdf4; }
.item-row.status-falta    { background: #fff7ed; opacity: .75; }
.item-foto { flex-shrink: 0; }
.item-foto img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; border: 1.5px solid var(--border); }
.item-foto-placeholder { width: 48px; height: 48px; border-radius: 8px; background: var(--lime2); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.item-info  { flex: 1; min-width: 0; }
.item-cat   { font-size: 11px; color: var(--green2); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.item-nome  { font-size: 14px; font-weight: 700; }
.item-qty   { font-size: 12px; color: var(--gray); }
.item-obs   { font-size: 12px; color: #a16207; margin-top: 2px; }
.item-status-ctrl { display: flex; gap: 6px; flex-shrink: 0; }
.status-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1.5px solid var(--border);
  background: #fff; font-size: 16px; cursor: pointer; transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}
.status-btn.active         { background: var(--lime2); border-color: var(--lime); }
.status-btn.active.falta   { background: #fef3c7; border-color: #fbbf24; }
.status-btn.active.pendente{ background: #f3f4f6; border-color: var(--gray); }
.status-btn:hover          { transform: scale(1.12); }

/* ── PRODUTOS TABLE ── */
.table-wrap { background: #fff; border: 1.5px solid var(--border); border-radius: 12px; overflow: hidden; }
.table-topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 11px 14px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--gray); font-weight: 700; background: #f9fafb; border-bottom: 1px solid var(--border); }
tbody td { padding: 11px 14px; border-bottom: 1px solid #f3f4f6; font-size: 14px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f9fafb; }

.prod-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; border: 1.5px solid var(--border); }
.prod-thumb-ph { width: 40px; height: 40px; border-radius: 8px; background: var(--lime2); display: flex; align-items: center; justify-content: center; font-size: 18px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray); }
.empty-icon  { font-size: 48px; margin-bottom: 10px; }

/* ── WA LINK ── */
.wa-link { color: #25d366; text-decoration: none; font-weight: 600; }
.wa-link:hover { text-decoration: underline; }

/* ── LOGIN ── */
body.login-page { background: var(--cream); display: flex; align-items: center; justify-content: center; }
.login-card  { background: #fff; border: 1.5px solid var(--border); border-radius: 16px; padding: 40px 36px; width: 100%; max-width: 380px; box-shadow: 0 8px 32px rgba(45,106,79,.1); }
.login-logo  { font-size: 40px; text-align: center; margin-bottom: 8px; }
.login-title { text-align: center; font-size: 22px; font-weight: 700; }
.login-sub   { text-align: center; color: var(--gray); font-size: 14px; margin-bottom: 28px; }
.login-form  { margin-top: 4px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .layout-body { margin-left: 0; }
  .menu-toggle { display: block; }
  .detalhe-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .card-list { grid-template-columns: 1fr; }
}
