/* ============================================================
   CoffeeOrder Pro — Admin Dashboard CSS
   ============================================================ */

:root {
  --sidebar-w: 240px;
  --sidebar-collapsed: 64px;
  --header-h: 58px;

  --adm-bg:        #f5f0eb;
  --adm-card:      #ffffff;
  --adm-border:    #e5ddd4;
  --adm-text:      #1a0900;
  --adm-muted:     #6b5444;
  --adm-sidebar:   #1a0900;
  --adm-sidebar-hover: rgba(255,255,255,.07);
  --adm-sidebar-active: rgba(201,168,76,.13);
  --adm-accent:    #8b4513;
  --adm-gold:      #c9a84c;
  --adm-success:   #15803d;
  --adm-warning:   #d97706;
  --adm-error:     #b91c1c;
  --adm-info:      #1d4ed8;

  --shadow-card:   0 1px 4px rgba(26,9,0,.07), 0 4px 16px rgba(26,9,0,.04);
  --radius:        10px;
  --transition:    180ms ease;
}

[data-theme="dark"] {
  --adm-bg:      #0d0a07;
  --adm-card:    #1a1410;
  --adm-border:  #2a2018;
  --adm-text:    #e2d9cf;
  --adm-muted:   #8a7a6a;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--adm-bg);
  color: var(--adm-text);
  min-height: 100vh;
}
a { color: var(--adm-accent); text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

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

/* ── SIDEBAR ────────────────────────────────────────────────── */
.adm-sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--adm-sidebar);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: width var(--transition);
  overflow: hidden;
}

.adm-sidebar.collapsed { width: var(--sidebar-collapsed); }

.adm-sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  white-space: nowrap;
  overflow: hidden;
}

.adm-sidebar__logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #8b4513, #3d1f00);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.adm-sidebar__logo-text {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.adm-sidebar__logo-sub {
  font-size: .65rem;
  color: var(--adm-gold);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.adm-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.adm-nav__section {
  padding: 10px 16px 4px;
  font-size: .65rem;
  font-weight: 700;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  letter-spacing: .12em;
  white-space: nowrap;
  overflow: hidden;
}

.adm-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: rgba(255,255,255,.7);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  border-radius: 0;
}

.adm-nav__item:hover {
  background: var(--adm-sidebar-hover);
  color: #fff;
}

.adm-nav__item.active {
  background: var(--adm-sidebar-active);
  color: var(--adm-gold);
  border-right: 3px solid var(--adm-gold);
}

.adm-nav__icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.adm-nav__badge {
  margin-left: auto;
  background: var(--adm-error);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

.adm-sidebar__footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
}

.adm-sidebar__avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--adm-gold), #a07830);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: #1a0a00;
  font-size: .85rem;
  flex-shrink: 0;
}

.adm-sidebar__user-name  { font-size: .8rem; font-weight: 600; color: #fff; }
.adm-sidebar__user-role  { font-size: .68rem; color: rgba(255,255,255,.4); }

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

.adm-main.collapsed { margin-left: var(--sidebar-collapsed); }

/* ── TOPBAR ─────────────────────────────────────────────────── */
.adm-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--adm-card);
  border-bottom: 1px solid var(--adm-border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.adm-topbar__toggle {
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--adm-muted);
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}

.adm-topbar__toggle:hover { background: var(--adm-bg); color: var(--adm-text); }

.adm-topbar__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--adm-text);
  flex: 1;
}

.adm-topbar__search {
  flex: 0 1 280px;
}

.adm-topbar__search input {
  width: 100%;
  padding: 7px 14px;
  background: var(--adm-bg);
  border: 1px solid var(--adm-border);
  border-radius: 20px;
  font-size: .85rem;
  color: var(--adm-text);
  outline: none;
}

.adm-topbar__actions { display: flex; align-items: center; gap: 4px; }

.adm-icon-btn {
  position: relative;
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--adm-muted);
  font-size: .95rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}

.adm-icon-btn:hover { background: var(--adm-bg); color: var(--adm-text); }
.adm-icon-btn .badge {
  position: absolute; top: 3px; right: 3px;
  width: 16px; height: 16px;
  background: var(--adm-error);
  color: #fff; font-size: .6rem; font-weight: 700;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

/* ── CONTENT ─────────────────────────────────────────────────── */
.adm-content { padding: 20px; flex: 1; }

/* ── PAGE HEADER ─────────────────────────────────────────────── */
.adm-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.adm-page-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--adm-text);
}

