/* ============================================================
   Portal de Comercios — Comisión Vecinal Altos de Alberdi
   Green accent variant of admin panel
   ============================================================ */

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

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

:root {
  --sidebar-w: 256px;
  --topbar-h: 60px;

  --ink:        #0c1a2e;
  --primary:    #14532d;
  --primary-lt: #16a34a;
  --accent:     #16a34a;
  --accent-lt:  #22c55e;
  --gold:       #c9a84c;

  --bg:         #f5f7f5;
  --surface:    #ffffff;
  --surface-2:  #eef3ee;
  --border:     #d4e4d4;

  --text:       #1a1a1a;
  --text-2:     #4a4a4a;
  --text-muted: #7a7a7a;

  --sidebar-bg: #0c1a2e;
  --sidebar-border: rgba(255,255,255,.07);

  --shadow-sm: 0 1px 3px rgba(12,26,46,.08);
  --shadow:    0 4px 16px rgba(12,26,46,.10);
  --shadow-lg: 0 12px 40px rgba(12,26,46,.14);
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: all .2s cubic-bezier(.4,0,.2,1);

  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body:    'Plus Jakarta Sans', system-ui, sans-serif;
}

html { font-size: 16px; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-lt); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-lt); }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: var(--font-body); }
input, textarea, select { font-family: var(--font-body); }

h1,h2,h3,h4,h5,h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.02em;
  color: var(--ink);
}

/* === Layout === */
.admin-body { overflow-x: hidden; }
.admin-layout { display: flex; min-height: 100vh; }

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex; align-items: center; gap: .7rem;
  color: #fff; font-family: var(--font-display);
  font-size: .9rem; font-weight: 700; letter-spacing: -.01em;
  text-decoration: none;
}
.sidebar-logo:hover { color: var(--accent-lt); }

