/* ============================================================
   KeiKeKim Admin Panel · admin.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,300..800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --a-bg:        #f5f3ef;
  --a-sidebar:   #1B1410;
  --a-accent:    #E5732B;
  --a-accent-d:  #C5571A;
  --a-ink:       #1B1410;
  --a-muted:     #6b5e56;
  --a-border:    #e2dcd4;
  --a-white:     #ffffff;
  --a-success:   #2E9D3F;
  --a-danger:    #D8322B;
  --a-warning:   #d4880a;
  --a-pacific:   #0E2A3A;
  --sans:        "Bricolage Grotesque", system-ui, sans-serif;
  --mono:        "JetBrains Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--a-bg); color: var(--a-ink);
  font-family: var(--sans); font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }

/* ─── LOGIN ──────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--a-sidebar);
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.03) 0 1px, transparent 1px 14px);
}
.login-card {
  background: #fff; border-radius: 10px;
  padding: 48px 44px; width: 100%; max-width: 420px;
  box-shadow: 0 40px 80px rgba(0,0,0,.35);
}
.login-card .logo-img { height: 48px; mix-blend-mode: multiply; margin-bottom: 32px; }
.login-card h1 {
  font-family: var(--sans); font-weight: 700; font-size: 22px; margin: 0 0 6px;
}
.login-card .sub { color: var(--a-muted); font-size: 14px; margin-bottom: 32px; }

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

.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--a-sidebar); color: #f5f0e8;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar .sb-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .sb-logo img { height: 40px; mix-blend-mode: lighten; }
.sidebar .sb-user {
  padding: 16px 20px; font-size: 12px;
  color: rgba(245,240,232,.5);
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar .sb-user strong { display: block; color: rgba(245,240,232,.85); font-size: 13px; }
.sidebar nav { padding: 12px 0; flex: 1; }
.sb-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; color: rgba(245,240,232,.65);
  text-decoration: none; font-size: 13px;
  transition: background .15s, color .15s; border-left: 3px solid transparent;
}
.sb-link:hover { background: rgba(255,255,255,.07); color: #f5f0e8; }
.sb-link.active { background: rgba(229,115,43,.15); color: var(--a-accent); border-left-color: var(--a-accent); }
.sb-link svg { width: 16px; height: 16px; opacity: .7; flex-shrink: 0; }
.sb-section {
  padding: 16px 20px 6px;
  font-family: var(--mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(245,240,232,.3);
}
.sidebar .sb-bottom { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.07); }
.sb-logout {
  display: flex; align-items: center; gap: 8px;
  color: rgba(245,240,232,.5); text-decoration: none; font-size: 12px;
  transition: color .15s;
}
.sb-logout:hover { color: var(--a-accent); }

.admin-main { flex: 1; min-width: 0; }
.admin-topbar {
  background: var(--a-white); border-bottom: 1px solid var(--a-border);
  padding: 14px 28px; display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 50;
}
.admin-topbar h1 { font-size: 18px; font-weight: 700; margin: 0; }
.admin-topbar .breadcrumb { font-size: 12px; color: var(--a-muted); margin-top: 2px; }
.admin-content { padding: 28px; }

/* ─── STATS CARDS ────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 32px; }
.stat-card {
  background: var(--a-white); border: 1px solid var(--a-border);
  border-radius: 8px; padding: 20px 24px; display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.orange { background: #fff3e8; }
.stat-icon.blue   { background: #e8f0ff; }
.stat-icon.green  { background: #e8f5ea; }
.stat-icon.dark   { background: #ede9e4; }
.stat-number { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label  { font-size: 12px; color: var(--a-muted); margin-top: 2px; }

/* ─── QUICK ACTIONS ──────────────────────────────────────── */
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 32px; }

/* ─── DATA TABLE ─────────────────────────────────────────── */
.table-wrap {
  background: var(--a-white); border: 1px solid var(--a-border);
  border-radius: 8px; overflow: hidden;
}
.table-header {
  padding: 16px 20px; border-bottom: 1px solid var(--a-border);
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.table-header h2 { font-size: 15px; font-weight: 700; margin: 0; }
.table-search {
  border: 1px solid var(--a-border); border-radius: 6px;
  padding: 7px 12px; font-family: var(--sans); font-size: 13px;
  outline: none; transition: border-color .2s; width: 220px;
}
.table-search:focus { border-color: var(--a-accent); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 11px 16px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--a-muted); background: var(--a-bg);
  border-bottom: 1px solid var(--a-border);
}
.data-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--a-border);
  vertical-align: middle; font-size: 13px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #faf8f5; }
.thumb-sm {
  width: 52px; height: 36px; border-radius: 4px; object-fit: cover;
  background: var(--a-bg);
}
.thumb-placeholder { width: 52px; height: 36px; border-radius: 4px; background: var(--a-bg); display: flex; align-items: center; justify-content: center; font-size: 18px; }

