/* =====================================================
   STORE.CSS — Foglio stile base adattabile
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --accent: #0f3460;
  --accent2: #e94560;
  --bg: #f7f7fa;
  --bg2: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e2e5ef;
  --card-radius: 16px;
  --font: 'DM Sans', sans-serif;
  --font-display: 'Playfair Display', serif;
  --shadow: 0 4px 24px rgba(15,52,96,0.10);
  --shadow-hover: 0 12px 40px rgba(15,52,96,0.18);
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── NAVBAR ─────────────────────────────────────────── */
.navbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,0.05);
}

.navbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.store-logo {
  height: 38px;
  width: 38px;
  object-fit: contain;
  border-radius: 8px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }

.store-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.store-tagline {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}

.nav-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
  align-items: center;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
}

.nav-links a:hover, .nav-links a.active {
  background: rgba(15,52,96,0.07);
  color: var(--accent);
}

.cart-btn {
  position: relative;
  background: var(--accent) !important;
  color: white !important;
  border-radius: 12px !important;
  padding: 8px 18px !important;
}

.cart-btn:hover { opacity: 0.88; }

#cart-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  background: var(--accent2);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--bg2);
}

/* ── PAGE HEADER ─────────────────────────────────────── */
.page-hero {
  background: linear-gradient(135deg, var(--accent) 0%, #16213e 100%);
  color: #fff;
  padding: 60px 24px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='1.5' fill='rgba(255,255,255,0.08)'/%3E%3C/svg%3E");
}

.page-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  position: relative;
}

.page-hero p {
  margin-top: 12px;
  font-size: 1.05rem;
  opacity: 0.78;
  position: relative;
}

/* ── CONTAINER ───────────────────────────────────────── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── FILTERS BAR ─────────────────────────────────────── */
.filters-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 24px 0 8px;
}

.search-box {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 11px 16px 11px 42px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-family: var(--font);
  font-size: 0.92rem;
  background: var(--bg2);
  color: var(--text);
  transition: var(--transition);
  outline: none;
}

.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,52,96,0.10); }

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.filter-select {
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-family: var(--font);
  font-size: 0.9rem;
  background: var(--bg2);
  color: var(--text);
  cursor: pointer;
  outline: none;
  min-width: 150px;
}

.filter-select:focus { border-color: var(--accent); }

.results-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── PRODUCT GRID ────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 24px 0 48px;
}

