/* ==========================================================================
   1. VARIABLES I ESTIL BASE
   ========================================================================== */

:root {
  --cosco-primary: #D28238;        /* Taronja/Sorra principal */
  --cosco-primary-hover: #b86e2b;  /* Taronja més fosc */
  --cosco-bg-light: #F4F1EA;       /* Fons beix suau */
  --cosco-card-bg: #F8F8F8;        /* Fons gris clar */
  --cosco-text: #222222;           /* Text principal */
}

html {
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

body {
  color: var(--cosco-text);
  font-family: 'Montserrat', sans-serif;
  background-color: #ffffff;
}

/* ==========================================================================
   2. CONTENIDORS DE CONTINGUT (SLIDER I COS A 1366px)
   ========================================================================== */

/* Només apliquem el màxim de 1366px al cos i peu de pàgina, NO al header */
@media (min-width: 1200px) {
  #wrapper .container,
  #footer .container {
    max-width: 1366px !important;
    width: 1366px !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

/* ==========================================================================
   3. CAPÇALERA / HEADER (FULLWIDTH REAL DE PUNTA A PUNTA)
   ========================================================================== */

#header {
  width: 100% !important;
  max-width: 100% !important;
  background: #ffffff;
  border-bottom: 1px solid #eaeaea;
}

/* Alliberem la restricció del container només dins del header */
#header .container {
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 40px !important;  /* Marge elegant respecte a les vores de pantalla */
  padding-right: 40px !important;
}

.header-nav {
  min-height: 80px;
  display: flex;
  align-items: center;
}

@media (max-width: 768px) {
  #header .container {
    padding-left: 15px !important;
    padding-right: 15px !important;
  }
}

@media (min-width: 768px) {
  .header-top .row:first-child {
    display: none !important;
  }

  .header-top {
    display: block !important;
    position: relative;
    z-index: 20;
    height: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    background: transparent !important;
  }

  .header-top:has(#mobile_top_menu_wrapper.cosco-menu-open) {
    height: auto !important;
    overflow: visible;
  }

  .header-top .container {
    padding: 0 !important;
  }

  #mobile_top_menu_wrapper.cosco-menu-open {
    display: block !important;
    background: #fff;
    border-top: 1px solid #eee;
  }

  /* Distribució en 3 columnes: MENÚ (Esq) | LOGO (Centre) | ICONES (Dreta) */
  .header-nav .container > .row {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: 1fr;
    align-items: center;
    margin: 0 !important;
  }

  .header-nav .container > .row > * {
    grid-row: 1;
  }

  /* --- 3.1 MENÚ HAMBURGUESA (ESQUERRA) --- */
  .header-nav .hidden-md-up.mobile {
    display: block !important;
    grid-column: 1;
    justify-self: start;
    width: max-content;
  }

  #menu-icon {
    cursor: pointer;
    display: flex !important;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    line-height: 1 !important;
  }

  #menu-icon .material-icons {
    font-size: 22px;
    line-height: 1 !important;
    display: flex;
    align-items: center;
  }

  #menu-icon::after {
    content: "MENÚ";
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--cosco-text);
    line-height: 1 !important;
    display: flex;
    align-items: center;
  }

  /* --- 3.2 LOGO (CENTRE) --- */
  .header-nav .container > .row > .top-logo {
    grid-column: 2;
    justify-self: center;
    display: flex !important;
    align-items: center;
  }

  .header-nav .top-logo img {
    max-height: 42px;
    height: auto;
    width: auto !important;
  }

  /* --- 3.3 ICONES DRETA (CERCADOR, USUARI, CISTELLA) --- */
  .header-nav .hidden-sm-down {
    display: flex !important;
    grid-column: 3;
    justify-self: end;
    align-items: center;
  }

  .header-nav .hidden-sm-down .col-md-5 {
    display: none !important;
  }

  .header-nav .hidden-sm-down .right-nav {
    display: flex !important;
    gap: 22px !important; /* Espaiat uniforme entre icones */
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Neteja de la caixa grisa de la cistella i dels fons */
  .header-nav .hidden-sm-down .right-nav span.hidden-sm-down,
  .header-nav .hidden-sm-down .right-nav .cart-products-count {
    display: none !important;
  }

  .header-nav .hidden-sm-down .right-nav a,
  .header-nav .hidden-sm-down .right-nav .blockcart,
  .header-nav .hidden-sm-down .right-nav .blockcart .header {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  .header-nav .hidden-sm-down .right-nav .material-icons,
  .header-nav .hidden-sm-down .right-nav i {
    font-size: 24px !important;
    color: var(--cosco-text) !important;
    line-height: 1 !important;
  }

  /* Adaptació del cercador natiu (ps_searchbar) a icona */
  #search_widget {
    margin: 0 !important;
    padding: 0 !important;
  }

  #search_widget form {
    display: flex;
    align-items: center;
  }

  #search_widget input[type="text"] {
    display: none; /* Amaguem l'input gran per defecte */
  }

  #search_widget button[type="submit"] {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  #search_widget button[type="submit"] .material-icons {
    font-size: 24px !important;
    color: var(--cosco-text) !important;
  }
}

