/* ========================================
   VIVERS MEDITERRANI - ESTILS CSS
   ======================================== */

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

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(to bottom, #fafaf9 0%, #f5f5f4 100%);
  color: #1f2937;
  line-height: 1.6;
}

/* ========================================
   CATEGORY COLOR VARIABLES
   ======================================== */
:root {
  /* Articles - Blue (existing) */
  --cat-articles-gradient: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  --cat-articles-muted: linear-gradient(135deg, rgba(30, 58, 138, 0.5) 0%, rgba(37, 99, 235, 0.5) 100%);
  --cat-articles-solid: #2563eb;

  /* Falgueres - Green */
  --cat-falgueres-gradient: linear-gradient(135deg, #047857 0%, #10b981 100%);
  --cat-falgueres-muted: linear-gradient(135deg, rgba(4, 120, 87, 0.5) 0%, rgba(16, 185, 129, 0.5) 100%);
  --cat-falgueres-solid: #10b981;

  /* Gramínies - Red */
  --cat-graminies-gradient: linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
  --cat-graminies-muted: linear-gradient(135deg, rgba(153, 27, 27, 0.5) 0%, rgba(220, 38, 38, 0.5) 100%);
  --cat-graminies-solid: #dc2626;
}

/* ========================================
   ONBOARDING MODAL
   ======================================== */
.onboarding-modal-panel {
  max-width: 520px;
  text-align: center;
  padding: 32px 28px;
}

.onboarding-lang-selector {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.onboarding-lang-selector .lang-flag {
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
  opacity: 0.6;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.onboarding-lang-selector .lang-flag:hover {
  transform: scale(1.1);
  opacity: 0.85;
}

.onboarding-lang-selector .lang-flag.active {
  opacity: 1;
  box-shadow: 0 0 0 3px #2d5f3e, 0 2px 8px rgba(0, 0, 0, 0.2);
  transform: scale(1.08);
}

.onboarding-title {
  font-size: 22px;
  margin-bottom: 20px;
}

.onboarding-content {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.7;
  margin-bottom: 26px;
}

.onboarding-content p {
  margin-bottom: 14px;
}

.onboarding-content p:last-child {
  margin-bottom: 0;
}

.onboarding-continue {
  padding: 14px 32px;
  font-size: 15px;
}

.container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 40px;
}

/* ========================================
   HEADER
   ======================================== */
header {
  position: sticky;
  top: 12px;
  z-index: 300;
  margin-top: 20px;
  margin-bottom: 28px;
  background: white;
  border-radius: 26px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
  padding: 18px 20px;
}

.header-content {
  padding: 12px 20px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 12px;
}

/* LOGO & HEADER INFO */
.logo-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  margin-left: 20px;
  /* Desktop: Move slightly right */
}

.logo-desktop {
  height: 64px;
  /* Desktop: Increased size */
  width: auto;
  display: block;
  margin-bottom: 2px;
}

.logo-mobile {
  display: none;
}

#headerWeekInfo {
  font-size: 15px;
  /* Desktop: Increased text size */
  color: #6b7280;
  margin-top: 4px;
  font-weight: 500;
}

@media (max-width: 768px) {
  .logo-desktop {
    display: none;
  }

  .logo-mobile {
    display: block;
    height: 28px;
    /* Mobile: Reduced size */
    width: auto;
    margin-bottom: 2px;
  }

  .header-top {
    justify-content: center;
    flex: 1;
    margin-bottom: 0;
  }

  .logo-section {
    align-items: center;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    transform: translateX(-12px);
    /* Mobile: Shift slightly right (less negative offset) */
  }

  /* Reset margin on week info for mobile consistency */
  #headerWeekInfo {
    margin-top: 2px;
    font-size: 13px;
    /* keep mobile text standard */
  }
}

/* INFO BOXES */
.info-boxes {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.info-box {
  min-width: 230px;
  padding: 12px 14px;
  border-radius: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .06);
}