/* ─── BADGES ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 600;
}
.badge-active  { background: #e8f5ea; color: var(--a-success); }
.badge-inactive{ background: #fce8e8; color: var(--a-danger);  }
.badge-admin   { background: #fff3e8; color: var(--a-accent);  }
.badge-editor  { background: #ede9e4; color: var(--a-muted);   }
.badge-playa   { background: #e8f0ff; color: #1a50a0; }
.badge-industrial { background: #1B1410; color: #f5f0e8; }
.badge-comercial  { background: #e8f5ea; color: var(--a-success); }
.badge-natural    { background: #f0f4e8; color: #4a6020; }
.badge-mercado    { background: #fff3e8; color: var(--a-accent); }

/* ─── ACTION BUTTONS ─────────────────────────────────────── */
.actions { display: flex; gap: 6px; }
.btn-edit, .btn-del, .btn-toggle {
  border: none; border-radius: 6px; cursor: pointer;
  padding: 6px 10px; font-size: 12px; font-family: var(--sans);
  display: inline-flex; align-items: center; gap: 4px; transition: opacity .15s;
}
.btn-edit   { background: #ede9e4; color: var(--a-ink); }
.btn-del    { background: #fce8e8; color: var(--a-danger); }
.btn-toggle { background: #e8f5ea; color: var(--a-success); }
.btn-edit:hover, .btn-del:hover, .btn-toggle:hover { opacity: .75; }

/* ─── FORMS ──────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 600; color: var(--a-muted); letter-spacing: .03em; }
.form-control {
  border: 1px solid var(--a-border); border-radius: 6px;
  padding: 9px 13px; font-family: var(--sans); font-size: 14px; color: var(--a-ink);
  outline: none; transition: border-color .2s; background: var(--a-white);
}
.form-control:focus { border-color: var(--a-accent); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--a-accent); }

/* ─── SPECS CHIPS ────────────────────────────────────────── */
.specs-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.spec-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--a-bg); border: 1px solid var(--a-border);
  border-radius: 999px; padding: 4px 12px; font-size: 12px;
}
.spec-chip .rm {
  cursor: pointer; opacity: .5; font-size: 14px; line-height: 1;
  background: none; border: none; padding: 0; color: var(--a-danger);
}
.spec-chip .rm:hover { opacity: 1; }
.spec-add-row { display: flex; gap: 8px; margin-top: 10px; }

/* ─── STOPS (routes) ─────────────────────────────────────── */
.stop-item {
  display: grid; grid-template-columns: auto 1fr auto auto;
  gap: 10px; align-items: center;
  background: var(--a-bg); border: 1px solid var(--a-border);
  border-radius: 6px; padding: 10px 14px; margin-bottom: 8px;
  cursor: grab;
}
.stop-item:active { cursor: grabbing; }
.stop-drag { color: var(--a-muted); font-size: 16px; user-select: none; }

/* ─── IMAGE UPLOAD ───────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--a-border); border-radius: 8px;
  padding: 28px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--a-accent); background: #fff8f3;
}
.upload-zone p { margin: 8px 0 0; font-size: 13px; color: var(--a-muted); }
.img-preview-wrap { margin-top: 14px; }
.img-preview { max-height: 160px; border-radius: 6px; border: 1px solid var(--a-border); }
.current-img { display: flex; align-items: flex-start; gap: 12px; }
.current-img img { height: 80px; width: auto; border-radius: 6px; object-fit: cover; border: 1px solid var(--a-border); }
.current-img-info { font-size: 12px; color: var(--a-muted); }
.current-img-info strong { display: block; color: var(--a-ink); margin-bottom: 4px; }

/* ─── MODAL ──────────────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(27,20,16,.55); align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--a-white); border-radius: 10px;
  width: 100%; max-width: 700px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 40px 80px rgba(0,0,0,.3);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head {
  padding: 20px 24px; border-bottom: 1px solid var(--a-border);
  display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.modal-head h3 { font-size: 16px; font-weight: 700; margin: 0; }
.modal-close {
  background: none; border: none; cursor: pointer; font-size: 22px;
  color: var(--a-muted); line-height: 1; padding: 4px 8px; border-radius: 4px;
}
.modal-close:hover { background: var(--a-bg); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 16px 24px; border-top: 1px solid var(--a-border);
  display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0;
}

/* ─── GENERIC BUTTONS ────────────────────────────────────── */
.btn-primary {
  background: var(--a-accent); color: #fff; border: none;
  padding: 10px 20px; border-radius: 6px; font-family: var(--sans); font-size: 14px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background .2s;
}
.btn-primary:hover { background: var(--a-accent-d); }
.btn-secondary {
  background: var(--a-bg); color: var(--a-ink);
  border: 1px solid var(--a-border);
  padding: 10px 20px; border-radius: 6px; font-family: var(--sans); font-size: 14px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background .2s;
}
.btn-secondary:hover { background: var(--a-border); }
.btn-danger {
  background: var(--a-danger); color: #fff; border: none;
  padding: 10px 20px; border-radius: 6px; font-family: var(--sans); font-size: 14px;
  cursor: pointer; transition: opacity .2s;
}
.btn-danger:hover { opacity: .85; }

/* ─── ALERT ──────────────────────────────────────────────── */
.alert { border-radius: 6px; padding: 12px 16px; margin-bottom: 20px; font-size: 13px; }
.alert-success { background: #e8f5ea; color: #1a6626; border: 1px solid #b8debb; }
.alert-error   { background: #fce8e8; color: #8b1515; border: 1px solid #f0b8b8; }
.alert-info    { background: #e8f0ff; color: #1a3680; border: 1px solid #b8c8f0; }

/* ─── REORDER HINT ───────────────────────────────────────── */
.reorder-hint { font-size: 12px; color: var(--a-muted); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.sortable-ghost { opacity: .4; background: #fff8f3 !important; }

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .sidebar { width: 200px; }
}
@media (max-width: 640px) {
  .admin-layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