/* ── PRODUCT CARD ────────────────────────────────────── */
.product-card {
  background: var(--bg2);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  animation: fadeInUp 0.5s ease both;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

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

.card-img-wrap {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #f0f2f8;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.product-card:hover .card-img-wrap img { transform: scale(1.06); }

.card-img-placeholder {
  font-size: 3.5rem;
  opacity: 0.25;
  user-select: none;
}

.card-body { padding: 18px 20px; flex: 1; display: flex; flex-direction: column; gap: 6px; }

.card-brand {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent2);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.card-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-price {
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-display);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }

.btn-accent {
  background: var(--accent2);
  color: #fff;
}

.btn-accent:hover { opacity: 0.88; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover { background: var(--accent); color: #fff; }

.btn-ghost {
  background: rgba(15,52,96,0.06);
  color: var(--accent);
}

.btn-ghost:hover { background: rgba(15,52,96,0.12); }

.btn-sm { padding: 7px 13px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: 14px; }

/* ── PRODUCT DETAIL PAGE ─────────────────────────────── */
.product-detail {
  max-width: 1100px;
  margin: 48px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

.product-gallery {
  border-radius: var(--card-radius);
  overflow: hidden;
  background: #f0f2f8;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.product-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-info { display: flex; flex-direction: column; gap: 16px; }

.product-brand-badge {
  display: inline-block;
  background: rgba(233,69,96,0.10);
  color: var(--accent2);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(233,69,96,0.2);
}

.product-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 900;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.02em;
}

.product-desc {
  font-size: 0.97rem;
  line-height: 1.75;
  color: var(--text-muted);
}

.product-price-block {
  background: linear-gradient(135deg, var(--accent) 0%, #16213e 100%);
  border-radius: 14px;
  padding: 20px 24px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-price {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
}

.product-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.qty-control {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg2);
}

.qty-control button {
  width: 38px;
  height: 40px;
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--accent);
  transition: var(--transition);
}

.qty-control button:hover { background: rgba(15,52,96,0.07); }

.qty-control input {
  width: 46px;
  text-align: center;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
}

.product-meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.product-meta-table tr { border-bottom: 1px solid var(--border); }
.product-meta-table tr:last-child { border-bottom: none; }
.product-meta-table th, .product-meta-table td { padding: 10px 4px; text-align: left; }
.product-meta-table th { color: var(--text-muted); font-weight: 500; width: 40%; }
.product-meta-table td { font-weight: 600; color: var(--text); }

/* ── CART PAGE ───────────────────────────────────────── */
.cart-layout {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  align-items: start;
}

.cart-items { display: flex; flex-direction: column; gap: 14px; }

.cart-item {
  background: var(--bg2);
  border-radius: var(--card-radius);
  border: 1px solid var(--border);
  display: flex;
  gap: 16px;
  padding: 16px;
  align-items: center;
  box-shadow: var(--shadow);
  animation: fadeInUp 0.4s ease both;
}

.cart-item-img {
  width: 90px;
  height: 75px;
  object-fit: cover;
  border-radius: 10px;
  background: #f0f2f8;
  flex-shrink: 0;
}

.cart-item-info { flex: 1; display: flex; flex-direction: column; gap: 3px; }

.cart-item-brand { font-size: 0.72rem; color: var(--accent2); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.cart-item-name { font-weight: 700; font-size: 0.95rem; }
.cart-item-price { font-size: 0.88rem; color: var(--text-muted); }

.cart-item-qty { display: flex; align-items: center; gap: 10px; }
.cart-item-qty .qty-control { transform: scale(0.9); }

.cart-item-total { font-weight: 700; font-size: 1.05rem; color: var(--accent); min-width: 72px; text-align: right; }
.cart-item-remove { background: none; border: none; cursor: pointer; color: #c0c0d0; font-size: 1.2rem; transition: var(--transition); padding: 4px 8px; border-radius: 8px; }
.cart-item-remove:hover { color: var(--accent2); background: rgba(233,69,96,0.07); }

/* CART SUMMARY */
.cart-summary {
  background: var(--bg2);
  border-radius: var(--card-radius);
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-summary h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
}

.summary-row { display: flex; justify-content: space-between; font-size: 0.92rem; color: var(--text-muted); }
.summary-row.total { color: var(--text); font-size: 1.15rem; font-weight: 800; border-top: 1.5px solid var(--border); padding-top: 12px; }

.cart-empty {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
  grid-column: 1/-1;
}

.cart-empty .empty-icon { font-size: 4rem; margin-bottom: 16px; }
.cart-empty h2 { font-family: var(--font-display); font-size: 1.6rem; color: var(--text); margin-bottom: 8px; }

/* ── TOAST ───────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 28px; right: 28px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }

.toast {
  background: var(--text);
  color: #fff;
  padding: 13px 20px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  animation: slideInToast 0.35s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { background: #16a34a; }
.toast.error   { background: var(--accent2); }

@keyframes slideInToast {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── CONFIG PAGE ─────────────────────────────────────── */
.config-layout {
  max-width: 860px;
  margin: 48px auto;
  padding: 0 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.config-section {
  background: var(--bg2);
  border-radius: var(--card-radius);
  border: 1px solid var(--border);
  padding: 28px 32px;
  box-shadow: var(--shadow);
}

.config-section h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-full { grid-column: 1/-1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font);
  font-size: 0.92rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: var(--transition);
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,52,96,0.09);
  background: var(--bg2);
}

.color-row { display: flex; align-items: center; gap: 10px; }

.color-row input[type="color"] {
  width: 44px;
  height: 38px;
  padding: 2px;
  border-radius: 8px;
  cursor: pointer;
}

.csv-preview {
  background: #f4f5fa;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.82rem;
  font-family: monospace;
  color: var(--text-muted);
  max-height: 140px;
  overflow-y: auto;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-all;
}

.config-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* ── BREADCRUMB ───────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 24px;
  font-size: 0.84rem;
  color: var(--text-muted);
  max-width: 1280px;
  margin: 0 auto;
}

.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--text-muted); }

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 900px) {
  .product-detail { grid-template-columns: 1fr; }
  .cart-layout { grid-template-columns: 1fr; }
  .cart-summary { position: static; }
}

@media (max-width: 640px) {
  .navbar-inner { padding: 0 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .filters-bar { gap: 8px; }
  .nav-links a span { display: none; }
}
