/* ===========================================
   VARIABLES Y CONFIGURACIÓN GLOBAL
   =========================================== */

:root{
  --verde: #1ecb63;
  --verde-oscuro: #17a352;
  --negro: #000000;
  --blanco: #ffffff;
  --gris: #e0e0e0;
  --max-width: 1200px;
}

/* Reset básico */
*{
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: Inter, Arial, Helvetica, sans-serif;
  background: var(--gris);
  color: #222;
  line-height: 1.4;
  padding-top: 6px;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* ===========================================
   BARRA SUPERIOR DE USUARIO (STICKY)
   DESKTOP FIRST - 1200px+
   =========================================== */

.user-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--gris);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding: 8px 0;
}

.user-bar-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  box-sizing: border-box;
}

.user-info .user-name {
  color: white;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 4px 12px;
  background: rgba(76, 175, 80, 0.15);
  border: 1px solid rgba(76, 175, 80, 0.4);
  border-radius: 20px;
  display: inline-block;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.user-actions .admin-btn {
  color: var(--verde);
  text-decoration: none;
  font-size: 1.1rem;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.3s ease;
  background: rgba(76, 175, 80, 0.05);
  border: 1px solid rgba(76, 175, 80, 0.3);
  backdrop-filter: blur(10px);
}

.user-actions .admin-btn:hover {
  background: rgba(76, 175, 80, 0.8);
  color: white;
  transform: scale(1.05);
  border: 1px solid var(--verde);
}

.user-actions .carrito {
  color: var(--verde);
  font-size: 1.3rem;
  text-decoration: none;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.3s ease;
  background: rgba(76, 175, 80, 0.05);
  border: 1px solid rgba(76, 175, 80, 0.3);
  backdrop-filter: blur(10px);
  position: relative;
  display: inline-block;
}

.user-actions .carrito:hover {
  background: rgba(76, 175, 80, 0.8);
  color: white;
  transform: scale(1.1);
  border: 1px solid var(--verde);
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
  border: 2px solid white;
  padding: 0 4px;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.user-actions .btn-logout {
  padding: 6px 12px;
  background: rgba(255, 68, 68, 0.1);
  border: 1px solid rgba(255, 68, 68, 0.4);
  color: #ff4444;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.user-actions .btn-logout:hover {
  background: rgba(255, 68, 68, 0.8);
  color: white;
  border: 1px solid #ff4444;
}

.user-actions .btn-login {
  padding: 6px 12px;
  background: rgba(76, 175, 80, 0.15);
  color: var(--verde);
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.8rem;
  transition: all 0.3s ease;
  border: 1px solid rgba(76, 175, 80, 0.4);
  backdrop-filter: blur(10px);
}

.user-actions .btn-login:hover {
  background: rgba(76, 175, 80, 0.8);
  color: white;
  border: 1px solid var(--verde);
}

/* ===========================================
   NAVBAR PRINCIPAL
   DESKTOP FIRST - 1200px+
   =========================================== */

.site {
  max-width: var(--max-width);
  margin: 18px auto;
  padding: 0 16px;
  box-sizing: border-box;
}

.navbar {
  position: sticky;
  top: 50px;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 8px;
  background: var(--negro);
  backdrop-filter: blur(15px);
  color: var(--blanco);
  border-radius: 10px;
  margin-top: 10px;
  border: 1px solid rgba(255,255,255,0.05);
  flex-wrap: nowrap;
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
  background-color: var(--negro);
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
}

.logo-svg {
  width: 4rem;
  height: 4rem;
}

.brand h1 {
  font-size: 1.6rem;
  color: var(--blanco);
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* Navegación - estilos base para desktop */
.nav-menu {
  display: block;
  position: static;
  width: auto;
  height: auto;
  background: transparent;
  padding: 0;
  margin: 0;
  box-shadow: none;
  border: none;
}

.navlinks {
  display: flex;
  gap: 12px;
  list-style: none;
  flex-wrap: wrap;
  align-items: center;
}

.navlinks a {
  color: var(--blanco);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.navlinks a:hover {
  color: var(--verde);
}

.navlinks a.active {
  color: var(--verde);
  border-bottom: 2px solid var(--verde);
}

.carrito {
  display: inline-block;
  background: var(--negro);
  color: var(--verde);
  padding: 4px 6px;
  border-radius: 2px;
  border: 0.5px solid var(--negro);
  font-weight: 700;
  font-size: 1.5rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
}

/* Botón hamburger - oculto en desktop */
.hamburger {
  display: none;
}

.hamburger-line {
  display: block;
}

/* Botón cerrar menú - oculto en desktop */
.nav-close {
  display: none;
  position: absolute;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 44px;
  height: 44px;
  z-index: 1003;
  line-height: 1;
  font-weight: 300;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.3s ease;
}

/* Overlay menú - oculto en desktop */
.nav-overlay {
  display: none;
}

/* ===========================================
   LAYOUT PRINCIPAL Y ESTRUCTURA
   DESKTOP FIRST - 1200px+
   =========================================== */

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
  margin-top: 16px;
  box-sizing: border-box;
  max-width: 100%;
}

/* Layout para páginas sin sidebar (catálogo) */
.layout-single-column {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 1400px;
  margin: 16px auto;
  padding: 0 16px;
  box-sizing: border-box;
}

/* Grid de productos en catálogo - desktop */
.layout-single-column .grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

/* Presentación del catálogo */
.layout-single-column .presentacion {
  background: linear-gradient(135deg, var(--verde) 0%, #1a8a3a 100%);
  color: white;
  padding: 40px;
  border-radius: 12px;
  margin-bottom: 40px;
  text-align: center;
}

.layout-single-column .presentacion h2 {
  font-size: 2.5rem;
  margin-bottom: 16px;
  color: white;
}

.layout-single-column .presentacion p {
  font-size: 1.1rem;
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ===========================================
   ASIDE IZQUIERDO Y PROMOCIÓN
   DESKTOP FIRST - 1200px+
   =========================================== */

aside.left {
  background: var(--blanco);
  padding: 12px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(2,6,23,0.08);
}

.promo {
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.promo img {
  width: 100%;
  display: block;
}

.promo .txt {
  padding: 10px;
  font-weight: 700;
  color: #111;
}

.video-promo {
  background: #000;
  position: relative;
}

.hover-video {
  width: 100%;
  height: auto;
  display: block;
  cursor: pointer;
  transition: opacity 300ms ease;
}

.hover-video:hover {
  opacity: 0.9;
}

/* ===========================================
   CARRUSEL
   DESKTOP FIRST - 1200px+
   =========================================== */

.carousel {
  position: relative;
  background: var(--blanco);
  padding: 14px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(2,6,23,0.06);
}

.slides {
  display: flex;
  transition: transform 600ms cubic-bezier(.22,.9,.28,1);
  gap: 14px;
}

.slide {
  min-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
  height: 400px;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-controls {
  position: absolute;
  top: 50%;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  transform: translateY(-50%);
  pointer-events: none;
}

.btn-ctrl {
  pointer-events: auto;
  background: rgba(0,0,0,0.35);
  border: none;
  color: var(--blanco);
  padding: 8px 10px;
  border-radius: 8px;
  backdrop-filter: blur(2px);
  cursor: pointer;
}

/* ===========================================
   PRESENTACIÓN
   DESKTOP FIRST - 1200px+
   =========================================== */

.presentacion {
  margin-top: 14px;
  padding: 18px;
  background: var(--blanco);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(2,6,23,0.06);
}

.presentacion h2 {
  color: #111;
  margin-bottom: 8px;
}

.presentacion-texto {
  margin-top: 12px;
}

/* ===========================================
   TARJETAS DE PRODUCTO
   DESKTOP FIRST - 1200px+
   =========================================== */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 14px;
}

.card {
  background: var(--blanco);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

.card:hover .thumb img {
  transform: scale(1.05);
}

.thumb {
  height: 200px;
  overflow: hidden;
  background: var(--gris);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--verde);
  color: var(--blanco);
  padding: 4px 12px;
  border-radius: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  z-index: 10;
}

.card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card h4 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--negro);
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.card .description {
  color: #6c757d;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.4;
  flex: 1;
}

.meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--verde);
}

.stock {
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.stock.in-stock {
  background: #d4edda;
  color: #155724;
}

.stock.out-of-stock {
  background: #f8d7da;
  color: #721c24;
}

.add-btn {
  width: 100%;
  padding: 12px;
  background: var(--verde);
  color: var(--blanco);
  border: none;
  border-radius: 2px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
  text-transform: none;
}

.add-btn:hover {
  background: var(--verde-oscuro);
}

.add-btn:disabled {
  background: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}

/* ===========================================
   CATEGORÍAS ICONOS HORIZONTALES
   DESKTOP FIRST - 1200px+
   =========================================== */

.icons-row {
  display: flex;
  gap: 14px;
  margin-top: 18px;
}

.icon-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--blanco), #fafafa);
  box-shadow: 0 6px 14px rgba(2,6,23,0.04);
  cursor: pointer;
  transition: transform 180ms ease;
}

.icon-card:hover {
  transform: translateY(-4px);
}

.icon-card svg {
  width: 36px;
  height: 36px;
}

/* ===========================================
   SECCIONES: Recién agregados / Ofertas
   DESKTOP FIRST - 1200px+
   =========================================== */

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 3rem 0;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(30, 203, 99, 0.3);
}

.section-title h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.8rem;
  color: var(--negro);
  font-weight: 700;
  margin: 0;
}

