/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f4f4f2; color: #212121; font-size: 15px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

/* ===== Variables ===== */
:root {
  --blue: #0000a4;
  --blue-dark: #00008c;
  --blue-hover: #0000c8;
  --orange: #f77900;
  --green: #00963f;
  --text: #212121;
  --text-muted: #767676;
  --border: #e0e0e0;
  --bg: #f4f4f2;
  --white: #ffffff;
  --shadow: 0 1px 4px rgba(0,0,0,.1);
  --radius: 4px;
}

/* ===== Layout ===== */
.container { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* ===== Header ===== */
.site-header { background: var(--blue); color: var(--white); padding: 12px 0; }
.header-inner { display: flex; align-items: center; gap: 16px; }

.logo {
  font-size: 26px; font-weight: 900; color: var(--white);
  letter-spacing: -1px; white-space: nowrap; flex-shrink: 0;
  text-decoration: none;
}
.logo:hover { text-decoration: none; color: #dde; }

.search-form { display: flex; flex: 1; max-width: 700px; }
.search-input {
  flex: 1; padding: 10px 14px; border: none; border-radius: var(--radius) 0 0 var(--radius);
  font-size: 15px; outline: none;
}
.search-btn {
  background: var(--orange); border: none; padding: 0 18px;
  border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer;
  color: var(--white); display: flex; align-items: center;
}
.search-btn:hover { background: #e06e00; }

.header-nav { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
.cart-link {
  display: flex; align-items: center; gap: 6px; color: var(--white);
  font-size: 14px; position: relative; text-decoration: none;
}
.cart-link:hover { text-decoration: none; color: #ccd; }
.cart-badge {
  position: absolute; top: -8px; right: -8px;
  background: var(--orange); color: var(--white);
  border-radius: 50%; width: 18px; height: 18px;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ===== Category Nav ===== */
.category-nav { background: var(--white); border-bottom: 1px solid var(--border); }
.category-list { display: flex; overflow-x: auto; gap: 0; padding: 0; }
.category-list li a {
  display: block; padding: 11px 16px; font-size: 14px; color: var(--text);
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.category-list li a:hover, .category-list li a.active {
  color: var(--blue); border-bottom-color: var(--blue); text-decoration: none;
}

/* ===== Main ===== */
.main-content { min-height: 60vh; padding: 20px 0 40px; }

/* ===== Page Header ===== */
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.page-header p  { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* ===== Product Grid ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.product-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .15s;
}
.product-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.15); text-decoration: none; }

.product-card-link { display: flex; flex-direction: column; flex: 1; color: var(--text); }
.product-card-link:hover { text-decoration: none; }

.product-img-wrap {
  aspect-ratio: 1; overflow: hidden; background: #f9f9f9;
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
.product-img-wrap img { object-fit: contain; max-height: 180px; }
.product-img-placeholder {
  width: 100%; aspect-ratio: 1; background: #e8e8e8;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: #bbb;
}

.product-info { padding: 12px; flex: 1; display: flex; flex-direction: column; }
.product-name {
  font-size: 14px; font-weight: 500; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 6px; line-height: 1.4;
}
.product-rating { display: flex; align-items: center; gap: 5px; margin-bottom: 8px; }
.stars .star.full  { color: #f77900; }
.stars .star.half  { color: #f77900; opacity: .6; }
.stars .star.empty { color: #ddd; }
.review-count { font-size: 12px; color: var(--text-muted); }

.product-price { margin-top: auto; }
.price-block { display: flex; align-items: baseline; gap: 2px; font-weight: 700; color: var(--text); }
.price-euros { font-size: 20px; }
.price-comma { font-size: 14px; }
.price-cents { font-size: 14px; vertical-align: super; }
.price-delivery { font-size: 12px; color: var(--green); margin-top: 2px; }

.btn-cart {
  margin: 10px 12px 12px;
  background: var(--blue); color: var(--white);
  border: none; border-radius: var(--radius);
  padding: 9px 12px; font-size: 14px; font-weight: 600;
  cursor: pointer; width: calc(100% - 24px);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s;
}
.btn-cart:hover { background: var(--blue-hover); }
.btn-cart:active { background: var(--blue-dark); }

/* ===== Product Detail ===== */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
.product-detail-img { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; display: flex; align-items: center; justify-content: center; min-height: 380px; }
.product-detail-img img { max-height: 340px; object-fit: contain; }

.product-detail-info { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.product-detail-category { font-size: 13px; color: var(--blue); margin-bottom: 8px; }
.product-detail-name { font-size: 22px; font-weight: 700; line-height: 1.3; margin-bottom: 12px; }
.product-detail-rating { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.product-detail-price { font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 6px; display: flex; align-items: baseline; gap: 2px; }
.product-detail-price .price-euros { font-size: 28px; }
.product-detail-price .price-cents { font-size: 16px; }
.product-detail-delivery { color: var(--green); font-size: 14px; margin-bottom: 20px; }
.product-detail-stock { margin-bottom: 16px; font-size: 14px; }
.stock-ok { color: var(--green); font-weight: 600; }
.stock-low { color: var(--orange); font-weight: 600; }

.qty-form { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.qty-input {
  width: 64px; padding: 8px; text-align: center; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 16px;
}
.btn-primary {
  background: var(--blue); color: var(--white); border: none;
  border-radius: var(--radius); padding: 12px 24px;
  font-size: 15px; font-weight: 600; cursor: pointer; transition: background .15s;
}
.btn-primary:hover { background: var(--blue-hover); }

.product-description { margin-top: 24px; }
.product-description h3 { font-size: 16px; font-weight: 700; margin-bottom: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.product-description p { font-size: 14px; line-height: 1.7; color: #444; }

/* ===== Cart ===== */
.cart-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.cart-table-wrap { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th { background: #f8f8f8; padding: 12px 16px; text-align: left; font-size: 13px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.cart-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.cart-table tr:last-child td { border-bottom: none; }

.cart-product { display: flex; align-items: center; gap: 14px; }
.cart-product img { width: 72px; height: 72px; object-fit: contain; border-radius: var(--radius); background: #f5f5f5; padding: 4px; }
.cart-product-name { font-size: 14px; font-weight: 500; }
.cart-product-name a { color: var(--text); }
.cart-product-name a:hover { color: var(--blue); }
.cart-price { font-weight: 700; font-size: 16px; white-space: nowrap; }
.cart-price .price-euros { font-size: 16px; }
.cart-price .price-cents { font-size: 12px; }
.qty-select { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
.btn-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 20px; line-height: 1; padding: 2px 6px; border-radius: var(--radius); }
.btn-remove:hover { background: #f0f0f0; color: #c00; }

.cart-summary { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; position: sticky; top: 16px; }
.cart-summary h2 { font-size: 18px; margin-bottom: 16px; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.summary-row.total { font-weight: 700; font-size: 18px; border-bottom: none; padding-top: 12px; }
.btn-checkout { width: 100%; background: var(--blue); color: var(--white); border: none; border-radius: var(--radius); padding: 14px; font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 16px; transition: background .15s; }
.btn-checkout:hover { background: var(--blue-hover); }

.cart-empty { text-align: center; padding: 60px 20px; }
.cart-empty h2 { font-size: 22px; margin-bottom: 12px; }
.cart-empty p { color: var(--text-muted); margin-bottom: 24px; }
.btn-secondary { display: inline-block; background: var(--white); color: var(--blue); border: 2px solid var(--blue); border-radius: var(--radius); padding: 10px 24px; font-size: 15px; font-weight: 600; cursor: pointer; transition: background .15s; text-decoration: none; }
.btn-secondary:hover { background: var(--blue-light, #e8eaf6); text-decoration: none; }

/* ===== Checkout ===== */
.checkout-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.checkout-form-wrap { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.checkout-form-wrap h2 { font-size: 18px; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 15px; font-family: inherit;
  outline: none; transition: border-color .15s;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(0,0,164,.12); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { color: #c00; font-size: 13px; margin-top: 4px; }
.form-section-title { font-size: 16px; font-weight: 700; margin: 24px 0 12px; border-top: 1px solid var(--border); padding-top: 20px; }
.stripe-element-wrap { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); }
.checkout-order-summary { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; position: sticky; top: 16px; }
.checkout-order-summary h2 { font-size: 18px; margin-bottom: 16px; }
.checkout-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.checkout-item img { width: 52px; height: 52px; object-fit: contain; background: #f5f5f5; border-radius: var(--radius); padding: 3px; }
.checkout-item-info { flex: 1; font-size: 13px; }
.checkout-item-name { font-weight: 500; }
.checkout-item-qty { color: var(--text-muted); }
.checkout-item-price { font-weight: 700; font-size: 14px; }

/* ===== Success Page ===== */
.success-page { text-align: center; padding: 60px 20px; max-width: 600px; margin: 0 auto; }
.success-icon { font-size: 72px; margin-bottom: 20px; }
.success-page h1 { font-size: 28px; margin-bottom: 12px; color: var(--green); }
.success-page p { color: var(--text-muted); font-size: 16px; margin-bottom: 24px; }

/* ===== Alerts ===== */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.alert-error   { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.alert-info    { background: #e8eaf6; color: #283593; border: 1px solid #9fa8da; }

/* ===== Pagination ===== */
.pagination { display: flex; gap: 6px; justify-content: center; padding: 24px 0 8px; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius);
  border: 1px solid var(--border); font-size: 14px; color: var(--text);
  background: var(--white);
}
.pagination a:hover { background: var(--blue); color: var(--white); border-color: var(--blue); text-decoration: none; }
.pagination span.current { background: var(--blue); color: var(--white); border-color: var(--blue); font-weight: 700; }

/* ===== Footer ===== */
.site-footer { background: #001a54; color: #ccd; padding: 40px 0 0; margin-top: 40px; }
.footer-inner { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; padding-bottom: 32px; }
.footer-col h4 { font-size: 14px; font-weight: 700; color: var(--white); margin-bottom: 12px; }
.footer-col ul li { margin-bottom: 7px; }
.footer-col ul li a { font-size: 13px; color: #9ab; }
.footer-col ul li a:hover { color: var(--white); text-decoration: none; }
.payment-icons li { font-size: 13px; display: inline-block; margin-right: 8px; margin-bottom: 6px; background: rgba(255,255,255,.12); padding: 3px 8px; border-radius: 3px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding: 16px 0; font-size: 13px; color: #7a9ab8; }

/* ===== Utility ===== */
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.no-results { text-align: center; padding: 60px 20px; color: var(--text-muted); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .product-detail { grid-template-columns: 1fr; }
  .cart-layout, .checkout-layout { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .header-inner { flex-wrap: wrap; }
  .search-form { order: 3; flex-basis: 100%; max-width: 100%; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