.info-box.entradas {
  background: linear-gradient(135deg, #ecfdf5 0, #fff 100%);
  border: 1px solid #a7f3d0;
}

.info-box.sortidas {
  background: linear-gradient(135deg, #eff6ff 0, #fff 100%);
  border: 1px solid #bfdbfe;
}

.info-box h3 {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.info-box.entradas h3 {
  color: #065f46;
}

.info-box.sortidas h3 {
  color: #1e40af;
}

.info-item {
  display: flex;
  align-items: center;
  font-size: 11px;
  margin-bottom: 4px;
  color: #374151;
}

.info-more {
  margin-top: 4px;
  font-size: 11px;
  color: #047857;
  text-align: right;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
}

.info-more:hover {
  text-decoration: underline;
  color: #065f46;
}

.clickable-entry {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.clickable-entry:hover {
  cursor: pointer;
  transition: background-color 0.2s ease;
}



/* DROPDOWN MENU */
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 8px;
  min-width: 260px;
  z-index: 1000;
  display: none;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}

.order-modal-grid.single-col {
  grid-template-columns: 1fr;
  max-width: 500px;
  margin-inline: auto;
}

.dropdown-menu.show {
  display: flex;
}

.dropdown-item {
  padding: 8px 12px;
  font-size: 12px;
  color: #374151;
  border-radius: 8px;
  cursor: pointer;
  transition: .2s;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: #f3f4f6;
  color: #111827;
}

.dropdown-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #6b7280;
  padding: 8px 12px 4px;
  letter-spacing: .05em;
}

/* LANGUAGE SELECTOR */
.lang-selector {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lang-selector.desktop-only {
  margin-right: 0;
  /* Push to the right content */
  margin-left: auto;
  order: 10;
  /* Ensure it is at the very end of toolbar */
}

.lang-selector.mobile-sidebar-lang {
  justify-content: flex-start;
  padding: 4px 0 12px;
}

.lang-flag {
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
  opacity: 0.5;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.lang-flag:hover {
  transform: scale(1.1);
  opacity: 0.8;
}

.lang-flag.active {
  opacity: 1;
  box-shadow: 0 0 0 2px #2d5f3e;
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .lang-selector.desktop-only {
    display: none;
  }
}

/* ========================================
   TOOLBAR
   ======================================== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
  margin-bottom: 4px;
  padding-left: 8px;
  padding-right: 8px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 1000px;
}

.search-box input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  font-size: 13px;
  background: #fff;
  transition: .2s;
  font-family: 'Inter', sans-serif;
}

.search-box input:focus {
  outline: none;
  border-color: #2d5f3e;
  box-shadow: 0 0 0 3px rgba(45, 95, 62, .14);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 14px;
}

/* BOTONS */
.btn {
  padding: 9px 16px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: white;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

.btn span:first-child {
  font-size: 15px;
}

.btn:hover {
  background: #f9fafb;
  border-color: #2d5f3e;
  color: #2d5f3e;
}

.btn-photos {
  border-color: #f4e28a;
  background: linear-gradient(135deg, #fff9cc, #fde68a);
  color: #8a6c22;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(250, 224, 120, .35);
  text-decoration: none;
}

.btn-photos:link,
.btn-photos:visited {
  text-decoration: none;
}

.btn-photos:hover {
  background: linear-gradient(135deg, #fff4b3, #fcd34d);
  border-color: #f4c152;
  color: #7a5a16;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(244, 193, 82, .45);
}

.btn-cat {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #3730a3;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.btn-cat:hover {
  transform: translateY(-1px);
}

/* Category button active states - full gradient */
.btn-cat[data-category="articles"].active {
  background: var(--cat-articles-gradient);
  border-color: #1e3a8a;
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-cat[data-category="falgueres"].active {
  background: var(--cat-falgueres-gradient);
  border-color: #047857;
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-cat[data-category="graminies"].active {
  background: var(--cat-graminies-gradient);
  border-color: #991b1b;
  color: white;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

/* Category button muted states - reduced opacity gradient */
.btn-cat[data-category="articles"]:not(.active) {
  background: var(--cat-articles-muted);
  border-color: rgba(30, 58, 138, 0.3);
  color: rgba(255, 255, 255, 0.9);
}

.btn-cat[data-category="falgueres"]:not(.active) {
  background: var(--cat-falgueres-muted);
  border-color: rgba(4, 120, 87, 0.3);
  color: rgba(255, 255, 255, 0.9);
}

.btn-cat[data-category="graminies"]:not(.active) {
  background: var(--cat-graminies-muted);
  border-color: rgba(153, 27, 27, 0.3);
  color: rgba(255, 255, 255, 0.9);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: #1d4ed8;
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  border-color: #1e40af;
  transform: translateY(-1px);
  color: white;
}

.btn-info {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #4b5563;
  cursor: pointer;
}

.btn-info:hover {
  background: #f3f4f6;
  color: #111827;
}

/* ========================================
   TABLE
   ======================================== */
main {
  padding: 0 48px 40px;
}

.table-container {
  background: white;
  border-radius: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, .05);
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

thead {
  background: linear-gradient(to bottom, #f9fafb 0, #f3f4f6 100%);
  border-bottom: 2px solid #e5e7eb;
}

thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .08em;
}

thead th.text-right {
  text-align: right;
}

thead th.text-center {
  text-align: center;
}

tbody tr {
  border-bottom: 1px solid #f3f4f6;
  transition: .2s ease;
  position: relative;
  border-radius: 12px;
}

tbody tr:not(.category-row):not(.details-row):nth-child(even) {
  background: #fafafa;
}

tbody tr:not(.category-row):not(.details-row):nth-child(odd) {
  background: #fff;
}

tbody tr:not(.category-row):not(.details-row):hover {
  background: #f0fdf4;
  transform: translateX(1px);
  z-index: 1;
}

tbody tr.garden-row {
  background: #bbf7d0 !important;
  cursor: pointer;
}

tbody tr.garden-row:hover {
  background: #86efac !important;
  box-shadow: 0 3px 10px rgba(22, 163, 74, .35);
  transform: translateX(2px);
}

tbody td {
  padding: 1px 12px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
}

/* IMATGES DE PLANTES */
.image-wrapper {
  position: relative;
  width: 48px;
  height: 48px;
}

.plant-image {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
  transition: all .35s ease;
  position: relative;
  z-index: 2;
}

.data-row.expanded .image-wrapper {
  overflow: visible;
}

.data-row.expanded .plant-image {
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 22px;
  border-color: #10b981;
  box-shadow: 0 16px 38px rgba(16, 185, 129, .45);
  transform: translate(10px, 20px);
  z-index: 10;
}

.plant-name {
  font-weight: 600;
  color: #111827;
  font-size: 15px;
}

.data-row td:nth-child(2) {
  padding-left: 32px;
  transition: padding-left .35s ease;
}

.data-row.expanded td:nth-child(2) {
  padding-left: 120px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  background: #16a34a;
  color: white;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-left: 6px;
}

.test-badge {
  display: inline-block;
  padding: 4px 8px;
  background: #f3f4f6;
  color: #374151;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.text-right {
  text-align: right;
}

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

.number {
  font-weight: 500;
  color: #111827;
}

.price {
  font-weight: 600;
  color: #059669;
}

.order-input {
  width: 80px;
  padding: 6px 8px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  transition: .2s;
  cursor: text;
  font-family: 'Inter', sans-serif;
}

.order-input:focus {
  outline: none;
  border-color: #2d5f3e;
  box-shadow: 0 0 0 2px rgba(45, 95, 62, .16);
}

/* CATEGORY ROWS */
tbody tr.category-row {
  border-bottom: none;
}

tbody tr.category-row[data-category="articles"] {
  background: var(--cat-articles-gradient) !important;
}

tbody tr.category-row[data-category="falgueres"] {
  background: var(--cat-falgueres-gradient) !important;
}

tbody tr.category-row[data-category="graminies"] {
  background: var(--cat-graminies-gradient) !important;
}

tbody tr.category-row td {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 800;
  color: white;
  text-transform: uppercase;
  letter-spacing: .12em;
  text-align: left;
  cursor: default;
}

.category-anchor {
  scroll-margin-top: 220px;
}

/* DETAILS ROW */
tbody tr.details-row td {
  background: #ecfdf5;
  padding: 22px 18px 26px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.35s ease;
}

.details-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  align-items: flex-start;
}

.details-photo-spacer {
  min-height: 140px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.detail-card {
  background: white;
  border-radius: 14px;
  border: 1px solid #bbf7d0;
  padding: 10px 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .04);
}

.detail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #047857;
  margin-bottom: 3px;
  font-weight: 600;
}

.detail-value {
  font-size: 13px;
  color: #111827;
  font-weight: 500;
}

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  background: #f9fafb;
  border-top: 2px solid #e5e7eb;
  font-size: 13px;
  color: #6b7280;
}

.table-footer .total {
  font-weight: 600;
  color: #111827;
}

/* ========================================
   MODALS
   ======================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 900;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 901;
}

.modal-panel {
  background: #ffffff;
  border-radius: 20px;
  padding: 20px 24px;
  max-width: 640px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.35);
  position: relative;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #111827;
}

.modal-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.modal-column h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}

.modal-list {
  font-size: 12px;
  color: #374151;
  max-height: 260px;
  overflow: auto;
  list-style: none;
  padding: 0;
}

.modal-close-icon {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #4b5563;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.modal-close-icon:hover {
  background: #f3f4f6;
  color: #111827;
}

.hidden {
  display: none !important;
}

/* ORDER MODAL */
.order-modal-panel {
  max-width: 720px;
  width: 92%;
  padding: 26px 28px 24px;
}

.order-modal-title {
  font-size: 20px;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 4px;
}

.order-modal-subtitle {
  font-size: 13px;
  color: #4b5563;
  margin-top: 6px;
  text-align: center;
}

.order-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 22px;
}

.order-modal-col {
  background: #f9fafb;
  border-radius: 16px;
  padding: 14px 16px 16px;
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.btn-order-main {
  justify-content: center;
  padding-inline: 20px;
  min-width: 0;
}

.order-modal-text {
  margin-top: 10px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
}

.order-summary-wrapper {
  margin-top: 26px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 16px 18px;
  position: relative;
}

.order-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.order-summary-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.order-summary-copy {
  border: 1px solid #1d4ed8;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  color: white;
  font-weight: 600;
  box-shadow: 0 3px 8px rgba(37, 99, 235, .35);
}

.order-summary-copy:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  border-color: #1e40af;
  color: white;
  transform: translateY(-1px);
}

#orderSummaryBox {
  white-space: pre-line;
  font-size: 12px;
  color: #374151;
  max-height: 200px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 10px;
  background: #ffffff;
  font-family: 'Inter', monospace;
}

/* ========================================
   BOMBOLLES FLOTANTS
   ======================================== */
.highlight-bubbles {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 800;
}

.bubble {
  background: #ffffff;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  min-width: 180px;
}

.bubble:hover {
  background: #ecfdf5;
  border-color: #22c55e;
  transform: translateX(-2px);
}

.bubble-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #dcfce7;
  font-size: 16px;
}

.bubble-text {
  display: flex;
  flex-direction: column;
}

.bubble-name {
  font-size: 12px;
  font-weight: 600;
  color: #111827;
}

.bubble-tag {
  font-size: 10px;
  color: #16a34a;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.row-highlight {
  box-shadow: 0 0 0 2px #22c55e inset;
}

/* MAIL BOX */
.mail-box {
  display: inline-block;
  padding: 12px 18px;
  margin-left: 12px;
  border: 2px solid #16a34a;
  border-radius: 8px;
  background-color: #f0fdf4;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: #111827;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}

.mail-box:hover {
  background-color: #dcfce7;
  border-color: #059669;
}

/* ========================================
   MENÚ HAMBURGUESA I SIDEBAR MÒBIL
   ======================================== */
.mobile-menu-btn {
  display: none;
  /* S'activa al media query */
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #059669, #047857);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 22px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(5, 150, 105, .3);
  transition: .2s;
  z-index: 1000;
  line-height: 1;
  padding: 0;
}

.mobile-menu-btn:hover {
  background: linear-gradient(135deg, #047857, #065f46);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(5, 150, 105, .4);
}

.mobile-menu-btn:active {
  transform: scale(0.95);
}

.hamburger-icon {
  display: block;
  line-height: 1;
}

.mobile-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 950;
  transition: opacity .3s ease;
}

.mobile-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: #ffffff;
  box-shadow: 4px 0 24px rgba(0, 0, 0, .2);
  z-index: 951;
  transform: translateX(-100%);
  transition: transform .3s ease;
  overflow-y: auto;
}

.mobile-sidebar:not(.hidden) {
  transform: translateX(0);
}

.mobile-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 18px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: white;
  border-bottom: 1px solid #15803d;
}

.mobile-sidebar-header h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.mobile-sidebar-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .15);
  color: white;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .2s;
}

.mobile-sidebar-close:hover {
  background: rgba(255, 255, 255, .25);
}

.mobile-sidebar-content {
  padding: 12px 14px;
}

.mobile-sidebar-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.mobile-sidebar-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.mobile-sidebar-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 10px;
}

