/* ============================================================
   admin.css — Panel de administración
   ============================================================ */

:root {
  --cp:    #27AE60;
  --cpd:   #1e8449;
  --cpl:   #d5f5e3;
  --cs:    #F39C12;
  --csd:   #d68910;
  --bg:    #f4f7f6;
  --side:  #1a2e22;
  --sideH: #243d2e;
  --text:  #2c3e50;
  --mute:  #7f8c8d;
  --rad:   12px;
  --shad:  0 2px 16px rgba(0,0,0,.07);
  --tr:    all .2s ease;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body.admin-body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: 240px; min-width: 240px;
  background: var(--side);
  color: #e8f5e9;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 300; overflow-y: auto;
  transition: var(--tr);
}
.sidebar-brand {
  padding: 1.4rem 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: .6rem;
}
.sidebar-brand img { width:36px;height:36px;border-radius:10px;object-fit:cover; }
.sidebar-brand-icon { font-size: 2rem; line-height: 1; }
.sidebar-brand-name { font-weight: 800; font-size: 1rem; color: #fff; }
.sidebar-brand-sub  { font-size: .72rem; color: rgba(255,255,255,.5); }

.sidebar-nav { padding: 1rem 0; flex: 1; }
.nav-group-label {
  font-size: .7rem; font-weight: 700; letter-spacing: .1em;
  color: rgba(255,255,255,.35); text-transform: uppercase;
  padding: .8rem 1.2rem .3rem;
}
.sidebar-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1.2rem; color: rgba(255,255,255,.7);
  text-decoration: none; font-weight: 600; font-size: .9rem;
  border-radius: 0; transition: var(--tr);
  border-left: 3px solid transparent;
}
.sidebar-link:hover, .sidebar-link.active {
  background: var(--sideH);
  color: #fff;
  border-left-color: var(--cp);
}
.sidebar-link i { font-size: 1.1rem; width: 20px; text-align: center; }

