/* ============================================================
   PANELES ALCALAT — GUÍA DE PEDIDOS
   Paleta corporativa: Rojo #CC0000 · Blanco · Gris claro
   ============================================================ */

:root {
  --rojo:      #CC0000;
  --rojo-dark: #A50000;
  --rojo-bg:   #FFF5F5;
  --blanco:    #FFFFFF;
  --gris-bg:   #F4F4F4;
  --gris-card: #FAFAFA;
  --borde:     #E2E2E2;
  --texto:     #1C1C1C;
  --texto-mid: #5A5A5A;
  --texto-lit: #9A9A9A;
  --verde:     #27AE60;
  --naranja:   #E67E22;
}

/* RESET */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--gris-bg);
  color: var(--texto);
  display: flex;
  min-height: 100vh;
  font-size: 13px;
  line-height: 1.4;
}

/* ── LOGO ─────────────────────────────────────────────────── */
.logo-container {
  text-align: center;
  margin-bottom: 14px;
  width: 100%;
}
.logo-app {
  max-width: 100%;
  height: auto;
  max-height: 72px;
  object-fit: contain;
}

/* ── LAYOUT ───────────────────────────────────────────────── */
.sidebar {
  width: 290px;
  background: var(--blanco);
  border-right: 3px solid var(--rojo);
  padding: 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
  box-shadow: 2px 0 10px rgba(0,0,0,0.06);
}

.main {
  flex: 1;
  padding: 18px 22px;
  overflow-y: auto;
}

/* ── NAVEGACIÓN TIPO FLECHA ──────────────────────────────── */
.nav-pills {
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 0;
  background: transparent;
}

.nav-pills .pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px 0 22px;
  margin-right: 14px;
  text-decoration: none;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: white !important;
  border: none;
  white-space: nowrap;
  letter-spacing: 0.4px;
}

.nav-pills .pill::after {
  content: "";
  position: absolute;
  right: -17px;
  top: 0;
  border-top: 17px solid transparent;
  border-bottom: 17px solid transparent;
  border-left: 17px solid #555;
  z-index: 2;
}
.nav-pills .pill::before {
  content: "";
  position: absolute;
  left: 0; top: 0;
  border-top: 17px solid transparent;
  border-bottom: 17px solid transparent;
  border-left: 17px solid var(--gris-bg);
}

.icon-home-white { font-size: 14px; margin-right: 6px; color: white; }