.mobile-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-sidebar-item {
  font-size: 13px;
  color: #374151;
  padding: 8px 12px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.mobile-sidebar-btn {
  width: 100%;
  justify-content: center;
  margin-bottom: 10px;
}

.mobile-sidebar-btn:last-child {
  margin-bottom: 0;
}

.mobile-sidebar-expandable {
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: .2s;
}

.mobile-sidebar-expandable:hover {
  color: #059669;
}

.sidebar-arrow {
  font-size: 12px;
  transition: transform .2s;
}

.mobile-sidebar-collapsible {
  max-height: 500px;
  overflow: hidden;
  transition: max-height .3s ease;
}

.mobile-sidebar-collapsible.collapsed {
  max-height: 0;
}

/* ========================================
   TARGETES DE PRODUCTES MÒBILS
   ======================================== */
.mobile-products-container {
  display: none;
  flex-direction: column;
  gap: 16px;
  padding: 0;
}

.mobile-category-header {
  padding: 12px 16px;
  border-radius: 12px;
  margin-top: 8px;
  position: relative;
  z-index: 10;
}

/* Base styles for category headers */
.mobile-category-header[data-category="articles"] {
  background: var(--cat-articles-gradient);
}

.mobile-category-header[data-category="falgueres"] {
  background: var(--cat-falgueres-gradient);
}

.mobile-category-header[data-category="graminies"] {
  background: var(--cat-graminies-gradient);
}

/* Mobile Category Header - Native Sticky */
.mobile-category-header {
  padding: 10px 16px;
  border-radius: 8px;
  background-size: 200% 200%;
  animation: gradientAnimation 6s ease infinite;
  margin: 12px 0 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;

  /* Sticky behavior */
  position: -webkit-sticky;
  /* Safari */
  position: sticky;
  top: 90px;
  /* Offset for fixed header */
  z-index: 30;
  /* Below header (900) but above content */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Ensure proper specific styles for colors (already defined previously but reinforcing) */
.mobile-category-header[data-category="articles"] {
  background-image: var(--cat-articles-gradient);
}

.mobile-category-header[data-category="falgueres"] {
  background-image: var(--cat-falgueres-gradient);
}

.mobile-category-header[data-category="graminies"] {
  background-image: var(--cat-graminies-gradient);
}

.mobile-category-header h3 {
  color: white;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  margin: 0;
}

/* Remove old substicky classes if any remain */
/* .substicky rules deleted */

.product-card {
  background: white;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  /* Left border for curved accent */
  border-left-width: 6px;
  border-left-style: solid;
  border-left-color: transparent;
  /* Default */
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
  overflow: hidden;
  transition: .2s;
  position: relative;
}

/* Remove old pseudo-element bar */
.product-card::before {
  display: none;
}

.product-card[data-category="articles"] {
  border-left-color: var(--cat-articles-solid);
}

.product-card[data-category="falgueres"] {
  border-left-color: var(--cat-falgueres-solid);
}

.product-card[data-category="graminies"] {
  border-left-color: var(--cat-graminies-solid);
}

.product-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
  transform: translateY(-2px);
}

.product-card.garden-card {
  background: #bbf7d0;
  border-color: #16a34a;
}

.product-card-header {
  display: flex;
  gap: 12px;
  gap: 12px;
  padding: 4px 10px;
  cursor: pointer;
}

.product-card-image {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.product-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.product-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}

.product-card-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 10px;
}