.sidebar-footer { padding: 1rem 1.2rem; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar-footer a { color: rgba(255,255,255,.5); font-size: .82rem; text-decoration:none; transition:var(--tr); }
.sidebar-footer a:hover { color: #fff; }

/* ─── Main content ───────────────────────────────────────────── */
.admin-main {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

.admin-topbar {
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  padding: .9rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 200;
  box-shadow: 0 1px 8px rgba(0,0,0,.05);
}
.topbar-title { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.topbar-user  { font-size: .85rem; color: var(--mute); font-weight: 600; }

.admin-content { flex: 1; padding: 1.5rem; }

/* ─── Stat cards ──────────────────────────────────────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: #fff; border-radius: var(--rad); box-shadow: var(--shad);
  padding: 1.25rem; display: flex; align-items: flex-start; gap: 1rem;
  transition: var(--tr);
}
.stat-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.1); transform: translateY(-2px); }
.stat-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.stat-icon.green  { background: var(--cpl); }
.stat-icon.yellow { background: #fef9e7; }
.stat-icon.blue   { background: #eaf4fb; }
.stat-icon.red    { background: #fdedec; }
.stat-info { flex: 1; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--mute); font-weight: 600; margin-top: .1rem; }

/* ─── Tables ──────────────────────────────────────────────────── */
.table-card { background: #fff; border-radius: var(--rad); box-shadow: var(--shad); overflow: hidden; }
.table-card-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid #f0f0f0;
  display: flex; align-items: center; justify-content: space-between;
}
.table-card-title { font-weight: 800; font-size: 1rem; }

.table { margin: 0; }
.table thead th {
  background: #fafafa; font-weight: 700; font-size: .82rem;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--mute); border-bottom: 2px solid #f0f0f0;
  padding: .8rem 1rem; white-space: nowrap;
}
.table tbody td { padding: .85rem 1rem; vertical-align: middle; border-bottom: 1px solid #f8f8f8; font-size: .9rem; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fafff9; }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  font-family: 'Nunito', sans-serif; font-weight: 700;
  border-radius: 50px; padding: .55rem 1.3rem;
  transition: var(--tr); letter-spacing: .02em;
}
.btn-primary   { background: var(--cp); border-color: var(--cp); color: #fff; }
.btn-primary:hover { background: var(--cpd); border-color: var(--cpd); color: #fff; transform: translateY(-1px); }
.btn-success   { background: #27ae60; border-color: #27ae60; color: #fff; }
.btn-warning   { background: var(--cs); border-color: var(--cs); color: #fff; }
.btn-warning:hover { background: var(--csd); border-color: var(--csd); color: #fff; }
.btn-danger    { background: #e74c3c; border-color: #e74c3c; color: #fff; }
.btn-danger:hover  { background: #c0392b; border-color: #c0392b; color: #fff; }
.btn-sm { padding: .3rem .8rem; font-size: .82rem; }
.btn-outline-secondary { border: 2px solid #dee2e6; color: var(--mute); }
.btn-outline-secondary:hover { border-color: #ced4da; background: #f8f9fa; color: var(--text); }
.btn-icon { padding: .4rem .6rem; line-height: 1; }

/* ─── Forms ───────────────────────────────────────────────────── */
.form-control, .form-select {
  font-family: 'Nunito', sans-serif;
  border: 1.5px solid #dee2e6; border-radius: 8px;
  padding: .55rem .9rem; font-size: .92rem; transition: var(--tr);
}
.form-control:focus, .form-select:focus {
  border-color: var(--cp); box-shadow: 0 0 0 3px rgba(39,174,96,.12); outline: none;
}
.form-label { font-weight: 700; font-size: .88rem; margin-bottom: .3rem; color: var(--text); }
.form-text  { font-size: .78rem; }

/* ─── Status badges ───────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .28rem .8rem; border-radius: 50px;
  font-size: .76rem; font-weight: 700; white-space: nowrap;
}
.badge-pendiente  { background: #fef9e7; color: #b7770d; }
.badge-confirmado { background: #eaf4fb; color: #1f618d; }
.badge-en_camino  { background: #fdf2e9; color: #a04000; }
.badge-entregado  { background: #eafaf1; color: #1d6a39; }
.badge-cancelado  { background: #fdedec; color: #922b21; }

/* ─── Product image preview ───────────────────────────────────── */
.img-preview {
  width: 80px; height: 80px; border-radius: 10px;
  object-fit: cover; border: 2px solid #e9ecef;
}
.img-placeholder {
  width: 80px; height: 80px; border-radius: 10px;
  background: var(--cpl); display: flex; align-items: center;
  justify-content: center; font-size: 2rem; border: 2px solid #e9ecef;
}

/* ─── Color picker ────────────────────────────────────────────── */
.color-row { display: flex; align-items: center; gap: .75rem; }
.color-swatch {
  width: 36px; height: 36px; border-radius: 8px;
  border: 2px solid #dee2e6; cursor: pointer; overflow: hidden;
}
.color-swatch input[type="color"] { width: 100%; height: 100%; border: none; padding: 0; cursor: pointer; }

/* ─── Share link ──────────────────────────────────────────────── */
.link-box {
  display: flex; align-items: stretch;
  border: 1.5px solid #dee2e6; border-radius: 8px; overflow: hidden;
}
.link-box input { flex: 1; border: none; padding: .5rem .8rem; font-size: .85rem; background: #fafafa; outline: none; font-family: monospace; }
.link-box button { border: none; background: var(--cp); color: #fff; padding: .5rem .9rem; cursor: pointer; font-weight: 700; font-size: .82rem; transition: var(--tr); }
.link-box button:hover { background: var(--cpd); }

/* ─── Modals ──────────────────────────────────────────────────── */
.modal-content { border: none; border-radius: var(--rad); }
.modal-header  { border-bottom: 1px solid #f0f0f0; padding: 1.1rem 1.25rem; }
.modal-footer  { border-top:    1px solid #f0f0f0; padding: .9rem 1.25rem; }
.modal-title   { font-weight: 800; }

/* ─── Alerts ──────────────────────────────────────────────────── */
.alert { border: none; border-radius: 8px; font-weight: 600; }
.alert-success { background: #d5f5e3; color: #1d6a39; }
.alert-danger  { background: #fdedec; color: #922b21; }
.alert-warning { background: #fef9e7; color: #b7770d; }
.alert-info    { background: #eaf4fb; color: #1f618d; }

/* ─── Stock indicator ─────────────────────────────────────────── */
.stock-ok  { color: #27ae60; font-weight: 700; }
.stock-low { color: #f39c12; font-weight: 700; }
.stock-out { color: #e74c3c; font-weight: 700; }

/* ─── Topbar hamburger (mobile) ───────────────────────────────── */
.btn-hamburger {
  display: none; background: none; border: none;
  font-size: 1.4rem; color: var(--text); padding: 0;
}

/* ─── Sidebar overlay (mobile) ───────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 299;
}
.sidebar-overlay.show { display: block; }

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .btn-hamburger { display: inline-block; }
  .stat-cards { grid-template-columns: repeat(2,1fr); }
  .admin-content { padding: 1rem; }
}

/* ─── Misc ────────────────────────────────────────────────────── */
.fw-800 { font-weight: 800; }
.cursor-pointer { cursor: pointer; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