.sidebar-close {
  color: rgba(255,255,255,.4);
  padding: .25rem;
  border-radius: 6px;
  display: none;
}
.sidebar-close:hover { color: #fff; background: rgba(255,255,255,.08); }

/* === Sidebar Nav === */
.sidebar-nav { flex: 1; padding: 1rem 0; }

.nav-section { margin-bottom: .5rem; }
.nav-section-title {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: .75rem 1.25rem .3rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem 1.25rem;
  color: rgba(255,255,255,.65);
  font-size: .875rem;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,.06);
}
.nav-item.active {
  color: #fff;
  background: rgba(22,163,74,.18);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-item.active svg { opacity: 1; }

.badge-count {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 50px;
  min-width: 18px;
  text-align: center;
}

/* === Sidebar Footer === */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.user-info {
  display: flex; align-items: center; gap: .7rem;
  margin-bottom: .85rem;
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: .85rem; font-weight: 700;
  flex-shrink: 0;
}
.user-name { font-size: .82rem; font-weight: 600; color: rgba(255,255,255,.9); line-height: 1.2; }
.user-role { font-size: .72rem; color: rgba(255,255,255,.4); text-transform: capitalize; }

.sidebar-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-sidebar-link {
  font-size: .75rem;
  padding: .35rem .75rem;
  border-radius: 6px;
  color: rgba(255,255,255,.65);
  background: rgba(255,255,255,.07);
  transition: var(--transition);
  text-decoration: none;
}
.btn-sidebar-link:hover { background: rgba(255,255,255,.13); color: #fff; }
.btn-logout { color: rgba(220,80,60,.8); }
.btn-logout:hover { background: rgba(220,80,60,.15); color: #ff6b5b; }

/* === Main Content === */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .3s cubic-bezier(.4,0,.2,1);
}

.admin-topbar {
  position: sticky; top: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem;
  box-shadow: var(--shadow-sm);
}
.sidebar-toggle {
  color: var(--text-muted);
  padding: .35rem;
  border-radius: 6px;
  display: none;
}
.sidebar-toggle:hover { background: var(--surface-2); color: var(--text); }

.topbar-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.02em;
  flex: 1;
}
.topbar-actions { display: flex; gap: .75rem; align-items: center; }

.admin-content { flex: 1; padding: 1.5rem; max-width: 1200px; width: 100%; }

/* === Cards === */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem;
}
.card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.card-body { padding: 1.5rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* === Stats grid === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); border-color: transparent; }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.green { background: rgba(22,163,74,.12); color: var(--accent); }
.stat-icon.red   { background: rgba(220,38,38,.1); color: #dc2626; }
.stat-icon.blue  { background: rgba(37,84,160,.12); color: #2554a0; }
.stat-icon.gold  { background: rgba(201,168,76,.15); color: var(--gold); }
.stat-value { font-family: var(--font-display); font-size: 1.75rem; font-weight: 800; color: var(--ink); line-height: 1; margin-bottom: .15rem; }
.stat-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.2rem;
  border-radius: 50px;
  font-size: .875rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-lt); border-color: var(--accent-lt); color: #fff; }
.btn-secondary { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-secondary:hover { background: var(--accent); color: #fff; }
.btn-light { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-light:hover { background: var(--border); color: var(--ink); }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-warning { background: #d97706; color: #fff; border-color: #d97706; }
.btn-warning:hover { background: #b45309; border-color: #b45309; color: #fff; }
.btn-success { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-success:hover { background: var(--accent-lt); border-color: var(--accent-lt); color: #fff; }
.btn-sm { padding: .35rem .85rem; font-size: .8rem; }
.btn-xs { padding: .22rem .65rem; font-size: .75rem; border-radius: 6px; }
.btn-lg { padding: .75rem 1.75rem; font-size: 1rem; }

/* === Forms === */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: .4rem;
}
.form-label .required { color: #dc2626; }
.form-control {
  display: block; width: 100%;
  padding: .6rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  color: var(--text);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22,163,74,.12); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%237a7a7a'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; background-size: 16px; padding-right: 2.25rem; }
.form-text { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.admin-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Toggle switch */
.toggle-switch { display: flex; align-items: center; gap: .6rem; cursor: pointer; }
.toggle-switch input { display: none; }
.toggle-track {
  width: 40px; height: 22px;
  background: var(--border);
  border-radius: 50px;
  position: relative;
  transition: var(--transition);
}
.toggle-track::after {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked ~ .toggle-track { background: var(--accent); }
.toggle-switch input:checked ~ .toggle-track::after { transform: translateX(18px); }
.toggle-label { font-size: .875rem; font-weight: 500; color: var(--text); }

/* File drop zone */
.file-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.file-drop-zone:hover { border-color: var(--accent); background: rgba(22,163,74,.03); }
.file-drop-text { font-size: .85rem; color: var(--text-muted); }
.file-preview { margin-top: .75rem; }
.file-preview img { max-height: 120px; border-radius: var(--radius); margin: 0 auto; }

/* === Tables === */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th {
  text-align: left;
  padding: .75rem 1rem;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.table td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(22,163,74,.03); }
.table-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* === Badges === */
.badge {
  display: inline-flex; align-items: center;
  padding: .22rem .7rem;
  border-radius: 50px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-success { background: rgba(22,163,74,.12); color: #16a34a; }
.badge-danger   { background: rgba(220,38,38,.1); color: #dc2626; }
.badge-warning  { background: rgba(217,119,6,.12); color: #d97706; }
.badge-secondary{ background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-info     { background: rgba(37,84,160,.1); color: #2554a0; }
.badge-primary  { background: rgba(22,163,74,.12); color: #16a34a; }

/* Offer type badges */
.badge-oferta    { background: rgba(232,93,38,.12); color: #e85d26; }
.badge-promocion { background: rgba(37,84,160,.12); color: #2554a0; }
.badge-novedad   { background: rgba(22,163,74,.12);  color: #16a34a; }
.badge-evento    { background: rgba(109,40,217,.12); color: #7c3aed; }

/* === Alerts === */
.alert {
  padding: .9rem 1.25rem;
  border-radius: var(--radius);
  font-size: .9rem;
  margin: 0 1.5rem 1rem;
  border-left: 4px solid;
}
.alert-success { background: rgba(22,163,74,.08); border-color: #16a34a; color: #14532d; }
.alert-danger  { background: rgba(220,38,38,.07); border-color: #dc2626; color: #7f1d1d; }
.alert-warning { background: rgba(217,119,6,.08); border-color: #d97706; color: #78350f; }

/* === Gallery grid === */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.gallery-item img { width: 100%; height: 140px; object-fit: cover; display: block; }
.gallery-item-actions {
  position: absolute;
  top: .5rem; right: .5rem;
  display: flex; gap: .3rem;
}
.gallery-item-actions .btn-xs {
  backdrop-filter: blur(4px);
  background: rgba(12,26,46,.7);
  color: #fff;
  border-color: transparent;
}
.gallery-item-actions .btn-xs:hover { background: rgba(220,38,38,.8); }
.gallery-item-title {
  padding: .5rem .65rem;
  font-size: .75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === Plan status badge === */
.plan-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem 1rem;
  border-radius: 50px;
  font-size: .82rem;
  font-weight: 700;
}
.plan-activo   { background: rgba(22,163,74,.12); color: #16a34a; border: 1px solid rgba(22,163,74,.25); }
.plan-vencido  { background: rgba(220,38,38,.1); color: #dc2626; border: 1px solid rgba(220,38,38,.2); }
.plan-sin-fecha{ background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

/* === Login page === */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0c1a2e 0%, #14532d 100%);
  padding: 1.5rem;
}
.login-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-logo .logo-mark {
  width: 60px; height: 60px;
  border-radius: 16px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
}
.login-logo h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: .3rem;
}
.login-logo p { font-size: .85rem; color: var(--text-muted); }

/* === Responsive === */
@media (max-width: 768px) {
  .admin-main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-close { display: flex; }
  .sidebar-toggle { display: flex; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-content { padding: 1rem; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}