/* ==========================================================================
   4. SLIDER / HERO BANNER
   ========================================================================== */

#carousel {
  border-radius: 12px;
  overflow: hidden;
  margin-top: 20px;
  margin-bottom: 40px;
}

#carousel .carousel-inner,
#carousel .carousel-item img {
  width: 100%;
  height: auto;
  border-radius: 12px;
}

/* ==========================================================================
   5. BOTONS I SECCIONS DE PRODUCTES
   ========================================================================== */

.btn-primary, 
.btn-touchspin {
  background-color: var(--cosco-primary) !important;
  border-color: var(--cosco-primary) !important;
  border-radius: 20px;
  text-transform: uppercase;
  font-weight: 600;
}

.btn-primary:hover {
  background-color: var(--cosco-primary-hover) !important;
  border-color: var(--cosco-primary-hover) !important;
}

/* Graella de productes */
.product-miniature .thumbnail-container {
  background-color: var(--cosco-card-bg);
  border: none;
  border-radius: 12px;
  padding: 15px;
  transition: all 0.3s ease;
}

.product-miniature .thumbnail-container:hover {
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

.product-description {
  text-align: center;
}

.product-title a {
  color: var(--cosco-text);
  font-weight: 500;
  font-size: 0.95rem;
}

.product-price-and-shipping {
  text-align: center;
  font-weight: 700;
  color: var(--cosco-text);
}

/* Pestanyes (Tabs) */
.page-home > .featured-products {
  display: none !important;
}

.cosco-tabs {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0;
  margin: 20px 0 35px;
}

.cosco-tab {
  cursor: pointer;
  padding: 8px 22px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--cosco-text);
  background: var(--cosco-bg-light);
  transition: all 0.2s ease;
}

.cosco-tab:hover {
  background: #ece7db;
}

.cosco-tab.active {
  background: var(--cosco-primary);
  color: #fff;
}

.cosco-tab-panel {
  display: none;
}

.cosco-tab-panel.active {
  display: block;
}

/* ==========================================================================
   6. SECCIÓ INSPIRACIÓN LOCAL I NEWSLETTER
   ========================================================================== */

.cosco-inspiration {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  background-color: var(--cosco-bg-light);
  border-radius: 16px;
  overflow: hidden;
  margin: 50px 0;
}

.cosco-inspiration__media {
  flex: 1 1 400px;
  min-height: 300px;
}

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

.cosco-inspiration__content {
  flex: 1 1 400px;
  padding: 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.block_newsletter {
  background-color: var(--cosco-primary) !important;
  border-radius: 16px;
  padding: 35px !important;
}

/* ==========================================================================
   7. MARQUES I FOOTER
   ========================================================================== */

.cosco-brands {
  margin: 50px 0;
  text-align: center;
}

.cosco-brands__row img {
  max-height: 42px;
  max-width: 120px;
  width: auto;
  object-fit: contain;
  filter: grayscale(100%);
  opacity: 0.65;
  transition: all 0.2s ease;
}

.cosco-brands__row img:hover {
  filter: none;
  opacity: 1;
}

#footer {
  background-color: var(--cosco-bg-light);
  padding-top: 40px;
}