/* ==============================
   RESET
============================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial; background:#f6f7fb; color:#333; }

/* ==============================
   HEADER
============================== */
header{
  position: sticky;
  top: 0;
  z-index: 50;
  background:#50BBB5;
  color:#fff;
  padding:10px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  height:80px; /* altura fija */
  flex-wrap: nowrap; /* no permitir que se vaya a otra línea */
  gap:12px;
}

.producto h3 {
    display: -webkit-box;
    -webkit-line-clamp: 2;  /* Limita a 2 líneas */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-img { width: 40px; height: auto; }

/* barra de búsqueda */
.search-bar{
  flex:1 1 320px;
  display:flex;
  align-items:center;
  max-width:720px;
  margin-left:auto;
  margin-right:auto;
}
.search-bar input{
  flex:1;
  padding:10px 14px;
  border:none;
  outline:none;
  border-radius:999px 0 0 999px;
  background:#fff;
  color:#333;
  font-size:0.95rem;
}
.search-bar button{
  border:none;
  background:#164240;
  color:#fff;
  padding:10px 16px;
  cursor:pointer;
  border-radius:0 999px 999px 0;
  font-weight:600;
}

/* ==============================
   MENÚ
============================== */
nav{
  display:flex;
  align-items:center;
  gap:14px;
  margin-left:auto;
  flex-wrap:nowrap; /* mantener en una línea siempre */
}
nav a, nav button{
  color:#fff;
  text-decoration:none;
  font-weight:500;
  padding:8px 12px;
  border-radius:6px;
}
nav a:hover, nav button:hover{ background-color: rgba(255,255,255,0.2); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-content {
  display: none;
  position: absolute;
  top: 60%; left: 0;
  background: #50BBB5; color: #000000;
  min-width: 220px; border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

/*color de letras*/
.dropdown-content a {
  display:block; padding: 10px 16px;
  text-decoration:none; color:#ffffff;
}
/*hover encima de las letras*/
.dropdown-content a:hover { background-color: rgba(255,255,255,0.2); }
.dropdown:hover .dropdown-content { display:block; }

/* Carrito */
.cart-badge{ margin-left:8px; background:#164240; padding:6px 10px; border-radius:999px; font-weight:700; }

/* ==============================
   BOTÓN ADMIN
============================== */
.btn{
  border:none; background:#00cccc; color:#fff; padding:8px 12px;
  border-radius:8px; cursor:pointer; font-weight:700; text-decoration:none; transition:background .3s ease;
}
.btn:hover{ background:#009999; }

/* ==============================
   BOTÓN MENÚ HAMBURGUESA
============================== */

/* botón hamburguesa más arriba en el header */
.hamburger {
  display: none;
  font-size: 1.8rem;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  position: absolute; /* posición fija dentro del header */
  top: 10px;         /* desde la parte superior del header */
  right: 16px; 
  margin-left: auto;
  align-self: flex-start; /* alinearlo arriba */
  margin-top: 6px; /* ajustar según se vea bien */
}


/* ==============================
   MENÚ ACTIVADO (HAMBURGUESA MÓVIL)
============================== */
nav.active {
  display:flex; 
  flex-direction:column; 
  width:30%; 
  background:#00cccc; 
  padding:10px 0;
}
nav.active a, nav.active .cart-badge, nav.active .btn {
  width: auto;        /* quitar ancho completo */
  display: block;     /* mantiene el salto de línea */
  text-align: center; /* opcional, para centrar texto */
  padding: 8px 12px;  /* ajustar espacio interno */
  margin: 4px auto;   /* separar verticalmente y centrar */
}


/* ==============================
   RESPONSIVE HEADER Y MENÚ
============================== */
@media (max-width: 900px){
  header{ flex-direction:column; align-items:flex-start; }
  .hamburger { display:block; } /* Mostrar hamburguesa */
  nav { display:none; } /* Ocultar menú por defecto */
  .search-bar{ order:1; width:100%; margin:8px 0; }
}
@media (max-width: 600px){
  nav a, .cart-badge{ padding:6px 8px; font-size:.9rem; }
}
/* ==============================
   RESPONSIVE: ocultar barra en móviles
============================== */
@media (max-width: 900px) {
  .search-bar {
    display: none;
  }
}

/* ========================
   HERO ORIGINAL MODIFICADO
======================== */
.hero {
  max-width: 1200px; 
  margin: 18px auto 8px; 
  padding: 16px 20px;
  background: linear-gradient(135deg,#50BBB5,#e0ffff); 
  border-radius: 12px;
  display: flex; 
  align-items: flex-start; 
  justify-content: space-between; 
  gap: 20px;
  flex-direction: row;
  flex-wrap: wrap;
}

/* Contenedor de texto */
.hero .hero-text {
  flex: 1; 
  min-width: 250px;
}

.hero h1 { font-size: 1.6rem; color: #164240; }
.hero p { color: #164240; }
.hero .tag { 
  background: #164240; 
  color: #fff; 
  padding: 6px 10px; 
  border-radius: 999px; 
  font-size: .85rem; 
  display: inline-block; 
}


/* ==============================
   CONTENEDOR PRINCIPAL
============================== */
.wrap{ max-width:1200px; margin:0 auto; padding:0 20px 40px; }

/* ==============================
   TARJETAS DE PRODUCTOS
============================== */
.section-head{ display:flex; align-items:center; justify-content:space-between; margin:22px 0 12px; }
.section-head h2{ font-size:1.25rem; }
.products{
  display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:16px;
}
.card{
  background:#fff; border:1px solid #b2ffff; border-radius:12px; overflow:hidden;
  display:flex; flex-direction:column; transition:transform .2s ease, box-shadow .2s ease;
  box-shadow:0 2px 6px rgba(0,0,0,.04);
}
.card:hover{ transform:translateY(-2px); box-shadow:0 8px 20px rgba(0,0,0,.08); }
.card img{ width:100%; height:140px; object-fit:cover; background:#f0ffff; }
.card-body{ padding:12px; display:flex; flex-direction:column; gap:8px; flex:1; }
.title{ font-weight:700; font-size:.98rem; line-height:1.2; }
.desc{ color:#006666; font-size:.9rem; }
.price-row{ display:flex; align-items:center; justify-content:space-between; margin-top:auto; }
.price{ font-weight:800; color:#00cccc; }

/* Botones en tarjetas */
.btn-card{
  border:none; background:#00cccc; color:#fff; padding:8px 12px;
  border-radius:8px; cursor:pointer; font-weight:700; transition: background .3s;
}
.btn-card:hover{ background:#009999; }

/* ==============================
   RESULTADOS DE BÚSQUEDA
============================== */
#results{ display:none; }
.muted{ color:#006666; font-size:.95rem; }

/* ==============================
   PIE DE PÁGINA
============================== */
footer{ text-align:center; color:#006666; padding:24px 12px; }

/* ==============================
   SECCIÓN CATEGORÍAS
============================== */
.categories-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  justify-items: center;
  padding: 3%;
}
.category-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  overflow: hidden;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  width: 250px; 
  max-width: 100%;
}
.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}
.category-card img {
  width: 100%;
  height: 250px;
  object-fit: cover;
}
.category-card h3 {
  margin: 1rem 0;
  font-size: 1.2rem;
  color: #333;
}
.titulo { text-align: center; }

/* 📱 RESPONSIVE CATEGORÍAS */
@media (max-width: 1000px) {
  .categories-container { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .categories-container { grid-template-columns: 1fr; }
  .category-card { width: 90%; }
}

/* ==============================
   PERFIL FLOTANTE
============================== */
.perfil-overlay {
  position: fixed;
  top: 0;
  right: 0;
  width: 0;
  height: 100%;
  display: flex;
  justify-content: flex-end;
  overflow: hidden;
  transition: width 0.4s ease;
  z-index: 9999;
  background-color: transparent;
}
.perfil-container {
  width: 25%;
  min-width: 250px;
  height: calc(100% - 40px);
  margin-top: 40px;
  background-color: #fff;
  padding: 20px;
  box-shadow: -2px 0 8px rgba(0,0,0,0.2);
  transform: translateX(100%);
  transition: transform 0.4s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  overflow-y: auto;
  border-radius: 10px 0 0 10px;
}
/* FOTO PERFIL EN MENÚ */
#openPerfil img {
  width: 50px;           /* tamaño fijo */
  height: 50px;          /* tamaño fijo */
  object-fit: cover;     /* que siempre llene el contenedor */
  border-radius: 50%;    /* siempre circular */
  border: 2px solid #00cccc;
  display: block;
}

.perfil-title { margin-top: 0; margin-bottom: 15px; font-size: 1.5em; color: #006666; }
.perfil-overlay.active { width: auto; }
.perfil-overlay.active .perfil-container { transform: translateX(0); }
.perfil-close { background:none; border:none; font-size:24px; align-self:flex-end; cursor:pointer; color:#006666; }
.perfil-input, .perfil-btn { width:100%; margin-top:6px; border-radius:8px; border:1px solid #00cccc; padding:10px; }
.perfil-btn { background:#00cccc; color:#fff; font-weight:bold; cursor:pointer; }
.perfil-btn:hover { background:#009999; }

/* FOTO PERFIL */
/* FOTO PERFIL */
.perfil-foto-container {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 20px auto;
  border-radius: 50%;        /* Siempre circular */
  overflow: hidden;          /* Oculta cualquier exceso de imagen */
  display: flex;
  justify-content: center;
  align-items: center;
  background: #e0ffff;
}

.perfil-foto-label {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  cursor: pointer;
  border-radius: 50%;        /* Asegura que el label también sea circular */
  border: 2px solid #00cccc;
  font-size: 48px;
  color: #00cccc;
  font-weight: bold;
  transition: background 0.3s, color 0.3s;
}
.perfil-foto-label:hover {
  background: #00cccc;
  color: #fff;
}

.perfil-foto-input {
  display: none;
}

.perfil-foto {
  width: 100%;
  height: 100%;
  object-fit: cover;        /* Rellenar contenedor sin deformar */
  border-radius: 50%;       /* Siempre circular */
  display: block;
}

.perfil-foto-placeholder {
  font-size: 48px;
  color: #00cccc;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;       /* Circular también para placeholder */
  background: #e0ffff;
}


/* Centrar sección de resultados */
#results {
  text-align: center; /* centra los textos y botones */
  margin-top: 20px;
}

/* Centrar el encabezado de resultados */
#results .section-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px; /* separa el título y el botón */
}

/* Centrar el texto de info */
#resultsInfo {
  text-align: center;
  margin: 10px 0;
  font-style: italic;
}

/* Centrar el grid de productos */
#resultsGrid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* centra las tarjetas en fila */
  gap: 20px; /* espacio entre productos */
}
 /* Badge de descuento en una esquina */
    .promo-card {
      position: relative;
      display: inline-block;
    }
    .promo-badge {
      position: absolute;
      top: 10px;
      right: -5px;
      background: #e53935;
      color: #fff;
      padding: 5px 10px;
      font-size: 0.8rem;
      font-weight: bold;
      border-radius: 5px;
      box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    }
    .promo-precio {
      color: #2e7d32;
      font-weight: bold;
    }
    .promo-precio-tachado {
      text-decoration: line-through;
      color: #888;
      font-size: 0.9em;
      margin-right: 8px;
    }

/* Carrito flotante overlay */
.cart-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
}

.cart-overlay.active {
  display: flex;
}

/* Contenedor del carrito */
.cart-container {
  position: fixed;
  top: 50px; /* Ajusta según tu nav */
  right: 20px;
  width: 300px;
  max-height: 80%;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  overflow-y: auto;
  padding: 15px;
  z-index: 1001;
  color: #525252;
}

/* Título y cierre */
.cart-title {
  margin: 0 0 10px 0;
  font-size: 18px;
}

.cart-close {
  position: absolute;
  top: 5px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
}

/* Items del carrito */
.cart-item {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  border-bottom: 1px solid #424242;
  padding: 5px 0;
  font-size: 14px;
}

.cart-item span:first-child {
  max-width: 150px; /* Limita ancho del nombre del producto */
  overflow: hidden;
  overflow: hidden;
  text-overflow: ellipsis;
  word-wrap: break-word;
  margin-right: 10px; /* Espacio entre nombre y cantidad */
}

.cart-item span:nth-child(2), /* cantidad */
.cart-item span:nth-child(3)  /* precio */ {
  flex-shrink: 0;      /* Evita que se achiquen */
  width: 50px;
  text-align: right;
}

.cart-item .delete-btn {
    display: inline-flex;           /* Necesario para centrar el contenido */
    align-items: center;
    justify-content: center;
    width: 20px;                    /* Ajusta el tamaño del círculo */
    height: 20px;
    background-color: #30a080;
    color: white;
    border-radius: 50%;             /* Hace el círculo */
    text-decoration: none;
    font-size: 16px;
    line-height: 1;                 /* Para que el emoji quede centrado verticalmente */
    cursor: pointer;
    transition: background 0.2s;
    margin-left: 5px;               /* Un pequeño espacio con respecto al precio */
}

.cart-item .delete-btn:hover {
    background-color: #cc0000;
}



.cart-item span:nth-child(2),
.cart-item span:nth-child(3) {
  width: 50px;
  text-align: right;
}

/* Botones dentro del carrito */
.cart-btn {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: #50BBB5;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.cart-btn:hover {
  background: #30726f;
}

.cart-icon {
  position: relative;  /* importante para que .cart-count se posicione encima */
  display: inline-block;
  cursor: pointer;
  font-size: 28px;
  margin-right: 10px;
}

/* Contador de productos sobre el carrito */
.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #30726f;
  color: white;
  font-size: 12px;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  font-weight: bold;
}

.btn-agregar {
  width: 85%;
  height: 30px;
  margin-top: 10px;
  padding: 8px;
  background: #3c8a86;
  color: #ffffff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.btn-agregar:hover {
  background: #1f4744;
}

  .cart-item {
    display: grid;
    grid-template-columns: 2fr auto 1fr 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
  }

  .edit-btn {
    width: 20px;
    height: 20px;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    border: 1px solid #555;
    background-color: #fff;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    padding: 0;
  }

  .edit-btn:hover {
    background-color: #f0f0f0;
    transform: scale(1.1);
  }

  .cart-subtotal {
    margin-top: 10px;
    font-weight: bold;
    text-align: right;
  }

  .cart-total {
    margin-top: 5px;
    font-weight: bold;
    text-align: right;
  }
.footer {
  width: 100%;
  background-color: #007069;
  color: #ffffff;
  padding: 40px 0 20px;
  font-family: 'Segoe UI', sans-serif;
}

