/* ===================================================
   ADMIN PANEL - Estilos
   =================================================== */
:root {
  --admin-rojo: #c8102e;
  --admin-rojo-oscuro: #a50d24;
  --admin-sidebar: #1e2024;
  --admin-sidebar-hover: #2d3139;
  --admin-bg: #f0f2f5;
  --admin-card: #ffffff;
  --admin-text: #2d2d2d;
  --admin-text-light: #666;
  --admin-border: #e0e0e0;
  --admin-verde: #28a745;
  --admin-azul: #007bff;
  --admin-amarillo: #ffc107;
  --sombra: 0 2px 10px rgba(0,0,0,0.08);
  --border-radius: 12px;
  --transicion: 0.25s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--admin-bg);
  color: var(--admin-text);
  font-size: 0.95rem;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

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

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background: var(--admin-sidebar);
  position: fixed;
  top: 0; left: 0;
  height: 100%;
  overflow-y: auto;
  z-index: 100;
  transition: transform var(--transicion);
}
.sidebar-logo {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-logo img { height: 36px; filter: brightness(0) invert(1); }
.sidebar-logo span { color: white; font-weight: 700; font-size: 1rem; }
.sidebar-nav { padding: 1rem 0; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  transition: all var(--transicion);
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: var(--admin-sidebar-hover);
  color: white;
  border-left-color: var(--admin-rojo);
}
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav .nav-group-title {
  padding: 1rem 1.5rem 0.3rem;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
}
.sidebar-badge {
  background: var(--admin-rojo);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 12px;
  margin-left: auto;
}

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

/* Topbar */
.admin-topbar {
  background: white;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--sombra);
  position: sticky;
  top: 0;
  z-index: 99;
}
.topbar-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--admin-text);
}
.topbar-actions { display: flex; align-items: center; gap: 1rem; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--admin-text-light);
  font-size: 0.9rem;
}
.topbar-avatar {
  background: var(--admin-rojo);
  color: white;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.btn-logout {
  background: none;
  border: 1px solid var(--admin-border);
  padding: 0.4rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--admin-text-light);
  transition: all var(--transicion);
}
.btn-logout:hover { background: #f5f5f5; color: var(--admin-text); }

/* Content */
.admin-content { padding: 2rem; flex: 1; }

/* Cards */
.card {
  background: var(--admin-card);
  border-radius: var(--border-radius);
  box-shadow: var(--sombra);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--admin-border);
}
.card-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--sombra);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 26px; height: 26px; color: white; }
.stat-icon.rojo { background: var(--admin-rojo); }
.stat-icon.verde { background: var(--admin-verde); }
.stat-icon.azul { background: var(--admin-azul); }
.stat-icon.amarillo { background: var(--admin-amarillo); }
.stat-info h4 { font-size: 0.8rem; color: var(--admin-text-light); font-weight: 500; }
.stat-info p { font-size: 1.8rem; font-weight: 700; line-height: 1.2; }
.stat-info .badge-new {
  background: #fff3cd;
  color: #856404;
  font-size: 0.72rem;
  padding: 0.1rem 0.5rem;
  border-radius: 12px;
  font-weight: 600;
}

/* Tabla */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--admin-border); font-size: 0.88rem; }
th { font-weight: 700; color: var(--admin-text-light); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover td { background: #fafafa; }
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-activo { background: #d4edda; color: #155724; }
.badge-inactivo { background: #f8d7da; color: #721c24; }
.badge-nuevo { background: #fff3cd; color: #856404; }
.badge-leido { background: #e2e3e5; color: #495057; }

/* Botones */
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1.25rem; border-radius: 8px; font-size: 0.875rem; font-weight: 600; border: none; cursor: pointer; transition: all var(--transicion); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--admin-rojo); color: white; }
.btn-primary:hover { background: var(--admin-rojo-oscuro); }
.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover { background: #545b62; }
.btn-success { background: var(--admin-verde); color: white; }
.btn-success:hover { background: #1e7e34; }
.btn-warning { background: var(--admin-amarillo); color: #333; }
.btn-warning:hover { background: #d39e00; }
.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #bd2130; }
.btn-outline { background: none; border: 1px solid var(--admin-border); color: var(--admin-text); }
.btn-outline:hover { background: #f5f5f5; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }

/* Formularios */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.4rem; color: var(--admin-text); }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  font-size: 0.9rem;
  transition: border var(--transicion);
  font-family: inherit;
  background: white;
  color: var(--admin-text);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--admin-rojo); outline: none; }
.form-group textarea { resize: vertical; min-height: 100px; }
.form-group small { font-size: 0.78rem; color: var(--admin-text-light); margin-top: 0.3rem; display: block; }
.form-check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.form-check label { font-size: 0.9rem; cursor: pointer; margin-bottom: 0; }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-box { background: white; border-radius: var(--border-radius); padding: 2rem; width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--admin-text-light); transition: color var(--transicion); }
.modal-close:hover { color: var(--admin-rojo); }

/* Alertas */
.alert { padding: 0.85rem 1.25rem; border-radius: 8px; margin-bottom: 1.25rem; font-size: 0.9rem; font-weight: 500; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Imagen preview */
.img-preview { max-width: 120px; max-height: 80px; object-fit: cover; border-radius: 6px; border: 1px solid var(--admin-border); }

/* Login */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--admin-rojo) 0%, var(--admin-rojo-oscuro) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.login-card {
  background: white;
  border-radius: 20px;
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo {
  text-align: center;
  margin-bottom: 0.5rem;
}
.login-logo img { height: 60px; margin: 0 auto; }
.login-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--admin-text);
}
.login-subtitle {
  text-align: center;
  color: var(--admin-text-light);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}
.login-card .form-group label { color: var(--admin-text); }
.login-btn {
  width: 100%;
  background: var(--admin-rojo);
  color: white;
  border: none;
  padding: 0.85rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transicion);
  margin-top: 0.5rem;
}
.login-btn:hover { background: var(--admin-rojo-oscuro); }

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