/* ============================================
   LA NAVE — Panel de Administración
============================================ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=Barlow+Condensed:wght@700;800&display=swap');

:root {
  --bg:      #0e0d0b;
  --bg2:     #141310;
  --surface: #1a1916;
  --surface2:#201f1b;
  --border:  rgba(255,255,255,0.07);
  --gold:    #c9a84c;
  --green:   #4caf6e;
  --red:     #e05555;
  --blue:    #5588e0;
  --text:    #f0ede6;
  --muted:   #9a9488;
  --dim:     #6b6760;
  --sidebar: 240px;
  --font:    'DM Sans', sans-serif;
  --fdisplay:'Barlow Condensed', sans-serif;
  --radius:  6px;
  --trans:   .2s ease;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
img { max-width: 100%; }
ul { list-style: none; }

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

/* Sidebar */
.sidebar {
  width: var(--sidebar);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--trans);
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo .mark {
  width: 32px; height: 32px;
  background: var(--gold);
  clip-path: polygon(50% 0%,100% 25%,100% 75%,50% 100%,0% 75%,0% 25%);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo .mark span { font-family: var(--fdisplay); font-weight: 900; font-size: 1rem; color: #0e0d0b; }
.sidebar-logo .name { font-family: var(--fdisplay); font-weight: 800; font-size: 1rem; letter-spacing: .04em; text-transform: uppercase; }
.sidebar-logo .sub  { font-size: .65rem; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section-title {
  font-size: .67rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 10px 8px 6px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: .88rem;
  font-weight: 400;
  transition: all var(--trans);
  margin-bottom: 2px;
}
.sidebar-nav a:hover { background: var(--surface); color: var(--text); }
.sidebar-nav a.active { background: rgba(201,168,76,.12); color: var(--gold); }
.sidebar-nav a .icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: .85rem;
  transition: all var(--trans);
}
.sidebar-footer a:hover { color: var(--red); }

/* Main content */
.admin-main {
  margin-left: var(--sidebar);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.admin-topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-family: var(--fdisplay);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  color: var(--muted);
}
.topbar-user .avatar {
  width: 32px; height: 32px;
  background: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  color: var(--bg);
  font-weight: 700;
}

.admin-content { padding: 32px 28px; flex: 1; }

/* Cards / widgets */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-card .s-label { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat-card .s-num   { font-family: var(--fdisplay); font-weight: 800; font-size: 2rem; color: var(--gold); line-height: 1; }
.stat-card .s-sub   { font-size: .78rem; color: var(--dim); }

/* Table */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 28px;
}
.table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.table-header h2 {
  font-family: var(--fdisplay);
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--surface2);
  padding: 10px 16px;
  text-align: left;
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.02); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-weight: 600;
  font-size: .82rem;
  letter-spacing: .04em;
  border: none;
  cursor: pointer;
  transition: all var(--trans);
}
.btn-gold   { background: var(--gold); color: #0e0d0b; }
.btn-gold:hover { background: #e4c47a; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-red    { background: rgba(224,85,85,.12); color: var(--red); border: 1px solid rgba(224,85,85,.2); }
.btn-red:hover { background: rgba(224,85,85,.2); }
.btn-green  { background: rgba(76,175,110,.12); color: var(--green); border: 1px solid rgba(76,175,110,.2); }
.btn-green:hover { background: rgba(76,175,110,.2); }
.btn-sm { padding: 5px 12px; font-size: .78rem; }
.btn-xs { padding: 3px 8px; font-size: .72rem; }
.btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.badge-green  { background: rgba(76,175,110,.15); color: var(--green); }
.badge-red    { background: rgba(224,85,85,.15);  color: var(--red); }
.badge-gold   { background: rgba(201,168,76,.15); color: var(--gold); }
.badge-blue   { background: rgba(85,136,224,.15); color: var(--blue); }
.badge-gray   { background: rgba(255,255,255,.06); color: var(--muted); }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
input[type=text], input[type=number], input[type=email], input[type=password],
input[type=date], input[type=tel], select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--font);
  font-size: .88rem;
  transition: border-color var(--trans);
  outline: none;
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
textarea { resize: vertical; min-height: 80px; }
select option { background: var(--surface2); }
.form-help { font-size: .72rem; color: var(--dim); }
.checkbox-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; }
.checkbox-row span { font-size: .88rem; color: var(--muted); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--trans);
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(10px);
  transition: transform var(--trans);
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-header h2 { font-family: var(--fdisplay); font-weight: 800; font-size: 1.2rem; letter-spacing: .04em; text-transform: uppercase; }
.modal-close { color: var(--muted); font-size: 1.4rem; transition: color var(--trans); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

/* Image upload */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color var(--trans), background var(--trans);
  position: relative;
}
.upload-zone:hover { border-color: var(--gold); background: rgba(201,168,76,.04); }
.upload-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-preview { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 10px; }
.upload-preview img { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }

/* Alert */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: .88rem; }
.alert-success { background: rgba(76,175,110,.1); border: 1px solid rgba(76,175,110,.25); color: var(--green); }
.alert-error   { background: rgba(224,85,85,.1);  border: 1px solid rgba(224,85,85,.25);  color: var(--red); }
.alert-info    { background: rgba(85,136,224,.1); border: 1px solid rgba(85,136,224,.25); color: var(--blue); }

/* Tabs */
.admin-tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.admin-tab-btn {
  padding: 10px 18px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: all var(--trans);
  margin-bottom: -1px;
}
.admin-tab-btn:hover { color: var(--text); }
.admin-tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

/* Pagination */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 16px; }
.page-btn { padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--border); color: var(--muted); font-size: .82rem; transition: all var(--trans); }
.page-btn:hover, .page-btn.active { border-color: var(--gold); color: var(--gold); }

/* Thumbnail in table */
.table-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; width: 38px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: background var(--trans);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; top: 3px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform var(--trans), background var(--trans);
}
.toggle input:checked + .toggle-slider { background: rgba(201,168,76,.3); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); background: var(--gold); }

/* Sortable drag handle */
.drag-handle { cursor: grab; color: var(--dim); padding: 4px 8px; }
.drag-handle:active { cursor: grabbing; }

/* Responsive admin */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .admin-content { padding: 20px 16px; }
}
