/* ===== Importar fuente moderna (Google Fonts) ===== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap');

:root {
  /* Paleta Moderna y Vibrante */
  --primary: #7c3aed;        
  --primary-dark: #6d28d9;
  --primary-light: #8b5cf6;
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  
  --success: #10b981;
  --success-hover: #059669;
  
  --bg-input: #f1f5f9;       
  --gris-borde: #e2e8f0;
  --texto-principal: #1e293b;
  --texto-secundario: #64748b;
  
  /* Sombras Modernas */
  --shadow-purple: 0 4px 14px 0 rgba(124, 58, 237, 0.25);
  --shadow-red: 0 4px 14px 0 rgba(239, 68, 68, 0.25);
  --shadow-green: 0 4px 14px 0 rgba(16, 185, 129, 0.25);
  --shadow-card: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
}

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  font-family: 'Poppins', sans-serif; 
}

/* ===== Fondo y Estructura ===== */
body {
  background: linear-gradient(rgba(15, 23, 42, 0.6), rgba(15, 23, 42, 0.6)), 
              url('../img/fondo.png') no-repeat center center fixed;
  background-size: cover;
  display: flex; 
  flex-direction: column; 
  align-items: center;
  color: var(--texto-principal);
  min-height: 100vh;
}

.logo img { 
  width: 140px; /* Un poco más pequeño para ser más sutil */
  margin: 30px 0 20px; 
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3)); 
  transition: transform 0.3s ease;
}

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

@media(max-width: 480px) { 
  .logo img { width: 110px; margin-top: 20px; } 
}

/* ===== Contenedores ===== */
.login-box, .login-box2 {
  width: min(92vw, 480px);
  margin: 20px auto;
  padding: 30px;
  border-radius: 16px; /* Menos curvo, más serio */
  background: rgba(255, 255, 255, 0.98); 
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
  border: 1px solid #fff;
}

.wide-box { width: min(94vw, 900px); }

/* ===== Inputs y Textarea ===== */
input, select, textarea {
  width: 100%; 
  min-height: 44px; /* Más compacto */
  padding: 10px 14px; 
  margin-bottom: 16px;
  border: 1px solid transparent; 
  background-color: var(--bg-input); 
  border-radius: 8px;
  font-size: 14px;
  color: var(--texto-principal);
  transition: all 0.2s ease;
  outline: none;
  font-weight: 500;
}

