/* ===== BuyOnBoard - STIL COMPLET ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: #f4f6f8;
  color: #222;
  padding-bottom: 80px;
  min-height: 100vh;
}

/* ===== HEADER - FIX SUS ===== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: #0F3D91;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
}

.top-buttons {
  display: flex;
  gap: 8px;
}

.top-buttons button {
  background: white;
  color: #0F3D91;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.top-buttons button:hover {
  transform: scale(1.05);
}

/* ===== SEARCH - FIX SUB HEADER ===== */
.search {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 998;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid #e8e8e8;
  box-shadow: 0 2px 4px rgba(0,0,0,.04);
}

#searchInput {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #d8d8d8;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

#searchInput:focus {
  border-color: #0F3D91;
}

/* ===== PRODUCTS - GRID ===== */
#products {
  padding: 8px;
  margin-top: 120px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

#products.grid-view {
  display: grid;
}

#products.list-view {
  display: block;
}

/* ===== PRODUCT CARD ===== */
.product-card {
  background: white;
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
  position: relative;
  transition: all 0.2s;
  cursor: pointer;
}

.product-card:active {
  transform: scale(0.97);
}

.product-image {
  position: relative;
  width: 100%;
  padding-top: 85%;
  background: #f8f9fa;
  border-radius: 10px;
  overflow: hidden;
}

.product-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.product-image .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #0F3D91;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.product-name {
  font-size: 13px;
  font-weight: 700;
  margin: 6px 0 2px;
  line-height: 1.2;
  min-height: 32px;
}

.product-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.product-code {
  color: #8b8b8b;
  font-size: 11px;
  font-weight: 500;
}

.product-price {
  font-weight: 700;
  color: #0F3D91;
  font-size: 14px;
}

.product-actions,
.list-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid #f0f0f0;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #f0f0f0;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
}

.qty-btn:active {
  transform: scale(0.9);
}

.qty-btn.plus {
  background: #0F3D91;
  color: white;
}

.qty-btn.minus {
  background: #e8e8e8;
  color: #555;
}

.qty-count {
  font-size: 16px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

/* ===== PRODUCT LIST ===== */
.product-list-item {
  background: white;
  padding: 12px 16px;
  margin-bottom: 6px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  cursor: pointer;
}

.product-list-item:active {
  transform: scale(0.98);
}

.list-name {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
}

.list-code {
  color: #8b8b8b;
  font-size: 13px;
  min-width: 40px;
}

.list-price {
  font-weight: 700;
  color: #0F3D91;
  min-width: 60px;
  text-align: right;
}

.list-actions {
  border: none;
  padding: 0;
  gap: 8px;
}

/* ===== CART ===== */
#cart {
  display: none;
  padding: 12px 16px 20px;
  margin-top: 120px;
}

.cart-header {
  display: grid;
  grid-template-columns: 3fr 1fr 1fr 1.5fr;
  gap: 8px;
  padding: 8px 4px 12px;
  border-bottom: 2px solid #e8e8e8;
  font-weight: 700;
  color: #555;
  font-size: 14px;
}

.cart-row {
  display: grid;
  grid-template-columns: 3fr 1fr 1fr 1.5fr;
  gap: 8px;
  padding: 10px 4px;
  align-items: center;
  border-bottom: 1px solid #f0f0f0;
}

.cart-col-name {
  font-weight: 600;
  font-size: 14px;
}

.cart-col-code {
  color: #8b8b8b;
  font-size: 13px;
}

.cart-col-price {
  font-weight: 600;
  color: #0F3D91;
  font-size: 14px;
}

.cart-col-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
}

.cart-col-qty .qty-btn {
  width: 28px;
  height: 28px;
  font-size: 16px;
}

.cart-col-qty .qty-count {
  font-size: 16px;
  min-width: 20px;
}

/* ===== CART TOTAL ===== */
.cart-total {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 16px 4px 8px;
  border-top: 2px solid #0F3D91;
  margin-top: 8px;
  font-weight: 700;
  font-size: 16px;
}

.total-label {
  font-size: 18px;
  color: #222;
}

.total-eur, .total-mdl, .total-usd, .total-gbp {
  text-align: center;
  font-size: 16px;
}

