/* ===============================
   HERBOLIVE - Estilos principales
   =============================== */

/* Paleta:
   Verde oscuro: #2e7d32
   Verde medio: #66bb6a
   Verde claro: #c8e6c9
   Blanco cálido: #f9fbe7
*/

/* Fondo general */
body {
  background-color: #f9fbe7;
  font-family: 'Roboto', sans-serif;
  color: #2e7d32;
}

/* Navbar */
nav {
  z-index: 9999;
  position: fixed;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
nav .brand-logo {
  font-weight: 500;
  font-size: 1.5rem;
}

/* Tabs */
.tabs .tab a {
  color: #2e7d32;
  font-weight: 500;
}
.tabs .tab a.active {
  background-color: #c8e6c9;
  color: #2e7d32;
  border-radius: 5px 5px 0 0;
}
.tabs .indicator {
  background-color: #2e7d32;
}

/* Cards generales */
.card {
  border-radius: 12px;
  overflow: hidden;
}
.card .card-image img {
  border-bottom: 4px solid #66bb6a;
}
.card .card-content {
  color: #2e7d32;
}

/* Botones */
.btn,
.btn-flat {
  border-radius: 8px;
}
.btn:hover {
  background-color: #388e3c !important;
}

/* Campo de búsqueda */
#search-input {
  border-bottom: 2px solid #2e7d32 !important;
}
#search-input:focus {
  border-bottom: 2px solid #66bb6a !important;
  box-shadow: 0 1px 0 0 #66bb6a !important;
}
#search-btn {
  margin-top: 10px;
}

/* Contenedor de resultados */
#search-results,
#plants-container,
#search-results-container {
  margin-top: 20px;
}

/* Plantas (cards en 2 columnas) */
.plant-card {
  transition: all 0.3s ease;
  cursor: pointer;
}
.plant-card:hover {
  transform: scale(1.03);
}

/* Imagen dentro de card */
.plant-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 12px 12px 0 0;
}

/* Ajuste de columnas */
@media (min-width: 600px) {
  .plant-card-wrapper {
    width: 50%; /* 2 columnas */
    float: left;
  }
}

@media (max-width: 599px) {
  .plant-card-wrapper {
    width: 50%; /* Mantener 2 columnas también en móvil */
    float: left;
  }
}

/* Paginación (generales) */
#prev-page, #next-page, #prev-page-all, #next-page-all, #prev-page-search, #next-page-search {
  font-weight: 600;
}
#prev-page i, #next-page i {
  vertical-align: middle;
}

/* Texto del botón traducido */
#translation-note {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.9rem;
  color: #757575;
}

/* Modal de detalles de planta */
.modal {
  border-radius: 12px;
}
.modal-content h4 {
  color: #2e7d32;
}
.modal-content p {
  line-height: 1.6;
}
.modal-footer .btn-flat {
  color: #2e7d32;
}

/* Nota: regla global que existía y puede afectar botones de paginación */
.btn-flat{
  width: 28%;
}

/* ============================
   Tabs fijas (fixed tabs) - comportamiento responsivo
   ============================ */

/* El top lo fijamos por JS (para que se ajuste a la altura real del nav) */
#tabs-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.98);
  z-index: 999;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Mantener el ancho centrado como el .container */
#tabs-wrapper .container {
  padding-left: 12px;
  padding-right: 12px;
}

/* Empuja el contenido hacia abajo para no quedar tapado por las tabs fijas.
   El valor real se establece por JS en la variable CSS --top-offset */
.main-with-fixed-tabs {
  padding-top: var(--top-offset, 120px);
}