.section-icon {
  width: 32px;
  height: 32px;
}

.section-destacados {
  margin-top: 3rem;
}

.section-recientes,
.section-ofertas {
  margin-top: 3rem;
}

.ver-todo {
  font-weight: 700;
  color: var(--verde);
}

.small-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 12px;
}

/* ===========================================
   PALETA VISUAL
   DESKTOP FIRST - 1200px+
   =========================================== */

.palette {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.swatch {
  flex: 1;
  padding: 16px;
  border-radius: 8px;
  color: #111;
  font-weight: 700;
  text-align: center;
}

.swatch-verde {
  background: var(--verde);
  color: var(--negro);
}

.swatch-negro {
  background: var(--negro);
  color: var(--blanco);
}

.swatch-blanco {
  background: var(--blanco);
  color: #111;
  border: 1px solid #ddd;
}

.swatch-gris {
  background: var(--gris);
  color: #111;
}

/* ===========================================
   FOOTER
   DESKTOP FIRST - 1200px+
   =========================================== */

footer {
  margin-top: 22px;
  background: var(--negro);
  color: var(--blanco);
  padding: 18px;
  border-radius: 10px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.footer-redes {
  margin-top: 12px;
}

.footer-copyright {
  margin-top: 18px;
  font-size: 13px;
  opacity: 0.9;
}

.map iframe {
  width: 100%;
  height: 200px;
  border: 0;
  border-radius: 8px;
}

/* ===========================================
   LOGIN Y AUTENTICACIÓN
   DESKTOP FIRST - 1200px+
   =========================================== */

.user-section {
  display: none;
}

.user-name {
  color: white;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
  padding: 20px;
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  max-width: 400px;
  width: 100%;
}

.login-box h2 {
  text-align: center;
  margin-bottom: 30px;
  color: var(--negro);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--negro);
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--verde);
}