.adm-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  color: var(--adm-muted);
  margin-bottom: 4px;
}

.adm-breadcrumb a { color: var(--adm-muted); }
.adm-breadcrumb a:hover { color: var(--adm-accent); }

/* ── CARDS ──────────────────────────────────────────────────── */
.adm-card {
  background: var(--adm-card);
  border-radius: var(--radius);
  border: 1px solid var(--adm-border);
  box-shadow: var(--shadow-card);
}

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

.adm-card__title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--adm-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.adm-card__body { padding: 20px; }

/* ── STAT CARDS ─────────────────────────────────────────────── */
.adm-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.adm-stat {
  background: var(--adm-card);
  border: 1px solid var(--adm-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.adm-stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--adm-accent);
}

.adm-stat--gold::before  { background: var(--adm-gold); }
.adm-stat--green::before { background: var(--adm-success); }
.adm-stat--blue::before  { background: var(--adm-info); }
.adm-stat--red::before   { background: var(--adm-error); }

.adm-stat__icon {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.adm-stat__value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--adm-text);
  line-height: 1;
  margin-bottom: 4px;
}

.adm-stat__label {
  font-size: .75rem;
  color: var(--adm-muted);
  font-weight: 500;
}

.adm-stat__delta {
  position: absolute;
  top: 20px;
  right: 16px;
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.adm-stat__delta--up   { background: #dcfce7; color: #16a34a; }
.adm-stat__delta--down { background: #fee2e2; color: #dc2626; }

/* ── GRID LAYOUTS ───────────────────────────────────────────── */
.adm-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.adm-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }

@media (max-width: 1100px) {
  .adm-grid-2, .adm-grid-3 { grid-template-columns: 1fr; }
}

/* ── TABLE ──────────────────────────────────────────────────── */
.adm-table-wrap { overflow-x: auto; }

.adm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

.adm-table thead th {
  padding: 11px 16px;
  background: var(--adm-bg);
  color: var(--adm-muted);
  font-weight: 700;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  text-align: left;
  border-bottom: 1px solid var(--adm-border);
  white-space: nowrap;
}

.adm-table tbody tr {
  border-bottom: 1px solid var(--adm-border);
  transition: background var(--transition);
}

.adm-table tbody tr:hover { background: var(--adm-bg); }
.adm-table tbody tr:last-child { border-bottom: none; }

.adm-table tbody td {
  padding: 12px 16px;
  color: var(--adm-text);
  vertical-align: middle;
}

/* ── BADGES / STATUS ────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-novo      { background: #eff6ff; color: #2563eb; }
.status-pago      { background: #f0fdf4; color: #16a34a; }
.status-separacao { background: #fefce8; color: #ca8a04; }
.status-torra     { background: #fff7ed; color: #ea580c; }
.status-embalagem { background: #fdf4ff; color: #9333ea; }
.status-enviado   { background: #f0f9ff; color: #0284c7; }
.status-entregue  { background: #f0fdf4; color: #15803d; }
.status-cancelado { background: #fef2f2; color: #dc2626; }
.status-ativa     { background: #f0fdf4; color: #15803d; }
.status-pausada   { background: #fefce8; color: #ca8a04; }

/* ── FORMS ──────────────────────────────────────────────────── */
.adm-form-group { margin-bottom: 16px; }

.adm-label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  color: var(--adm-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.adm-input, .adm-select, .adm-textarea {
  width: 100%;
  padding: 9px 13px;
  background: var(--adm-card);
  border: 1.5px solid var(--adm-border);
  border-radius: 8px;
  font-size: .875rem;
  color: var(--adm-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  font-family: inherit;
}

.adm-input:focus, .adm-select:focus, .adm-textarea:focus {
  border-color: var(--adm-accent);
  box-shadow: 0 0 0 3px rgba(139,69,19,.1);
}

.adm-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2364748b'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.adm-textarea { resize: vertical; min-height: 90px; }

.adm-form-grid   { display: grid; gap: 16px; }
.adm-form-grid-2 { grid-template-columns: 1fr 1fr; }
.adm-form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

@media (max-width: 768px) {
  .adm-form-grid-2, .adm-form-grid-3 { grid-template-columns: 1fr; }
}

/* ── BUTTONS ────────────────────────────────────────────────── */
.adm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: .85rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.adm-btn--primary  { background: var(--adm-accent); color: #fff; border-color: var(--adm-accent); }
.adm-btn--primary:hover { background: #a0522d; }
.adm-btn--secondary{ background: var(--adm-bg); color: var(--adm-text); border-color: var(--adm-border); }
.adm-btn--secondary:hover { border-color: var(--adm-accent); color: var(--adm-accent); }
.adm-btn--danger   { background: #fee2e2; color: var(--adm-error); border-color: #fca5a5; }
.adm-btn--danger:hover { background: var(--adm-error); color: #fff; }
.adm-btn--success  { background: #dcfce7; color: var(--adm-success); border-color: #86efac; }
.adm-btn--success:hover { background: var(--adm-success); color: #fff; }
.adm-btn--sm { padding: 5px 12px; font-size: .78rem; }
.adm-btn--icon { width: 32px; height: 32px; padding: 0; justify-content: center; }

/* ── CHART PLACEHOLDER ──────────────────────────────────────── */
.adm-chart-wrap {
  position: relative;
  width: 100%;
  height: 220px;
}

/* ── PAGINATION ─────────────────────────────────────────────── */
.adm-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--adm-border);
  font-size: .8rem;
  color: var(--adm-muted);
  flex-wrap: wrap;
  gap: 8px;
}

.adm-pagination__btns { display: flex; gap: 4px; }

.adm-page-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--adm-border);
  background: var(--adm-card);
  border-radius: 6px;
  font-size: .8rem;
  color: var(--adm-text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.adm-page-btn:hover, .adm-page-btn.active {
  background: var(--adm-accent);
  border-color: var(--adm-accent);
  color: #fff;
}

/* ── ALERTS ─────────────────────────────────────────────────── */
.adm-alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: .85rem;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.adm-alert--success { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }
.adm-alert--error   { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.adm-alert--warning { background: #fffbeb; color: #b45309; border: 1px solid #fcd34d; }

/* ── MODAL ──────────────────────────────────────────────────── */
.adm-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.adm-modal-overlay.open { opacity: 1; pointer-events: auto; }

.adm-modal {
  background: var(--adm-card);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  transform: translateY(20px);
  transition: transform .25s;
}

.adm-modal-overlay.open .adm-modal { transform: translateY(0); }

.adm-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--adm-border);
}

.adm-modal__header h3 { font-size: 1rem; font-weight: 700; }
.adm-modal__body      { padding: 20px; }
.adm-modal__footer    { padding: 16px 20px; border-top: 1px solid var(--adm-border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── UPLOAD ─────────────────────────────────────────────────── */
.adm-upload-zone {
  border: 2px dashed var(--adm-border);
  border-radius: 10px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.adm-upload-zone:hover,
.adm-upload-zone.drag-over {
  border-color: var(--adm-accent);
  background: rgba(139,69,19,.04);
}

/* ── RESPONSIVE SIDEBAR ─────────────────────────────────────── */
@media (max-width: 900px) {
  .adm-sidebar {
    transform: translateX(-100%);
    transition: transform .25s;
    width: var(--sidebar-w) !important;
  }
  .adm-sidebar.mobile-open { transform: translateX(0); }
  .adm-main { margin-left: 0 !important; }
  .adm-topbar__search { display: none; }
}

/* ── MISC ────────────────────────────────────────────────────── */
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.text-muted    { color: var(--adm-muted); }
.text-sm       { font-size: .8rem; }
.text-xs       { font-size: .72rem; }
.font-bold     { font-weight: 700; }
.flex          { display: flex; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.gap-sm        { gap: 8px; }
.gap-md        { gap: 14px; }
.items-center  { align-items: center; }
.flex-wrap     { flex-wrap: wrap; }
.mt-md         { margin-top: 14px; }
.mb-md         { margin-bottom: 14px; }
.w-full        { width: 100%; }
.hidden        { display: none !important; }
.spinner       { width: 18px; height: 18px; border: 2px solid var(--adm-border); border-top-color: var(--adm-accent); border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.product-thumb {
  width: 44px; height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--adm-bg);
}

.adm-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--adm-muted);
}

.adm-empty__icon { font-size: 2.5rem; margin-bottom: 12px; }

/* ── TOAST ──────────────────────────────────────────────────── */
.adm-toast-container {
  position: fixed;
  top: 70px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.adm-toast {
  background: var(--adm-card);
  border: 1px solid var(--adm-border);
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  font-size: .85rem;
  font-weight: 500;
  display: flex;
  gap: 8px;
  pointer-events: auto;
  animation: toastIn .2s ease;
  max-width: 300px;
}

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

@keyframes toastIn { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