/* Opcional - estilo de las tabs cuando fijadas */
.tabs .tab a { color: #2e7d32; }
.tabs .tab a.active { color: #1b5e20; }

/* ============================
   PAGINACIÓN: clase semántica .pagination-fullwidth
   ============================ */

/* Usaremos esta clase (añadida por JS) para controlar totalmente el layout
   evitando conflictos con estilos globales (.btn-flat { width: 28% }) y
   evitando depender de inline styles que el JS pueda establecer. */

.pagination-fullwidth {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px;
  width: 100% !important;
  box-sizing: border-box;
  padding: 10px 8px !important;
  margin: 12px 0 !important;
  background: rgba(255,255,255,0.95);
  flex-wrap: nowrap;            /* mantener en una fila */
  overflow-x: auto;            /* si hay muchas páginas, permitir scroll horizontal */
  -webkit-overflow-scrolling: touch;
}

/* Anula la anchura global de .btn-flat solo dentro de paginación */
.pagination-fullwidth .btn-flat {
  width: auto !important;
  flex: 1 1 0 !important;      /* que se expandan proporcionalmente */
  min-width: 48px !important;  /* evitar que queden diminutos */
  margin: 0 6px !important;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  text-align: center;
  font-size: 1.05rem;
  box-sizing: border-box;
}

/* El span con la etiqueta de página también se comporta como un elemento flexible */
.pagination-fullwidth > span {
  flex: 1 1 0;
  text-align: center;
  min-width: 48px;
  margin: 0 6px;
  font-size: 1.02rem;
}

/* Botón activo más visible (mantiene colores Materialize) */
.pagination-fullwidth .green.darken-2.white-text {
  font-weight: 600;
  border-radius: 10px;
}

/* Íconos no desalinean */
.pagination-fullwidth i {
  vertical-align: middle;
  display: inline-block;
}

/* Scrollbar pequeño */
.pagination-fullwidth::-webkit-scrollbar { height: 6px; }

/* Responsivo: ajustar tamaños si falta espacio */
@media (max-width: 420px) {
  .pagination-fullwidth .btn-flat,
  .pagination-fullwidth > span {
    font-size: 0.95rem;
    padding-top: 6px;
    padding-bottom: 6px;
    min-width: 44px;
  }
}

/* ============================
   Reglas forzadas por id (funcionan aunque existan inline styles)
   ============================ */

/* === FORZAR paginación a ancho completo (funciona aunque exista inline style) === */
#pagination-all,
#pagination-search {
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 10px 8px !important;
  margin: 12px 0 !important;
  background: rgba(255,255,255,0.95) !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

/* Anular regla global .btn-flat { width: 28% } dentro de las paginaciones */
#pagination-all .btn-flat,
#pagination-search .btn-flat {
  width: auto !important;
  flex: 1 1 0 !important;
  min-width: 48px !important;
  margin: 0 6px !important;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  text-align: center !important;
  font-size: 1.05rem !important;
  box-sizing: border-box !important;
}

/* El span de la página se comporta similarmente */
#pagination-all > span,
#pagination-search > span {
  flex: 1 1 0 !important;
  text-align: center !important;
  min-width: 48px !important;
  margin: 0 6px !important;
  font-size: 1.02rem !important;
}

/* Botón activo */
#pagination-all .green.darken-2.white-text,
#pagination-search .green.darken-2.white-text {
  font-weight: 600 !important;
  border-radius: 10px !important;
}

/* Ajustes en móvil */
@media (max-width: 420px) {
  #pagination-all .btn-flat,
  #pagination-search .btn-flat,
  #pagination-all > span,
  #pagination-search > span {
    font-size: 0.95rem !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
    min-width: 44px !important;
  }
}

/* ============================
   Ocultar spans de "Página X" (opción A: mantener DOM pero no mostrar)
   ============================ */
#current-page-all,
#current-page-search {
  display: none !important;
}

/* ============================
   Clase para ocultar totalmente paginaciones vacías
   ============================ */

.hidden-pagination {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
  overflow: hidden !important;
}

/* Si el contenedor se queda vacío, no mostrar nada */
#pagination-all:empty,
#pagination-search:empty {
  display: none !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
}