input::placeholder, textarea::placeholder { color: #94a3b8; font-weight: 400; }
input:focus, select:focus, textarea:focus {
  background-color: #fff;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1); 
}

textarea { min-height: 80px; resize: vertical; }

/* ===== BOTONES REFINADOS Y MÁS PEQUEÑOS ===== */
button {
  display: inline-flex; 
  align-items: center; 
  justify-content: center;
  width: 100%; 
  min-height: 42px; /* Reducido de 50px a 42px */
  padding: 0 16px;  /* Menos padding lateral */
  margin-bottom: 12px;
  border: none; 
  border-radius: 8px; /* Bordes más estándar */
  font-weight: 600; 
  font-size: 14px;  /* Texto más fino */
  cursor: pointer; 
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  text-transform: none; 
}

button:active { transform: scale(0.98); }

/* Variantes de Botones */
.btn-lila { 
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-dark) 100%);
  color: #fff; 
  box-shadow: var(--shadow-purple);
}
.btn-lila:hover { 
  background: linear-gradient(135deg, #9061f9 0%, #7c3aed 100%);
  transform: translateY(-1px);
}

.btn-rojo { 
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  color: #fff; 
  box-shadow: var(--shadow-red);
}
.btn-rojo:hover { 
  background: linear-gradient(135deg, #fca5a5 0%, #f87171 100%);
  transform: translateY(-1px);
}

.btn-verde { 
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  color: #fff; 
  box-shadow: var(--shadow-green);
}
.btn-verde:hover { 
  background: linear-gradient(135deg, #6ee7b7 0%, #34d399 100%);
  transform: translateY(-1px);
}

/* Botón principal un poco más alto, pero sin exagerar */
.btn-verde-alto { 
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff; 
  min-height: 48px; /* Reducido de 64px a 48px */
  font-size: 15px; 
  box-shadow: var(--shadow-green);
}
.btn-verde-alto:hover { transform: translateY(-1px); }

/* ===== Panel de Admin (Grid) ===== */
.admin-botones {
  display: grid; 
  gap: 15px; 
  grid-template-columns: 1fr;
  margin-top: 20px;
}
@media(min-width: 768px) {
  .admin-botones { grid-template-columns: repeat(2, minmax(200px, 1fr)); }
}
@media(min-width: 1100px) {
  .admin-botones { 
    grid-template-columns: repeat(3, minmax(200px, 1fr));
    max-width: 900px; 
    margin: 20px auto; 
  }
}
.admin-botones a { text-decoration: none; }

/* ===== Mensajes de Alerta ===== */
.mensaje-exito, .mensaje-error {
  padding: 14px; 
  border-radius: 8px; 
  margin: 15px auto;
  width: 100%; 
  max-width: 480px; 
  text-align: center;
  font-weight: 500;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
}
.mensaje-exito { background: #ecfdf5; color: #047857; border-left: 4px solid #10b981; }
.mensaje-error { background: #fef2f2; color: #b91c1c; border-left: 4px solid #ef4444; }

/* ===== Tienda y Productos (Vista Cliente Grid) ===== */
.tienda-productos {
  display: grid; 
  gap: 20px; 
  margin: 30px auto;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  width: min(94vw, 1100px);
}

.producto-card {
  background: #fff;
  border-radius: 12px; 
  padding: 16px;
  display: flex; 
  flex-direction: column; 
  gap: 10px;
  box-shadow: var(--shadow-card);
  border: 1px solid #f1f5f9;
  transition: all 0.2s ease;
}

.producto-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-light);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.producto-card img { 
  width: 100%; 
  aspect-ratio: 1 / 1; 
  object-fit: cover; 
  border-radius: 8px; 
  margin-bottom: 5px;
}

.producto-card h3 { font-size: 16px; color: var(--texto-principal); font-weight: 600; line-height: 1.2; }
.producto-card p { font-size: 13px; color: var(--texto-secundario); line-height: 1.4; }
.producto-card .acciones { margin-top: auto; padding-top: 10px; }


/* ===============================================================
   NUEVO: DISEÑO EN LISTA PARA EL PANEL DE ADMIN (editar-tienda)
   =============================================================== */
.tienda-main .tienda-productos {
  display: flex; /* Cambia la cuadrícula por flexbox vertical */
  flex-direction: column;
  gap: 12px;
  margin-top: 0;
}

.tienda-main .producto-card {
  flex-direction: row; /* Elementos uno al lado del otro */
  align-items: center;
  padding: 12px 16px;
  gap: 15px;
}

/* Imagen en miniatura */
.tienda-main .producto-card img {
  width: 50px;
  height: 50px;
  margin-bottom: 0;
  border-radius: 6px;
  flex-shrink: 0;
}

/* Contenido en el centro */
.tienda-main .producto-card .contenido {
  flex: 1; /* Ocupa todo el espacio disponible */
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.tienda-main .producto-card h3 { font-size: 15px; margin: 0; }
.tienda-main .producto-card p { margin: 0; }
.tienda-main .producto-card p:last-child { font-size: 12px; }

/* Botonera de acciones alineada a la derecha */
.tienda-main .producto-card .acciones {
  margin-top: 0;
  padding-top: 0;
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
}

/* Mini botones para la lista de admin */
.tienda-main .producto-card .acciones button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
  margin-bottom: 0;
  width: auto;
}


/* ===== Autocompletar ===== */
.sugerencias-box {
  position: absolute; left: 0; right: 0; margin-top: 6px; background: #fff; 
  border: 1px solid var(--gris-borde); border-radius: 8px; max-height: 250px; 
  overflow-y: auto; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); z-index: 100;
}
.sugerencia { padding: 12px 16px; cursor: pointer; font-size: 13px; border-bottom: 1px solid #f1f5f9; }
.sugerencia:hover, .sugerencia.activa { background: #f8fafc; color: var(--primary); font-weight: 600; }

/* ===== Mini Forms ===== */
.mini-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mini-form input[type="number"] { width: auto; flex: 1; min-width: 70px; text-align: center; margin-bottom: 0; background: #fff; border: 1px solid var(--gris-borde); }
.mini-form button { width: auto !important; margin-bottom: 0; padding: 0 16px; }

/* ===== Utilidades Grid ===== */
.admin-botones a[style*="grid-column: 1 / -1"] { width: 100%; }

@media(max-width: 480px){
    body { padding-bottom: 60px; }
    .login-box, .login-box2 { padding: 25px 20px; }
    
    /* En celulares, la lista de admin vuelve a ser vertical para que quepa */
    .tienda-main .producto-card { flex-direction: column; align-items: flex-start; }
    .tienda-main .producto-card img { width: 100%; height: auto; aspect-ratio: 16/9; }
}