.product-card-order {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.order-icon {
  font-size: 14px;
  line-height: 1;
}

.product-card-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.product-card-name {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  line-height: 1.1;
}

.product-card-badge {
  display: inline-block;
  padding: 2px 5px;
  background: #16a34a;
  color: white;
  border-radius: 999px;
  font-size: 7px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  flex-shrink: 0;
}

.product-card-obs {
  font-size: 13px;
  color: #6b7280;
  font-style: italic;
  margin-top: 2px;
  line-height: 1.3;
}

.product-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.product-card-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.product-card-stock {
  font-size: 13px;
  color: #6b7280;
}

.product-card-stock .number {
  font-weight: 700;
  font-size: 13px;
  color: #111827;
}

.product-card-right {
  display: flex;
  align-items: center;
}

.order-input-compact {
  width: 60px;
  padding: 6px 4px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  transition: .2s;
}

.order-input-compact:focus {
  outline: none;
  border-color: #2d5f3e;
  box-shadow: 0 0 0 2px rgba(45, 95, 62, .16);
}

.product-card-price {
  font-size: 15px;
  font-weight: 700;
  color: #059669;
}

.product-card-expand {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: .2s;
  cursor: pointer;
  align-self: center;
}

.product-card-expand:hover {
  background: #e5e7eb;
  color: #111827;
}

.product-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}