.error-message {
  color: #e74c3c;
  font-size: 14px;
  margin-bottom: 15px;
  min-height: 20px;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--verde);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}

.btn-primary:hover {
  background: #27ae60;
}

.btn-primary:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

.form-toggle {
  text-align: center;
  margin-top: 20px;
}

.form-toggle a {
  color: var(--verde);
  text-decoration: none;
  font-weight: 600;
}

.form-toggle a:hover {
  text-decoration: underline;
}

.btn-logout {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid white;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--verde);
  color: var(--verde);
}

.btn-login {
  padding: 6px 12px;
  background: var(--verde);
  color: white;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: all 0.3s ease;
  border: 1px solid var(--verde);
}

.btn-login:hover {
  background: var(--verde-oscuro);
  border-color: var(--verde-oscuro);
}

.navlinks .admin-link {
  color: var(--verde) !important;
  font-weight: 600;
}

.navlinks .admin-link:hover {
  color: var(--verde-oscuro) !important;
}

/* ===========================================
   PANEL DE ADMINISTRACIÓN
   DESKTOP FIRST - 1200px+
   =========================================== */

.admin-badge {
  display: inline-block;
  background: var(--verde);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 8px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-link {
  color: var(--verde) !important;
  font-weight: 600;
}

.access-denied {
  text-align: center;
  padding: 60px 20px;
  max-width: 500px;
  margin: 0 auto;
}

.access-denied h2 {
  color: #d32f2f;
  margin-bottom: 20px;
}

.access-denied p {
  margin-bottom: 30px;
  color: #666;
}

.admin-panel {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.admin-header {
  margin-bottom: 30px;
}

.admin-header h2 {
  color: var(--negro);
  margin-bottom: 10px;
}

.admin-header p {
  color: #666;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: transform 0.3s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.stat-number {
  font-size: 36px;
  font-weight: 700;
  color: var(--verde);
  margin-bottom: 8px;
}

.stat-label {
  font-size: 14px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: #666;
  transition: all 0.3s;
}

.tab-btn:hover {
  color: var(--verde);
}

.tab-btn.active {
  color: var(--verde);
  border-bottom-color: var(--verde);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.admin-actions {
  margin-bottom: 20px;
  display: flex;
  justify-content: flex-end;
}

.btn-add {
  padding: 12px 24px;
  background: var(--verde);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s;
}

.btn-add:hover {
  background: var(--verde-oscuro);
  transform: scale(1.05);
}

.products-table-container,
.users-table-container {
  overflow-x: auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table thead {
  background: #f5f5f5;
}

.admin-table th {
  padding: 16px;
  text-align: left;
  font-weight: 600;
  color: var(--negro);
  border-bottom: 2px solid #e0e0e0;
}

.admin-table td {
  padding: 16px;
  border-bottom: 1px solid #e0e0e0;
}

.admin-table tbody tr:hover {
  background: #fafafa;
}

.admin-table .totals-row {
  background: #f5f5f5;
  border-top: 2px solid #2e7d32;
  font-size: 14px;
}

.admin-table .totals-row:hover {
  background: #f5f5f5 !important;
}

.admin-table .totals-row td {
  padding: 16px;
  font-weight: 600;
}

/* Badges de categoría */
.categoria-badge,
.estatus-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.categoria-futbol { background: #e3f2fd; color: #1976d2; }
.categoria-basket { background: #fff3e0; color: #f57c00; }
.categoria-gym { background: #f3e5f5; color: #7b1fa2; }
.categoria-coleccionables { background: #e8f5e9; color: #388e3c; }

.estatus-destacado { background: #fff9c4; color: #f57f17; }
.estatus-oferta { background: #ffebee; color: #c62828; }
.estatus-recien-agregado { background: #e8f5e9; color: #2e7d32; }
.estatus-normal { background: #f5f5f5; color: #616161; }

.btn-edit,
.btn-delete {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  margin: 0 4px;
  transition: transform 0.2s;
}

.btn-edit {
  background: #e3f2fd;
}

.btn-edit:hover {
  background: #bbdefb;
  transform: scale(1.1);
}

.btn-delete {
  background: #ffebee;
}

.btn-delete:hover {
  background: #ffcdd2;
  transform: scale(1.1);
}

.btn-delete:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.role-select {
  padding: 6px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: white;
  cursor: pointer;
}

/* ===========================================
   MODAL
   DESKTOP FIRST - 1200px+
   =========================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
  margin: 0;
  color: var(--negro);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: background 0.3s;
}

.modal-close:hover {
  background: #f5f5f5;
  color: var(--negro);
}

.modal-form {
  padding: 24px;
}

.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.3s;
}

.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--verde);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

.btn-cancel,
.btn-save {
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-cancel {
  background: #f5f5f5;
  color: #666;
}

.btn-cancel:hover {
  background: #e0e0e0;
}

.btn-save {
  background: var(--verde);
  color: white;
}

.btn-save:hover {
  background: var(--verde-oscuro);
  transform: scale(1.05);
}

.btn-save:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* ===========================================
   CARRITO DE COMPRAS
   DESKTOP FIRST - 1200px+
   =========================================== */

.carrito-page {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
  min-height: calc(100vh - 200px);
}

.carrito-container h1 {
  color: var(--verde);
  margin-bottom: 2rem;
  text-align: center;
}

.carrito-vacio {
  text-align: center;
  padding: 4rem 2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.carrito-vacio p {
  font-size: 1.3rem;
  color: #666;
  margin-bottom: 2rem;
}

.carrito-contenido {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 2rem;
  align-items: start;
}

.carrito-items {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.carrito-items h2 {
  color: var(--verde);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--verde);
}

#items-lista {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.carrito-item {
  display: grid;
  grid-template-columns: 80px 1fr auto auto auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.carrito-item:hover {
  background: #e9ecef;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.item-imagen img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
}

.item-info h3 {
  margin: 0 0 0.3rem 0;
  font-size: 1rem;
  color: #333;
}

.item-categoria {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 0.3rem 0;
}

.item-precio {
  font-weight: bold;
  color: var(--verde);
  margin: 0;
}

.item-cantidad {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-cantidad {
  width: 30px;
  height: 30px;
  border: 1px solid var(--verde);
  background: white;
  color: var(--verde);
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s;
}

.btn-cantidad:hover {
  background: var(--verde);
  color: white;
}

.item-cantidad .cantidad {
  min-width: 30px;
  text-align: center;
  font-weight: bold;
}

.item-subtotal {
  font-size: 1.1rem;
  font-weight: bold;
  color: #333;
  min-width: 80px;
  text-align: right;
}

.btn-eliminar {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  transition: all 0.2s;
  border-radius: 4px;
}

.btn-eliminar:hover {
  background: rgba(220, 53, 69, 0.1);
  transform: scale(1.1);
}

.carrito-resumen {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  position: sticky;
  top: 100px;
}

.carrito-resumen h2 {
  color: var(--verde);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--verde);
}

.resumen-detalle {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.resumen-linea {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 1rem;
}

.resumen-linea.total {
  padding-top: 1rem;
  border-top: 2px solid #dee2e6;
  font-size: 1.2rem;
  color: var(--verde);
}

.resumen-acciones {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.btn-confirmar,
.btn-vaciar,
.btn-continuar {
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  font-weight: bold;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  font-size: 1rem;
}

.btn-confirmar {
  background: var(--verde);
  color: white;
}

.btn-confirmar:hover {
  background: #45a049;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.btn-vaciar {
  background: #dc3545;
  color: white;
}

.btn-vaciar:hover {
  background: #c82333;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.btn-continuar {
  background: white;
  color: var(--verde);
  border: 2px solid var(--verde);
  display: block;
}

.btn-continuar:hover {
  background: var(--verde);
  color: white;
}

body:has(.login-container) .navlinks a {
  font-size: 1.1rem;
}

/* ===========================================
   FACTURACIÓN Y FACTURA
   DESKTOP FIRST - 1200px+
   =========================================== */

.modal-facturacion .modal-content {
  max-width: 600px;
}

.radio-group {
  display: flex;
  gap: 20px;
  margin-top: 8px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: normal;
}

.radio-label input[type="radio"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.btn-cancelar {
  padding: 10px 24px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: white;
  color: var(--negro);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-cancelar:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.modal-factura .modal-content {
  max-width: 900px;
}

.factura-container {
  padding: 24px;
  background: white;
}

.factura-empresa {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--verde);
  margin-bottom: 24px;
}

.factura-logo {
  width: 80px;
  height: auto;
  margin-bottom: 12px;
}

.factura-empresa h2 {
  margin: 8px 0;
  color: var(--negro);
  font-size: 24px;
}

.factura-empresa p {
  margin: 4px 0;
  color: #666;
  font-size: 14px;
}

.factura-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
}

.factura-info h4 {
  margin: 0 0 12px 0;
  color: var(--verde);
  font-size: 16px;
  border-bottom: 2px solid var(--verde);
  padding-bottom: 8px;
}

.factura-info p {
  margin: 8px 0;
  font-size: 14px;
  color: var(--negro);
}

.factura-info-left,
.factura-info-right {
  display: flex;
  flex-direction: column;
}

.factura-productos {
  margin-bottom: 24px;
  overflow-x: auto;
}

.factura-tabla {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.factura-tabla thead {
  background: var(--verde);
  color: white;
}

.factura-tabla th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
}

.factura-tabla td {
  padding: 12px;
  border-bottom: 1px solid #e0e0e0;
  font-size: 14px;
  color: var(--negro);
}

.factura-tabla tbody tr:hover {
  background: #f8f9fa;
}

.factura-observaciones {
  margin-bottom: 24px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid var(--verde);
}

.factura-observaciones p {
  margin: 4px 0;
  font-size: 14px;
  color: var(--negro);
}

.factura-total {
  text-align: right;
  padding: 16px;
  background: var(--verde);
  color: white;
  border-radius: 8px;
  margin-bottom: 20px;
}

.factura-total p {
  margin: 0;
  font-size: 20px;
}

.total-final {
  font-size: 28px;
  font-weight: bold;
}

.btn-imprimir {
  padding: 10px 24px;
  border: 1px solid var(--verde);
  border-radius: 6px;
  background: white;
  color: var(--verde);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-imprimir:hover {
  background: var(--verde);
  color: white;
}

/* ===========================================
   VENTAS Y LOGS EN ADMIN
   DESKTOP FIRST - 1200px+
   =========================================== */

.ventas-filters {
  background: white;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  gap: 20px;
  align-items: flex-end;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filter-group {
  flex: 1;
  min-width: 200px;
}

.filter-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--negro);
  font-size: 14px;
}

.filter-group input[type="date"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.filter-group input[type="date"]:focus {
  outline: none;
  border-color: var(--verde);
}

.filter-actions {
  display: flex;
  gap: 10px;
}

.btn-filter,
.btn-clear-filter {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s;
  white-space: nowrap;
}

.btn-filter {
  background: var(--verde);
  color: white;
}

.btn-filter:hover {
  background: var(--verde-oscuro);
  transform: scale(1.05);
}

.btn-clear-filter {
  background: #f5f5f5;
  color: #666;
}

.btn-clear-filter:hover {
  background: #e0e0e0;
}

.ventas-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.ventas-table-container {
  overflow-x: auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.admin-table .badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  position: static !important;
}

.venta-info .badge,
.modal .badge {
  display: inline-block !important;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  position: static !important;
}

.admin-table .badge-completada,
.venta-info .badge-completada,
.modal .badge-completada {
  background: #e8f5e9;
  color: #2e7d32;
}

.admin-table .badge-pendiente,
.venta-info .badge-pendiente,
.modal .badge-pendiente {
  background: #fff9c4;
  color: #f57f17;
}

.admin-table .badge-cancelada,
.venta-info .badge-cancelada,
.modal .badge-cancelada {
  background: #ffebee;
  color: #c62828;
}

.badge-modulo-auth {
  background: #e3f2fd;
  color: #1565c0;
}

.badge-modulo-productos {
  background: #fff3e0;
  color: #e65100;
}

.badge-modulo-usuarios {
  background: #f3e5f5;
  color: #6a1b9a;
}

.badge-modulo-ventas {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-accion {
  background: #f5f5f5;
  color: #424242;
  text-transform: uppercase;
  font-size: 10px;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: #f5f5f5;
  transform: scale(1.1);
}

.modal-large {
  max-width: 800px;
}

.modal-body {
  padding: 24px;
}

.venta-info {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.info-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.info-col {
  flex: 1;
  min-width: 200px;
}

.info-col.full-width {
  flex-basis: 100%;
}

.info-col strong {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-col span {
  display: block;
  font-size: 15px;
  color: var(--negro);
}

.info-section {
  padding: 20px 0;
  border-top: 1px solid #e0e0e0;
}

.info-section:first-child {
  border-top: none;
  padding-top: 0;
}

.info-section h4 {
  margin: 0 0 16px 0;
  color: var(--negro);
  font-size: 18px;
}

.venta-totales {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  margin-top: 20px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 15px;
}

.total-row.total-final {
  border-top: 2px solid #e0e0e0;
  padding-top: 12px;
  margin-top: 8px;
  font-size: 18px;
}

.total-row strong {
  color: var(--verde);
}

/* Clase helper */
.hidden {
  display: none !important;
}

/* Estilos específicos para login */
.login-container ~ .navbar nav,
body:has(.login-container) .navbar nav {
  flex: 1;
  display: flex;
  justify-content: center;
}

body:has(.login-container) .navlinks {
  justify-content: center;
}

/* ============================================================
   MEDIA QUERIES - RESPONSIVE DESIGN
   DESKTOP FIRST: Descendiendo en tamaño
   Orden: DESKTOP (1200px+) > TABLET (1024px-768px) > MÓVIL (<768px) > MÓVIL PEQUEÑO (<480px)
   ============================================================ */

/* ============================================================
   BARRA DE USUARIO - RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .user-bar {
    padding: 6px 0;
  }
  
  .user-bar-content {
    padding: 0 8px;
    max-width: 100%;
  }
  
  .user-actions {
    gap: 6px;
  }
  
  .user-info .user-name {
    max-width: 100px;
    font-size: 0.75rem;
    padding: 3px 8px;
  }
  
  .user-actions .admin-btn,
  .user-actions .carrito {
    font-size: 1rem;
    padding: 4px;
  }
  
  .user-actions .btn-logout,
  .user-actions .btn-login {
    font-size: 0.7rem;
    padding: 4px 6px;
  }
}

/* ============================================================
   NAVBAR Y MENÚ MÓVIL - RESPONSIVE (<768px)
   ============================================================ */

@media (max-width: 768px) {
  /* Prevenir overflow horizontal */
  * {
    max-width: 100%;
  }
  
  img, video {
    max-width: 100%;
    height: auto;
  }
  
  /* Ajustar contenedor principal */
  .site {
    margin: 12px auto;
    padding: 0 8px;
    max-width: 100%;
  }
  
  /* Ajustar navbar */
  .navbar {
    padding: 8px 6px;
    margin-top: 0;
    border-radius: 8px;
    top: 45px;
  }
  
  /* Mostrar botón hamburguesa */
  .hamburger {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    width: 44px;
    height: 44px;
    z-index: 1001;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.3s ease;
  }
  
  .hamburger:active {
    transform: scale(0.95);
  }
  
  .hamburger-line {
    display: block;
    width: 28px;
    height: 3px;
    background-color: var(--verde);
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
  }
  
  /* Animación del hamburguesa cuando está activo */
  .hamburger.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
  }
  
  .hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
  }
  
  .hamburger.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
  }
  
  /* Menú móvil */
  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--negro);
    padding: 80px 20px 20px;
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
    z-index: 1002;
    transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow-y: auto;
  }
  
  .nav-menu.active {
    right: 0;
  }
  
  /* Enlaces verticales en móvil */
  .navlinks {
    flex-direction: column;
    gap: 0;
    align-items: stretch;
  }
  
  .navlinks li {
    width: 100%;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  
  .navlinks a {
    display: block;
    padding: 16px 12px;
    font-size: 1rem;
    color: var(--blanco);
    transition: all 0.3s ease;
  }
  
  .navlinks a:hover,
  .navlinks a.active {
    background: rgba(30, 203, 99, 0.1);
    color: var(--verde);
    border-bottom: none;
    padding-left: 20px;
  }
  
  /* Botón cerrar */
  .nav-close {
    display: block !important;
    top: 20px;
    right: 20px;
    color: var(--verde);
    font-size: 32px;
  }
  
  .nav-close:hover {
    color: var(--blanco);
    transform: rotate(90deg);
  }
  
  /* Overlay oscuro */
  .nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .nav-overlay.active {
    display: block;
    opacity: 1;
  }
  
  /* Ajustar carrito en móvil */
  .carrito {
    font-size: 1.2rem;
    padding: 6px 8px;
  }
}

/* ============================================================
   LAYOUT PRINCIPAL - RESPONSIVE
   ============================================================ */

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 12px;
  }
  
  .layout-single-column {
    padding: 0 12px;
  }
  
  .layout-single-column .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
  
  .layout-single-column .presentacion {
    padding: 30px 20px;
  }
  
  .layout-single-column .presentacion h2 {
    font-size: 2rem;
  }
  
  .section-title h3 {
    font-size: 1.5rem;
  }
  
  .section-icon {
    width: 28px;
    height: 28px;
  }
  
  aside.left {
    display: block;
    max-width: 100%;
  }
  
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .small-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 10px;
    max-width: 100%;
  }
  
  .layout-single-column {
    padding: 0 8px;
    margin: 12px auto;
  }
  
  .layout-single-column .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .layout-single-column .presentacion {
    padding: 24px 16px;
    margin-bottom: 24px;
  }
  
  .layout-single-column .presentacion h2 {
    font-size: 1.6rem;
  }
  
  .layout-single-column .presentacion p {
    font-size: 0.95rem;
  }
  
  .section-title {
    margin: 24px 0 16px 0;
  }
  
  .section-title h3 {
    font-size: 1.3rem;
  }
  
  .section-icon {
    width: 24px;
    height: 24px;
  }
  
  aside.left {
    padding: 10px;
    margin-bottom: 10px;
  }
  
  .grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .small-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .logo-svg {
    display: block;
  }
  
  .brand h1 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  /* Carrusel más pequeño */
  .slide {
    height: 250px;
  }
  
  /* Íconos en columna única */
  .icons-row {
    flex-direction: column;
    gap: 10px;
  }
  
  .icon-card {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .layout {
    gap: 8px;
    margin-top: 8px;
  }
  
  .layout-single-column .grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .layout-single-column .presentacion {
    padding: 20px 12px;
    margin-bottom: 20px;
  }
  
  .layout-single-column .presentacion h2 {
    font-size: 1.4rem;
  }
  
  .section-title {
    margin: 20px 0 12px 0;
  }
  
  .section-title h3 {
    font-size: 1.2rem;
  }
  
  .grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .small-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .brand h1 {
    font-size: 13px;
  }
  
  /* Ajustes para pantallas muy pequeñas */
  .site {
    padding: 0 6px;
    margin: 10px auto;
  }
  
  .navbar {
    padding: 6px 4px;
  }
  
  .user-bar-content {
    padding: 0 6px;
  }
  
  .slide {
    height: 200px;
  }
  
  .presentacion {
    padding: 12px;
  }
  
  aside.left {
    padding: 8px;
  }
}

/* ============================================================
   DISPOSITIVOS MUY PEQUEÑOS - REDMI NOTE 14 y similares
   (412px y menores)
   ============================================================ */

@media (max-width: 480px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 8px;
    padding: 0;
  }
  
  .layout-single-column {
    padding: 0 4px;
    margin: 8px auto;
  }
  
  .layout-single-column .grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .layout-single-column .presentacion {
    padding: 16px 10px;
    margin-bottom: 16px;
    border-radius: 8px;
  }
  
  .layout-single-column .presentacion h2 {
    font-size: 1.2rem;
    margin-bottom: 10px;
  }
  
  .layout-single-column .presentacion p {
    font-size: 0.85rem;
  }
  
  .section-title {
    margin: 16px 0 10px 0;
  }
  
  .section-title h3 {
    font-size: 1.1rem;
  }
  
  .section-icon {
    width: 20px;
    height: 20px;
  }
  
  .site {
    padding: 0 4px;
    margin: 8px auto;
    max-width: 100%;
  }
  
  .navbar {
    padding: 6px 4px;
    gap: 4px;
  }
  
  .brand h1 {
    font-size: 12px;
    max-width: 150px;
  }
  
  .user-bar-content {
    padding: 0 4px;
  }
  
  .user-actions {
    gap: 4px;
  }
  
  .user-info .user-name {
    font-size: 0.7rem;
    max-width: 80px;
    padding: 2px 6px;
  }
  
  .card-content {
    padding: 1rem;
  }
  
  .card h4 {
    font-size: 1rem;
  }
  
  .price {
    font-size: 1.2rem;
  }
  
  .slide {
    height: 180px;
  }
  
  /* Admin panel para móviles pequeños */
  .admin-panel {
    padding: 8px 4px;
  }
  
  .admin-header h2 {
    font-size: 1.2rem;
  }
  
  .admin-header p {
    font-size: 0.8rem;
  }
  
  .admin-stats {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  
  .stat-card {
    padding: 10px;
  }
  
  .stat-number {
    font-size: 18px;
  }
  
  .stat-label {
    font-size: 9px;
  }
  
  .admin-tabs {
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  
  .admin-tabs::-webkit-scrollbar {
    display: none;
  }
  
  .tab-btn {
    padding: 8px 12px;
    font-size: 11px;
  }
  
  .admin-table td::before {
    font-size: 10px;
    min-width: 65px;
  }
  
  .admin-table td {
    padding: 8px 6px;
    font-size: 11px;
  }
  
  .admin-table td img {
    max-width: 45px;
    max-height: 45px;
  }
  
  .admin-table .btn-edit,
  .admin-table .btn-delete {
    padding: 6px 8px;
    font-size: 11px;
    min-width: 60px;
  }
  
  .btn-icon {
    padding: 6px 10px;
    font-size: 14px;
  }
  
  .categoria-badge,
  .estatus-badge,
  .admin-table .badge {
    font-size: 10px;
    padding: 3px 6px;
  }
  
  .admin-table tbody tr {
    margin-bottom: 12px;
    padding: 10px;
  }
  
  /* Filtros de ventas en móviles pequeños */
  .ventas-filters {
    padding: 12px;
    gap: 12px;
  }
  
  .filter-group label {
    font-size: 12px;
  }
  
  .filter-group input[type="date"] {
    padding: 8px 10px;
    font-size: 12px;
  }
  
  .btn-filter,
  .btn-clear-filter {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .ventas-stats {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  
  aside.left {
    padding: 6px;
  }
  
  .carousel {
    padding: 8px;
  }
  
  .presentacion {
    padding: 10px;
  }
  
  footer {
    padding: 12px;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ============================================================
   ADMINISTRACIÓN - RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .stat-card {
    padding: 16px;
  }
  
  .stat-number {
    font-size: 24px;
  }
  
  .stat-label {
    font-size: 11px;
  }
  
  .admin-tabs {
    flex-wrap: wrap;
    gap: 6px;
    overflow-x: auto;
  }
  
  .tab-btn {
    padding: 10px 16px;
    font-size: 14px;
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: fit-content;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .admin-actions {
    margin-bottom: 16px;
  }
  
  .btn-add {
    width: 100%;
    padding: 12px;
    font-size: 14px;
  }
  
  /* Convertir tablas en cards para móvil */
  .products-table-container,
  .users-table-container,
  .ventas-table-container {
    overflow-x: visible;
    background: transparent;
    box-shadow: none;
  }
  
  .admin-table {
    border: 0;
  }
  
  .admin-table thead {
    display: none;
  }
  
  .admin-table tbody {
    display: block;
  }
  
  .admin-table tbody tr {
    display: block;
    margin-bottom: 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 12px;
    border: 1px solid #e0e0e0;
  }
  
  .admin-table tbody tr:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  
  .admin-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 8px;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    text-align: right;
  }
  
  .admin-table td:last-child {
    border-bottom: none;
  }
  
  .admin-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #666;
    text-align: left;
    margin-right: 16px;
    flex-shrink: 0;
    min-width: 80px;
  }
  
  /* Ajustar imágenes de productos en móvil */
  .admin-table td img {
    max-width: 60px;
    max-height: 60px;
    object-fit: contain;
  }
  
  /* Botones de acción en móvil */
  .admin-table td:has(.btn-edit) {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .admin-table .btn-edit,
  .admin-table .btn-delete {
    padding: 8px 12px;
    font-size: 14px;
    margin: 0;
    flex: 1;
    min-width: 80px;
  }
  
  /* Fila de totales en móvil */
  .admin-table .totals-row {
    display: flex !important;
    flex-direction: column;
    background: #f5f5f5;
    border: 2px solid #2e7d32;
    margin-top: 8px;
    padding: 12px !important;
  }
  
  .admin-table .totals-row td {
    display: flex;
    justify-content: space-between;
    border: none;
    padding: 6px 8px;
  }
  
  .admin-table .totals-row td::before {
    content: '';
  }
  
  /* Badges en móvil */
  .categoria-badge,
  .estatus-badge,
  .admin-table .badge {
    font-size: 11px;
    padding: 4px 8px;
  }
  
  /* Botón de icono */
  .btn-icon {
    padding: 8px 12px;
    font-size: 16px;
  }
  
  /* Select de rol en móvil */
  .role-select {
    width: auto;
    min-width: 100px;
  }
}

/* ============================================================
   CARRITO - RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .carrito-contenido {
    grid-template-columns: 1fr;
  }
  
  .carrito-resumen {
    position: static;
  }
  
  .carrito-item {
    grid-template-columns: 60px 1fr;
    gap: 0.8rem;
  }
  
  .item-imagen img {
    width: 60px;
    height: 60px;
  }
  
  .item-cantidad,
  .item-subtotal {
    grid-column: 2;
  }
  
  .item-acciones {
    grid-column: 2;
    text-align: right;
  }
}

/* ============================================================
   FACTURACIÓN - RESPONSIVE
   ============================================================ */

@media print {
  .modal {
    background: white !important;
    position: static;
  }
  
  .modal-content {
    box-shadow: none;
    max-width: 100%;
    max-height: none;
  }
  
  .modal-header,
  .modal-actions {
    display: none !important;
  }
  
  .factura-container {
    padding: 0;
  }
  
  .navbar,
  .user-bar,
  .footer {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .modal-facturacion .modal-content,
  .modal-factura .modal-content {
    width: 95%;
    max-height: 95vh;
  }
  
  .factura-info {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .factura-tabla {
    font-size: 12px;
  }
  
  .factura-tabla th,
  .factura-tabla td {
    padding: 8px 6px;
  }
  
  .modal-actions {
    flex-direction: column;
  }
  
  .modal-actions button {
    width: 100%;
  }
}

/* ============================================================
   VENTAS Y LOGS - RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .ventas-filters {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-group {
    width: 100%;
  }
  
  .filter-actions {
    width: 100%;
  }
  
  .filter-actions button {
    flex: 1;
  }
  
  .ventas-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .info-row {
    flex-direction: column;
    gap: 16px;
  }
  
  .info-col {
    min-width: 100%;
  }
  
  .modal-large {
    max-width: 95%;
  }
}