.total-eur { color: #0F3D91; }
.total-mdl { color: #2e7d32; }
.total-usd { color: #2e7d32; }
.total-gbp { color: #2e7d32; }

/* ===== REST CALCULATOR ===== */
.rest-calculator {
  background: white;
  border-radius: 16px;
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.rest-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.rest-row:last-child {
  margin-bottom: 0;
}

.rest-label {
  font-weight: 600;
  font-size: 15px;
  color: #333;
  min-width: 120px;
}

.currency-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.currency-btn {
  padding: 6px 14px;
  border: 2px solid #d8d8d8;
  border-radius: 8px;
  background: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.currency-btn.active {
  border-color: #0F3D91;
  background: #0F3D91;
  color: white;
}

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

.rest-input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid #d8d8d8;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  min-width: 100px;
}

.rest-input:focus {
  border-color: #0F3D91;
}

.rest-value {
  flex: 1;
  font-size: 20px;
  font-weight: 700;
  color: #0F3D91;
  padding: 6px 0;
}

/* ===== CLEAR BUTTON ===== */
.clear-cart-btn {
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-cart-btn:active {
  transform: scale(0.97);
}

/* ===== EMPTY CART ===== */
.empty-cart {
  text-align: center;
  padding: 40px 0;
  font-size: 18px;
  color: #8b8b8b;
}

/* ===== BOTTOM BAR - FIX ===== */
.bottomBar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: white;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 0 14px;
  box-shadow: 0 -3px 10px rgba(0,0,0,.1);
  z-index: 999;
  border-top: 1px solid #e8e8e8;
}

.bottomBar button {
  background: none;
  border: none;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 20px;
  color: #888;
  transition: all 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.bottomBar button .icon {
  font-size: 24px;
}

.bottomBar button span {
  font-size: 12px;
}

.bottomBar button.active {
  color: #0F3D91;
  font-weight: 700;
}

.bottomBar button.active .icon {
  color: #0F3D91;
}

.bottomBar button .badge {
  position: absolute;
  top: -6px;
  right: 10px;
  background: #dc3545;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

/* ===== REFRESH BUTTON ===== */
.refresh-btn {
  position: fixed;
  bottom: 90px;
  right: 16px;
  background: #0F3D91;
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  z-index: 998;
  cursor: pointer;
  transition: all 0.3s;
  display: none;
  align-items: center;
  justify-content: center;
}

.refresh-btn:hover {
  transform: scale(1.1);
}

.refresh-btn:active {
  transform: scale(0.9);
}

.refresh-btn.show {
  display: flex;
  animation: pulse 1s infinite;
}

/* ===== SCROLL TOP BUTTON ===== */
.scroll-top-btn {
  position: fixed;
  bottom: 90px;
  left: 16px;
  background: #0F3D91;
  color: white;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  z-index: 998;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
}

.scroll-top-btn:hover {
  transform: scale(1.1);
}

.scroll-top-btn:active {
  transform: scale(0.9);
}

.scroll-top-btn.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .product-name {
    font-size: 11px;
    min-height: 28px;
  }
  
  .cart-header,
  .cart-row {
    grid-template-columns: 2fr 0.8fr 0.8fr 1.2fr;
    font-size: 12px;
  }
  
  .cart-total {
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    font-size: 13px;
    gap: 4px;
  }
  
  .rest-label {
    min-width: 80px;
    font-size: 13px;
  }
  
  .rest-value {
    font-size: 18px;
  }
  
  .currency-btn {
    padding: 4px 10px;
    font-size: 12px;
  }
  
  .topbar {
    padding: 10px 12px;
  }
  
  .logo {
    font-size: 18px;
  }
  
  .top-buttons button {
    padding: 6px 10px;
    font-size: 12px;
  }
  
  .search {
    top: 56px;
    padding: 8px 12px;
  }
  
  #products, #cart {
    margin-top: 104px;
  }
  
  #products {
    padding: 6px;
    gap: 6px;
  }
  
  .product-card {
    padding: 6px;
  }
  
  .product-name {
    font-size: 11px;
    min-height: 28px;
  }
  
  .product-price {
    font-size: 12px;
  }
  
  .product-code {
    font-size: 10px;
  }
  
  .qty-btn {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }
  
  .qty-count {
    font-size: 14px;
    min-width: 16px;
  }
  
  .product-image {
    padding-top: 80%;
  }
  
  .refresh-btn {
    width: 44px;
    height: 44px;
    font-size: 20px;
    bottom: 80px;
    right: 12px;
  }
  
  .scroll-top-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
    bottom: 80px;
    left: 12px;
  }
  
  .bottomBar button {
    padding: 4px 12px;
  }
  
  .bottomBar button .icon {
    font-size: 20px;
  }
  
  .bottomBar button span {
    font-size: 11px;
  }
  
  .bottomBar button .badge {
    width: 18px;
    height: 18px;
    font-size: 10px;
    right: 4px;
    top: -4px;
  }
}

@media (max-width: 380px) {
  #products {
    gap: 4px;
    padding: 4px;
  }
  
  .product-card {
    padding: 4px;
  }
  
  .product-name {
    font-size: 10px;
    min-height: 24px;
  }
  
  .product-price {
    font-size: 11px;
  }
  
  .product-code {
    font-size: 9px;
  }
  
  .qty-btn {
    width: 20px;
    height: 20px;
    font-size: 12px;
  }
  
  .qty-count {
    font-size: 12px;
    min-width: 14px;
  }
  
  .product-image {
    padding-top: 75%;
  }
}