.product-card.expanded .product-card-body {
  max-height: 2000px;
}

.product-card-details {
  padding: 12px;
  background: #f9fafb;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  border-top: 1px solid #e5e7eb;
}

.product-card-details img {
  width: 100%;
  max-width: 300px;
  height: auto !important;
  object-fit: contain;
  border-radius: 8px;
  margin-top: 8px;
}

.product-detail-item {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 10px;
}

.product-detail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6b7280;
  margin-bottom: 2px;
  font-weight: 600;
}

.product-detail-value {
  font-size: 13px;
  color: #111827;
  font-weight: 500;
}

.product-card-footer {
  padding: 12px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.product-card-footer-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.mobile-floating-btn {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(37, 99, 235, .45);
  z-index: 800;
  transition: .2s;
}

.mobile-floating-btn:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(37, 99, 235, .55);
}

.mobile-floating-btn:active {
  transform: scale(0.95);
}

.mobile-footer {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: #f9fafb;
  border-top: 2px solid #e5e7eb;
  border-radius: 0 0 20px 20px;
  font-size: 13px;
  color: #6b7280;
  margin-top: 16px;
}

.mobile-footer .total {
  font-weight: 600;
  color: #111827;
}

/* Estils per modal mòbil */
.order-modal-mobile {
  display: none;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.btn-order-mobile {
  width: 100%;
  justify-content: center;
  padding: 12px 20px;
  font-size: 15px;
}

.btn-whatsapp {
  background: linear-gradient(135deg, #25d366, #1ebe57);
  border-color: #1ebe57;
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 211, 102, .35);
}

.btn-whatsapp:hover {
  background: linear-gradient(135deg, #1ebe57, #128c47);
  border-color: #128c47;
  transform: translateY(-1px);
  color: white;
}

.order-modal-desktop {
  display: grid;
}

.order-summary-desktop {
  display: block;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width:1024px) {
  header {
    margin: 16px 16px 12px;
  }

  main {
    padding: 0 16px 24px;
  }

  .header-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .info-boxes {
    justify-content: flex-start;
  }

  .highlight-bubbles {
    display: none;
  }

  .modal-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width:900px) {
  .details-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .details-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width:640px) {

  /* Header mòbil - RESTAURAT I MILLORAT */
  .mobile-menu-btn {
    display: flex;
    width: 32px;
    height: 32px;
    left: 0;
    font-size: 18px;
    border-radius: 8px;
    position: relative;
    transform: none;
    top: auto;
    margin-right: 8px;
    flex-shrink: 0;
    order: -1;
    /* Ensure it is first */
  }

  .header-content {
    padding: 2px 12px;
    /* Reduced vertical padding */
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }

  .container {
    padding: 0 12px;
  }

  header {
    margin: 10px 0 12px;
    border-radius: 20px;
    padding: 16px 12px 8px;
  }

  .header-top {
    padding-left: 0;
    display: flex;
    align-items: center;
    width: auto;
    /* Allow it to share space with hamburger */
    flex: 1;
  }

  .logo {
    width: 32px;
    height: 32px;
    font-size: 16px;
    border-radius: 10px;
  }

  .company-info h1 {
    font-size: 15px;
    /* Unificat */
  }

  .company-info p {
    font-size: 12px;
    /* Unificat */
  }

  .info-boxes {
    display: none;
  }

  /* Toolbar mòbil */
  .toolbar {
    padding: 0;
    margin-top: 6px;
    gap: 8px;
    margin-bottom: 4px;
    width: 100%;
    order: 3;
  }

  .toolbar .btn-cat {
    display: none;
  }

  .toolbar .btn-primary {
    display: none;
  }

  .toolbar .btn-photos {
    display: none;
  }

  .search-box {
    max-width: 100%;
  }

  /* Evitar zoom en inputs mòbil - REFORÇAT */
  input,
  select,
  textarea {
    font-size: 13px !important;
    /* Match plant name size */
  }

  .search-box input {
    padding: 6px 10px 6px 32px;
    font-size: 13px !important;
    /* Match plant name size */
  }

  .search-icon {
    left: 10px;
    font-size: 12px;
  }

  /* Ocultar taula desktop */
  main {
    padding: 0 0 80px;
    /* Més espai al final pel botó flotant */
  }

  .table-container {
    display: none;
  }

  /* Ensure ancestors don't block sticky */
  main,
  .container,
  .table-container {
    overflow: visible !important;
  }

  /* Mostrar targetes mòbils - MÉS COMPACTE */
  .mobile-products-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Reduced gap per request "molt minusculament separades" */
    overflow: visible;
    /* Ensure sticky works */
  }

  .mobile-category-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Internal gap for cards */
    position: relative;
    /* Context for sticky */
    overflow: visible;
    /* CRITICAL for sticky */
  }

  /* Fixed Active Category Header (JS driven fallback) */
  .active-category-sticky {
    position: fixed;
    top: 85px;
    /* Adjust based on header height */
    left: 12px;
    right: 12px;
    z-index: 200;
    padding: 6px 12px;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .12em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: opacity 0.2s, background 0.3s;
    background-size: 200% 200%;
    animation: gradientAnimation 6s ease infinite;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .active-category-sticky.hidden {
    display: none !important;
  }

  .active-category-sticky[data-category="articles"] {
    background-image: var(--cat-articles-gradient);
  }

  .active-category-sticky[data-category="falgueres"] {
    background-image: var(--cat-falgueres-gradient);
  }

  .active-category-sticky[data-category="graminies"] {
    background-image: var(--cat-graminies-gradient);
  }

  /* Mobile Category Header - Static (Native Sticky Disabled) */
  .mobile-category-header {
    padding: 6px 12px;
    /* Thinner as requested */
    border-radius: 8px;
    background-size: 200% 200%;
    animation: gradientAnimation 6s ease infinite;
    margin: 4px 0 4px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;

    /* Revert sticky behavior */
    position: relative;
    top: auto;
    z-index: 10;
  }

  .mobile-category-header h3 {
    font-size: 13px;
    letter-spacing: .08em;
  }

  /* Targetes Mòbil - Estil Unificat */
  .product-card {
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
    /* Lighter shadow */
    overflow: hidden;
    background: white;
  }

  .product-card:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, .08);
    transform: translateY(-1px);
  }

  .product-card-header {
    padding: 4px 8px;
    /* Tighter padding for thinner card */
    display: flex;
    flex-direction: row;
    gap: 8px;
    cursor: pointer;
    align-items: center;
    min-height: 50px;
    /* Reduced min-height */
  }

  .product-card-info {
    display: flex;
    flex-direction: column;
    gap: 0px;
    /* Removed gap */
    justify-content: center;
    flex: 1;
  }

  .product-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
  }

  .product-card-name-row {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .product-card-name {
    font-size: 12px;
    font-weight: 600;
    color: #111827;
    line-height: 1.1;
  }

  .product-card-badge {
    align-self: flex-start;
    padding: 1px 5px;
    font-size: 9px;
    border-radius: 4px;
    margin-top: 1px;
  }

  .product-card-order {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
  }

  .order-icon {
    display: none;
  }

  .order-input-compact {
    width: 50px;
    /* Slightly narrower */
    padding: 4px;
    font-size: 16px !important;
    border-radius: 6px;
    height: 32px;
    /* Fixed height */
    text-align: center;
    border: 1px solid #d1d5db;
  }

  .product-card-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    /* Unificat */
    color: #4b5563;
    margin-top: 1px;
    /* Minimal separation */
    line-height: 1;
  }

  .product-card-stock {
    font-size: 10px;
  }

  .product-card-stock .number {
    font-weight: 600;
    color: #111827;
  }

  .product-card-price {
    font-size: 12px;
    font-weight: 600;
    color: #059669;
  }

  .product-card-middle {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
  }

  .product-card-obs-inline {
    font-size: 9px;
    color: #6b7280;
    font-style: italic;
    text-align: center;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .product-card-left {
    gap: 1px;
  }

  .product-card-stock {
    font-size: 10px;
  }

  .product-card-price {
    font-size: 10px;
    /* Matched to stock font size */
  }

  .order-input-compact {
    width: 60px;
    padding: 8px 4px;
    font-size: 16px !important;
    border-radius: 8px;
  }

  .product-card-image-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
  }

  .product-card-image-large {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 12px;
    display: block;
    grid-column: 1 / -1;
  }

  .product-card-details {
    padding: 12px;
    /* Restored padding for proper spacing */
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .product-card-details img {
    border-radius: 8px;
    margin-top: 0;
    max-width: 100%;
    height: auto;
  }

  .product-detail-item {
    margin: 0;
    /* Reset margins - using gap instead */
  }

  .product-detail-item:last-child {
    margin-bottom: 0;
  }

  .mobile-footer {
    display: flex;
    padding: 10px 12px;
    font-size: 12px;
  }

  .mobile-floating-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    padding: 0 24px;
    height: 56px;
    font-size: 16px;
    font-weight: 600;
    bottom: 40px;
    /* Lowered per request */
    right: 24px;
    border-radius: 999px;
    gap: 8px;
    z-index: 100;
    /* Ensure above bottom stickies */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  }

  /* Substicky Bottom Container */
  #mobileStickyBottomContainer {
    position: fixed;
    bottom: 0;
    left: 16px;
    right: 16px;
    z-index: 50;
    display: flex;
    flex-direction: column-reverse;
    /* Stack upwards */
    gap: 4px;
    /* Stack tightly */
    pointer-events: none;
    padding-bottom: 10px;
    /* Space from bottom edge */
  }

  /* Substicky bottom items */
  .mobile-category-header.substicky-bottom {
    position: relative;
    pointer-events: auto;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    /* Shadow upwards */
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0.95;
    padding: 10px 16px;
    margin: 0;
    border-radius: 12px 12px 0 0;
    /* Rounded top only? Or full? Keep consistent */
    border-radius: 12px;
  }

  .mobile-category-header.substicky-bottom h3 {
    font-size: 12px;
  }

  /* Colors for bottom stickies */
  .mobile-category-header.substicky-bottom[data-category="articles"] {
    background: var(--cat-articles-muted);
    backdrop-filter: blur(4px);
  }

  .mobile-category-header.substicky-bottom[data-category="falgueres"] {
    background: var(--cat-falgueres-muted);
    backdrop-filter: blur(4px);
  }

  .mobile-category-header.substicky-bottom[data-category="graminies"] {
    background: var(--cat-graminies-muted);
    backdrop-filter: blur(4px);
  }

  /* Modal mòbil */
  .order-modal-desktop {
    display: none !important;
  }

  .order-summary-desktop {
    display: none !important;
  }

  .order-modal-mobile {
    display: flex;
  }

  /* Modals - MÉS COMPACTE */
  .details-layout {
    grid-template-columns: 1fr;
  }

  .details-photo-spacer {
    display: none;
  }

  .details-grid {
    grid-template-columns: 1fr;
  }

  .order-modal-grid {
    grid-template-columns: 1fr;
  }

  .modal-panel {
    width: 95%;
    padding: 16px 18px;
  }

  .modal-title {
    font-size: 16px;
  }

  .order-modal-subtitle {
    font-size: 12px;
  }
}