.nav-pills .pill-inicio {
  background: #3A3A3A !important;
  padding-left: 12px;
  border-radius: 4px 0 0 4px;
}
.nav-pills .pill-inicio::before { display: none; }
.nav-pills .pill-inicio::after  { border-left-color: #3A3A3A; }

.nav-pills .pill-cat { background: var(--rojo) !important; }
.nav-pills .pill-cat::after { border-left-color: var(--rojo); }
.nav-pills .pill-cat.pill-activa { animation: pulse-rojo 2s infinite; }

.nav-pills .pill-sub {
  background: var(--naranja) !important;
  animation: pulse-naranja 2s infinite;
}
.nav-pills .pill-sub::after { border-left-color: var(--naranja); }

@keyframes pulse-rojo {
  0%   { box-shadow: 0 0 0 0 rgba(204,0,0,0.6); }
  70%  { box-shadow: 0 0 0 7px rgba(204,0,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(204,0,0,0); }
}
@keyframes pulse-naranja {
  0%   { box-shadow: 0 0 0 0 rgba(230,126,34,0.6); }
  70%  { box-shadow: 0 0 0 7px rgba(230,126,34,0); }
  100% { box-shadow: 0 0 0 0 rgba(230,126,34,0); }
}

/* ── BOTONES MÓVIL (VOLVER / HOME) ──────────────────────── */
.btn-volver-movil {
  display: none;
  position: fixed;
  top: 12px; right: 62px;
  background: #2C2C2C;
  color: white;
  padding: 9px 15px 9px 11px;
  border-radius: 7px;
  font-size: 12px; font-weight: 700;
  text-decoration: none;
  z-index: 9999;
  box-shadow: 0 3px 10px rgba(0,0,0,0.22);
  border: 1.5px solid rgba(255,255,255,0.2);
  transition: all 0.25s;
  align-items: center;
  gap: 7px;
  letter-spacing: 0.3px;
}
.btn-volver-movil::before {
  content: '';
  width: 16px; height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='19' y1='12' x2='5' y2='12'%3E%3C/line%3E%3Cpolyline points='12 19 5 12 12 5'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}
.btn-volver-movil:hover { background: #111; box-shadow: 0 5px 16px rgba(0,0,0,0.3); }

.btn-home-movil {
  display: none;
  position: fixed;
  top: 12px; right: 12px;
  background: white;
  padding: 9px 10px;
  border-radius: 7px;
  text-decoration: none;
  z-index: 9999;
  box-shadow: 0 3px 10px rgba(0,0,0,0.18);
  border: 1.5px solid #CCC;
  transition: all 0.25s;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
}
.btn-home-movil::before {
  content: '';
  width: 18px; height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'%3E%3C/path%3E%3Cpolyline points='9 22 9 12 15 12 15 22'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}
.btn-home-movil:hover { background: #F5F5F5; border-color: #999; }

@media (max-width: 768px) {
  .btn-volver-movil { display: flex !important; }
  .btn-home-movil   { display: flex !important; }
  .pill-label       { display: none; }
}

/* ── ICONOS DE BOTÓN ────────────────────────────────────── */
.icon-btn {
  width: 17px; height: 17px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

/* ── BOTONES SIDEBAR ────────────────────────────────────── */
.btn-wa, .btn-email {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  font-size: 12px;
  font-weight: bold;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  color: white;
  width: 100%;
  margin-bottom: 7px;
  transition: filter 0.2s;
  letter-spacing: 0.3px;
}
.btn-wa    { background: #25D366; }
.btn-wa:hover { filter: brightness(0.9); }
.btn-email { background: #3498DB; }
.btn-email:hover { filter: brightness(0.9); }
.btn-email:disabled { background: #AABBC5; cursor: not-allowed; opacity: 0.7; }

/* ── BOTÓN BORRAR TODO ──────────────────────────────────── */
.btn-reset {
  background: var(--rojo-bg);
  color: var(--rojo);
  border: 1.5px solid var(--rojo);
  padding: 8px;
  border-radius: 7px;
  width: 100%;
  margin-top: 7px;
  cursor: pointer;
  font-size: 11px;
  font-weight: bold;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}
.btn-reset:hover { background: var(--rojo); color: white; }

/* ── GRID CATEGORÍAS ────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 14px;
  padding-bottom: 24px;
}
.card {
  background: var(--blanco);
  padding: 12px;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  border: 1px solid var(--borde);
  font-size: 12px;
  font-weight: 600;
  color: var(--texto);
  transition: all 0.2s;
}
.card:hover {
  border-color: var(--rojo);
  box-shadow: 0 4px 14px rgba(204,0,0,0.12);
  transform: translateY(-2px);
}
.card img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: contain;
  margin-bottom: 8px;
}

/* ── GRID PRODUCTOS ─────────────────────────────────────── */
.grid-products {
  display: grid;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 12px;
  padding-bottom: 100px;
}
.product-card {
  background: var(--blanco);
  padding: 11px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 5px rgba(0,0,0,0.07);
  border: 1px solid var(--borde);
  transition: box-shadow 0.2s;
}
.product-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,0.1); }

.product-card img {
  width: 100%;
  height: 108px;
  object-fit: contain;
  background: var(--gris-card);
  border-radius: 6px;
  margin-bottom: 8px;
}
.product-card h3 {
  font-size: 13px;
  color: var(--rojo);
  margin-bottom: 3px;
  height: 36px;
  overflow: hidden;
  line-height: 1.35;
}
.desc-roja {
  color: #B22222;
  font-weight: 600;
  font-size: 10px;
  margin-bottom: 7px;
  display: block;
  min-height: 26px;
  line-height: 1.3;
}

/* ── CONTROLES PRODUCTO ─────────────────────────────────── */
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: auto;
}
.controls label {
  font-size: 9px;
  font-weight: 700;
  color: var(--texto-mid);
  text-transform: uppercase;
  margin-bottom: 2px;
  display: block;
  letter-spacing: 0.3px;
}
input, select {
  height: 34px;
  border: 1px solid var(--borde);
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 13px;
  width: 100%;
  background: var(--blanco);
  color: var(--texto);
  transition: border-color 0.2s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--rojo);
  box-shadow: 0 0 0 2px rgba(204,0,0,0.08);
}
.btn-add {
  grid-column: span 2;
  background: var(--rojo);
  color: white;
  border: none;
  height: 36px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.btn-add:hover { background: var(--rojo-dark); }

/* ── CONFIRMACIÓN AÑADIDO ───────────────────────────────── */
.msg-confirmacion {
  display: none;
  grid-column: span 2;
  color: var(--verde);
  font-size: 10px;
  text-align: center;
  margin-top: 3px;
  font-weight: bold;
}

/* ── BOTÓN FLOTANTE CARRITO ─────────────────────────────── */
#btn-flotante-pedido {
  position: fixed !important;
  bottom: 22px !important;
  right: 16px !important;
  background: var(--rojo) !important;
  color: white !important;
  padding: 10px 17px !important;
  border-radius: 50px !important;
  font-weight: bold !important;
  font-size: 12px !important;
  box-shadow: 0 4px 14px rgba(204,0,0,0.35) !important;
  z-index: 999999 !important;
  display: none;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.35) !important;
  transition: transform 0.2s;
  letter-spacing: 0.3px;
}
#btn-flotante-pedido.activo { display: flex !important; }
#btn-flotante-pedido:hover  { transform: scale(1.03); }
#btn-flotante-pedido span.icono {
  filter: brightness(0) invert(1);
  font-size: 17px;
}

/* ── ENLACE SUBCATEGORÍA ────────────────────────────────── */
.btn-enlace-sub {
  display: block;
  background: var(--naranja) !important;
  color: white !important;
  text-align: center;
  padding: 5px 8px;
  font-size: 10px;
  margin-top: 4px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  transition: filter 0.2s;
  border: none;
  width: 82%;
  margin-left: auto;
  margin-right: auto;
  grid-column: span 2;
}
.btn-enlace-sub:hover { filter: brightness(0.88); text-decoration: none; }

/* ── CARRITO: ANIMACIÓN AÑADIR ──────────────────────────── */
#contenedor-carrito { background-color: #fafafa; }

@keyframes parpadeoVerde {
  0%, 100% { background-color: #fafafa; }
  50%       { background-color: #4CAF50; }
}
div#contenedor-carrito.resaltar-articulos {
  animation: parpadeoVerde 0.6s linear 1 !important;
  border: 2px solid var(--verde) !important;
}

/* ── BOTÓN PEDIDO LIBRE ─────────────────────────────────── */
.btn-pedido-libre {
  background: var(--rojo);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: bold;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 3px 12px rgba(204,0,0,0.25);
  transition: all 0.25s;
  margin: 16px auto 100px auto;
  max-width: 280px;
}
.btn-pedido-libre:hover {
  background: var(--rojo-dark);
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(204,0,0,0.35);
}
.btn-pedido-libre svg { width: 20px; height: 20px; }

/* ── MODALES ────────────────────────────────────────────── */
.modal-pedido-libre {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  animation: fadeIn 0.22s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-contenido {
  background: white;
  margin: 6% auto;
  padding: 22px;
  border-radius: 12px;
  width: 90%;
  max-width: 540px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.22);
  animation: slideDown 0.22s ease;
}
@keyframes slideDown {
  from { transform: translateY(-35px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 11px;
  border-bottom: 2px solid var(--rojo);
}
.modal-header h3 { color: var(--rojo); font-size: 17px; margin: 0; }

.btn-cerrar-modal {
  background: none;
  border: none;
  font-size: 22px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}
.btn-cerrar-modal:hover { background: #EEE; color: #333; }

.form-pedido-libre { display: flex; flex-direction: column; gap: 11px; }
.form-pedido-libre label { font-weight: bold; color: var(--texto); font-size: 13px; }
.form-pedido-libre textarea {
  width: 100%;
  min-height: 175px;
  padding: 11px;
  border: 1.5px solid var(--borde);
  border-radius: 6px;
  font-size: 14px;
  font-family: 'Segoe UI', sans-serif;
  resize: vertical;
  transition: border-color 0.2s;
}
.form-pedido-libre textarea:focus { outline: none; border-color: var(--rojo); }
.form-pedido-libre textarea::placeholder { color: #C0C0C0; }

.botones-modal { display: flex; gap: 8px; margin-top: 14px; }
.btn-guardar-pedido {
  flex: 1;
  background: var(--verde);
  color: white;
  border: none;
  padding: 11px;
  border-radius: 7px;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  transition: filter 0.2s;
}
.btn-guardar-pedido:hover { filter: brightness(0.9); }
.btn-cancelar {
  flex: 1;
  background: #EBEBEB;
  color: #555;
  border: none;
  padding: 11px;
  border-radius: 7px;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-cancelar:hover { background: #DCDCDC; }

/* ── ITEMS ESPECIALES EN CARRITO ────────────────────────── */
.item-pedido-libre { background: #FFFBEF !important; border-left: 3px solid #FFA726 !important; }
.item-pedido-libre .badge-libre {
  display: inline-block;
  background: #FFA726;
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: bold;
  margin-left: 4px;
}

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 1200px) {
  .grid-products { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 768px) {
  body { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 3px solid var(--rojo);
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  }
  .grid-products { grid-template-columns: 1fr !important; }

  .btn-email {
    background: white !important;
    color: #3498DB !important;
    border: 1.5px solid #3498DB !important;
  }
  .btn-wa {
    background: white !important;
    color: #25D366 !important;
    border: 1.5px solid #25D366 !important;
  }
  .btn-wa img.icon-btn { filter: none; }
  .btn-reset {
    background: white !important;
    color: var(--rojo) !important;
    border: 1.5px solid var(--rojo) !important;
  }
  .modal-contenido { margin: 8% auto; width: 96%; padding: 17px; }
  .modal-header h3 { font-size: 15px; }
  .form-pedido-libre textarea { min-height: 140px; }
  .botones-modal { flex-direction: column; }
}
