/* ═══════════════════════════════════════════════════════════════
   EcomerceDeep — Storefront Stylesheet (fully restructured)

   LAYER MAP:
     L1  BASE ................ reset, body, .container
     L2  SHARED CHROME ....... header / nav / search / footer / banner zone
     L3  SHARED COMPONENTS ... product card & tags, grid base, category tree,
                               two-column layout, buttons, empty state, titles
     L4  PAGE: index.php ..... home page (body.page-home)
     L5  PAGE: category.php .. listing page (body.page-category)
     L6  PAGE: product.php ... single product detail
     L7  PAGE: cart.php ...... cart + recommendations
     L8  PAGE: checkout.php ... checkout form + order summary
     L9  PAGE: account.php .... login / register / profile forms
     L10 ADMIN EDIT MODE ..... admin/layout.php edit toolbar & module outlines

   HOW TO FINE-TUNE AN ELEMENT ON ONE PAGE ONLY:
     1. Page-unique classes never collide — just edit them in their page section:
          .home-product-grid (index), .cat-products / .cat-product-grid (category), ...
     2. To override a SHARED component on one page only, scope it by body class
        inside that page's section, e.g.:
          body.page-home .product-card { padding: 32px; }
        → changes index.php only; category/product/cart untouched.
     3. Never edit L1–L3 for a single-page tweak — override in the page section.
═══════════════════════════════════════════════════════════════ */

/* ── L1 · BASE ─────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-y: scroll; } /* always reserve scrollbar space — no horizontal jump */

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #fff;
  color: #1d1d1f;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ── L2 · SHARED CHROME (header / nav / search / footer — all storefront pages) ─────────────────────── */
.site-header {
  background: rgba(251, 251, 253, 0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid #e8e8ed;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.logo {
  font-size: 21px;
  font-weight: 700;
  color: #1d1d1f;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.main-nav { display: flex; gap: 24px; align-items: center; }

.main-nav a {
  color: #1d1d1f;
  text-decoration: none;
  font-size: 14px;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.main-nav a:hover { opacity: 1; }

.nav-cart { font-weight: 600; }

/* Header search box (shared across all pages incl. index.php & category.php) */
.site-search {
  display: flex;
  align-items: center;
}

.site-search input[type="text"] {
  padding: 8px 12px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  font-size: 14px;
  width: 220px;
  transition: border-color 0.2s;
}

.site-search input[type="text"]:focus {
  outline: none;
  border-color: #0071e3;
}

/* Home hero: fixed min-height, fluid type → same size on every load, no overflow on phones */
.hero.hero-home {
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  padding: 32px 0;
  margin: 0;
}
.hero.hero-home h1 { font-size: clamp(26px, 5vw, 44px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.hero.hero-home p { font-size: clamp(14px, 2.4vw, 18px); color: #f5f5f7; margin-top: 12px; }

/* Cart item count in the header */
.cart-count {
  display: inline-block;
  min-width: 20px;
  height: 20px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 10px;
  background: #0071e3;
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  vertical-align: 1px;
}
.main-nav a[aria-current="page"] { opacity: 1; font-weight: 600; color: #0071e3; }

/* Full-bleed wrapper for the hero banners (index home banner / category banner) */
.hero-banner-zone {
  width: 100%;
  margin-bottom: 0;
}

.site-footer {
  background: #f5f5f7;
  border-top: 1px solid #e8e8ed;
  padding: 24px 0;
  text-align: center;
  color: #6e6e73;
  font-size: 13px;
}

/* ── L3 · SHARED COMPONENTS (used by several pages — override per page in L4–L9 if needed) ─────────── */

/* Two-column layout shell: [220px sidebar | fluid center]. Used by index.php & category.php.
   Tune one page only via:  body.page-home .layout-main { ... } / body.page-category .layout-main { ... } */
.layout-main {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);   /* widened for two-word category names */
  gap: 32px;
  align-items: start;
}
.layout-center { min-width: 0; }

/* Generic product grid (default for any .product-grid without a page modifier).
   Index uses .home-product-grid, category uses .cat-product-grid — see L4/L5. */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.product-card {
  background: #f5f5f7;
  border-radius: 16px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
}

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

.product-image {
  background: #fff;
  border-radius: 10px;
  height: 180px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.product-image img {
  max-width: 100%;
  max-height: 160px;
  object-fit: contain;
}

.no-image { font-size: 48px; opacity: 0.3; }

.product-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
  min-height: 2.8em;           /* always reserve two lines → prices line up across cards */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card .price { margin-top: auto; }

.price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: #1d1d1f;
}

/* New (current) price in red when a discount old price is shown */
.price.discount > .price-current {
  color: #e02424;
}

/* Crossed-out old price shown next to the current one (active discount tag) */
.price-old {
  font-size: 0.75em;
  font-weight: 500;
  color: #86868b;
  text-decoration: line-through;
}

/* Product tag badges (grids + product detail) */
.product-tags-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  max-width: calc(100% - 16px);
}

.product-tag {
  position: relative;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  pointer-events: none;
}

/* Tag colors */
.tag-promotion {
  background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
}

.tag-discount {
  background: linear-gradient(135deg, #ffd93d, #f4c430);
  color: #1d1d1f;
}

.tag-new {
  background: linear-gradient(135deg, #6bcf7f, #4caf50);
}

/* Sunflower shape — rounded with subtle ray effect */
.tag-sunflower {
  border-radius: 20px;
  padding: 5px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.tag-sunflower.tag-promotion {
  background: radial-gradient(circle at 30% 30%, #ff8a8a, #ee5a5a);
}

.tag-sunflower.tag-discount {
  background: radial-gradient(circle at 30% 30%, #ffe066, #f4c430);
}

.tag-sunflower.tag-new {
  background: radial-gradient(circle at 30% 30%, #8edf9a, #4caf50);
}

/* Flag shape — triangular corner banner */
.tag-flag {
  padding: 6px 14px 6px 6px;
  border-radius: 0 4px 4px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.tag-flag.tag-promotion {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
}

.tag-flag.tag-discount {
  background: linear-gradient(135deg, #ffd93d 0%, #f4c430 100%);
}

.tag-flag.tag-new {
  background: linear-gradient(135deg, #6bcf7f 0%, #4caf50 100%);
}

/* Empty state — index.php (no search matches), category.php (empty category) */
.empty-state { color: #6e6e73; padding: 60px 20px; text-align: center; font-size: 18px; }

/* Page titles (category h1, index search results h1, home module h2s) */
.page-title {
  font-size: 28px;
  font-weight: 800;
  margin: 40px 0 24px;
  letter-spacing: -0.02em;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

/* Category tree sidebar (shared — index.php & category.php left column).
   Tune one page only via: body.page-home .sidebar-cats { ... } etc. */
.cat-tree-wrap { margin-bottom: 16px; }
ul.cat-tree {
  list-style: none;
  margin: 4px 0;
  padding-left: 8px;
}
.sidebar-cats { margin-top: 28px; min-width: 260px; max-width: 100%; overflow-x: hidden; } /* fixed sidebar — never moves */
li.cat-item {
  position: relative;
  margin: 2px 0;
}
.sidebar-cats ul.cat-tree a,
.sidebar-cats .toggle { font-size: 17px; font-weight: 600; }
ul.cat-tree > li > a, ul.cat-tree > li > .toggle { line-height: 1.6; }
ul.cat-tree.sub, ul.cat-tree.open { clear: both; display:none; padding-left:16px; }
ul.cat-tree.open, ul.cat-tree.sub.open { display:block; }
.toggle, .toggle-placeholder {
  float: left;
  width: 16px;
  height: 18px;
  line-height: 19px;
  text-align: center;
  cursor: pointer;
  font-weight: 700;
  color: #0071e3;
  user-select: none;
}
.toggle::before { content: '+'; }
li.open > .toggle::before { content: '−'; }
.toggle-placeholder { visibility: hidden; }
.cat-item a {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  text-decoration: none;
  color: #1d1d1f;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap; /* keep two-word names on one line */
}
.cat-item a:hover { color: #0071e3; }
/* Active marker — current category */
li.cat-item.active > a.current {
  background: #0071e3;
  color: #fff;
}

/* Buttons (shared) */
.btn-add {
  display: inline-block;
  background: #0071e3; color: #fff;
  border: none; border-radius: 980px;
  padding: 12px 28px;
  font-size: 16px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background 0.2s;
}
.btn-add:hover { background: #0068c9; }
.btn-big { width: 100%; padding: 14px; margin-top: 20px; }
.btn-secondary {
  background: #f5f5f7; color: #1d1d1f;
  border: none; border-radius: 980px;
  padding: 12px 24px; font-size: 15px; cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════ */
/* ── L4 · PAGE: index.php (body.page-home) — home banner, featured/newest/sale modules ── */

/* Home hero banner (rendered by 'banner' module in .hero-banner-zone) */
.hero {
  background: linear-gradient(135deg, #f5f5f7 0%, #e8e8ed 100%);
  text-align: center;
  padding: 120px 24px;
  margin: 0;
  border: none;
}

.hero h1 {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.hero p {
  font-size: 24px;
  color: #6e6e73;
  font-weight: 400;
}

/* Center column of the home page (holds featured/newest/sale modules or search results) */
.home-products { padding-top: 64px; }

/* Space between the product grid and the footer */
.layout-main { margin-bottom: 48px; }

/* Each module is its own section — tune them individually:
   .module-featured / .module-newest / .module-sale */
.home-module + .home-module { margin-top: 64px; }
.home-module .page-title { margin-top: 0; } /* module titles sit flush at the top of their block */

/* Home product grids (independent from category grid — tune columns/gap here) */
.home-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

/* Search-results grid (index.php with ?q=…) */
.search-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

/* ═══════════════════════════════════════════════════════════ */
/* ── L5 · PAGE: category.php (body.page-category) — banner, controls, listing, pagination ── */

/* Category hero banner (shown when the category has a banner image) */
.hero-category-banner {
  position: relative;
  overflow: hidden;
}

.hero-category-banner {
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
}
.hero-category-banner h1 {
  margin: 0;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  font-size: clamp(26px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
@media (max-width: 768px) { .hero.hero-home, .hero-category-banner { min-height: 200px; } }

.hero-category-banner > .container {
  position: relative;
  z-index: 2;
}

/* No entrance animations on banner/title/listing: content renders in its final
   position immediately (previous slide/fade-in caused visible jumps on every click). */

/* Center column of the listing page */
.cat-products { padding: 48px 0; }

/* Reduce top spacing when a category banner exists above */
.hero-banner-zone + .layout-main .cat-products {
  padding-top: 11px;
}

/* Category product grid (independent from the home grids — tune columns/gap here) */
.cat-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

/* Product controls — sorting and count (category.php only) */
.product-controls {
  background: #f5f5f7;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.product-count {
  font-size: 14px;
  color: #1d1d1f;
}

.product-count strong {
  font-weight: 600;
}

.sort-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sort-controls label {
  font-size: 14px;
  color: #1d1d1f;
}

.sort-controls select {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.sort-controls select:hover {
  border-color: #aaa;
}

.sort-controls select:focus {
  outline: none;
  border-color: #007aff;
}

/* Pagination (category.php only — product list page nav) */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
}
.page-link {
  padding: 8px 16px;
  border-radius: 980px;
  background: #f5f5f7;
  color: #1d1d1f;
  text-decoration: none;
  font-size: 14px;
}
.page-link.active {
  background: #0071e3;
  color: #fff;
}

/* Breadcrumb trail (category.php) */
.breadcrumb { color: #6e6e73; font-size: 16px; margin: 19px 0; }
.breadcrumb a { color: #0071e3; text-decoration: none; }

/* Subcategory pills (category.php) */
.subcats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.subcat-link {
  background: #f5f5f7;
  padding: 6px 14px;
  border-radius: 20px;
  text-decoration: none;
  color: #1d1d1f;
  font-size: 13px;
}
.subcat-link:hover { background: #e8e8ed; }

/* ═══════════════════════════════════════════════════════════ */
/* ── L6 · PAGE: product.php (body.page-product) — single product detail ── */
.product-detail { padding: 40px 0; }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}
.gallery .main-image {
  background: #f5f5f7;
  border-radius: 16px;
  height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
}
.main-image img { max-width: 100%; max-height: 460px; object-fit: contain; }
.no-image-large { font-size: 96px; opacity: 0.3; }
.thumb-row { display: flex; gap: 8px; }
.thumb {
  width: 72px; height: 72px;
  border-radius: 10px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
}
.thumb.active, .thumb:hover { border-color: #0071e3; }

/* Personalization preview: fixed height so typing or font changes never move the page */
.custom-preview {
  margin-top: 14px;
  height: 84px;
  padding: 0 16px;
  border: 2px dashed #ccc;
  border-radius: 10px;
  background: #fff;
  color: #333;
  font-size: 28px;
  line-height: 80px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.custom-preview.is-empty { font-size: 15px; color: #86868b; }
.info h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 12px; }
.detail-price {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 32px;
  font-weight: 700;
  color: #0071e3;
  margin-bottom: 8px;
}

/* New (current) price in red when a discount old price is shown */
.detail-price.discount > .price-current {
  color: #e02424;
}
.stock { font-size: 14px; margin-bottom: 20px; }
.in-stock { color: #0a7c2e; }
.out-of-stock { color: #b3261e; }
.qty-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.qty-input {
  width: 70px; padding: 10px;
  border: 1px solid #d2d2d7; border-radius: 8px;
  font-size: 15px; text-align: center;
}
.description { margin-top: 32px; }
.description h2 { font-size: 18px; margin-bottom: 12px; }

/* ═══════════════════════════════════════════════════════════ */
/* ── L7 · PAGE: cart.php (body.page-cart) — cart table + recommendations ── */
.cart-page { padding: 40px 0; }
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th, .cart-table td {
  text-align: left; padding: 16px 12px;
  border-bottom: 1px solid #e8e8ed;
}
.cart-name a { color: inherit; text-decoration: none; font-weight: 600; }
.remove-link { color: #b3261e; text-decoration: none; font-size: 18px; }
.cart-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-top: 24px; flex-wrap: wrap;
}
.cart-actions {
  display: flex; gap: 12px; align-items: center;
}
.total-line { font-size: 20px; }

/* Cart recommendations */
.recommended-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e8e8ed;
}

.recommended-section h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: #1d1d1f;
}

.recommended-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.recommended-card {
  border: 1px solid #e8e8ed;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  transition: box-shadow 0.2s ease;
}

.recommended-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.recommended-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 8px;
}

.recommended-card h3 {
  font-size: 14px;
  font-weight: 500;
  margin: 8px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recommended-card p {
  color: #e11d48;
  font-weight: 600;
  margin: 8px 0;
}

.recommended-card .btn-add {
  width: 100%;
  padding: 8px;
  font-size: 13px;
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════ */
/* ── L8 · PAGE: checkout.php (body.page-checkout) — form + order summary ── */
.checkout-page { padding: 40px 0 64px; }
.co-back { margin: -8px 0 24px; font-size: 14px; }
.co-back a { color: #0071e3; text-decoration: none; }
.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 32px;
  align-items: start;
}
.delivery-form { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.co-card {
  background: #fff; border: 1px solid #e8e8ed; border-radius: 18px;
  padding: 24px;
}
.co-card h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 19px; margin: 0 0 18px;
}
.co-step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: #1d1d1f; color: #fff; font-size: 13px; font-weight: 700;
}
.co-field { display: block; margin-bottom: 14px; min-width: 0; }
.co-field > span { display: block; font-size: 13px; font-weight: 600; color: #424245; margin-bottom: 6px; }
.delivery-form input:not([type="radio"]):not([type="checkbox"]),
.delivery-form textarea {
  display: block; width: 100%; box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid #d2d2d7; border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.delivery-form textarea { resize: vertical; min-height: 80px; }
.delivery-form input:focus, .delivery-form textarea:focus {
  outline: none; border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0,113,227,.15);
}
.delivery-form .is-invalid { border-color: #d70015 !important; }
.co-field-err { display: block; color: #d70015; font-size: 12.5px; margin-top: 5px; min-height: 1.2em; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.co-muted { color: #6e6e73; font-size: 13.5px; line-height: 1.45; }
[hidden] { display: none !important; }

/* Radio "cards" for delivery + payment */
.co-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.co-option {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px; border: 1.5px solid #d2d2d7; border-radius: 12px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.co-option input { margin: 3px 0 0; width: 16px; height: 16px; flex-shrink: 0; accent-color: #0071e3; }
.co-option-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.co-option-body strong { font-size: 15px; }
.co-option-body small { font-size: 12.5px; color: #6e6e73; }
.co-option:has(input:checked) { border-color: #0071e3; background: #f2f8ff; }
.co-option:has(input:disabled) { opacity: .5; cursor: not-allowed; }

/* BOX NOW */
#boxnow-panel { margin-bottom: 14px; }
.co-locker {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px; background: #e8f5e9; border-radius: 12px;
}
.co-link-btn { background: none; border: none; color: #0071e3; font-size: 14px; cursor: pointer; padding: 4px; width: auto !important; }
.co-offscreen { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Bank transfer details */
.co-bank { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px; padding: 14px 16px; }
.co-bank-title { font-weight: 700; margin: 0 0 8px; }
.co-bank dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0 0 8px; font-size: 14px; }
.co-bank dt { color: #6e6e73; }
.co-bank dd { margin: 0; overflow-wrap: anywhere; }
.co-bank .co-muted { margin: 0; font-size: 12.5px; }

/* Summary */
.summary {
  background: #f5f5f7; border-radius: 18px;
  padding: 24px; position: sticky; top: 72px;
}
.summary h2 { font-size: 20px; margin: 0 0 12px; }
.co-items { list-style: none; margin: 0; padding: 0; }
.sum-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid #e8e8ed;
  font-size: 14px;
}
.sum-row > span:last-child { white-space: nowrap; font-weight: 600; }
.co-qty { color: #6e6e73; }
.co-custom { display: block; color: #86868b; font-size: 12px; margin-top: 2px; }
.co-totals { padding-top: 10px; font-size: 14px; }
.co-totals > div { display: flex; justify-content: space-between; padding: 4px 0; }
.co-discount { color: #0a7c2e; }
.co-free-hint { font-size: 12.5px; color: #6e6e73; margin: 2px 0 4px; }
.sum-total {
  font-size: 20px; font-weight: 700;
  margin-top: 8px; padding-top: 12px !important; border-top: 1px solid #d2d2d7;
}
.consent {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px; color: #6e6e73; margin: 18px 0 0; line-height: 1.4;
  cursor: pointer;
}
.consent input[type="checkbox"] { margin: 2px 0 0; flex-shrink: 0; width: 16px; height: 16px; }
.consent a { color: #0071e3; }
.consent.is-invalid { color: #d70015; }
.summary .btn-big { margin-top: 16px; }
.btn-add:disabled { background: #86868b; cursor: wait; }
.cod-note {
  background: #fff; border-radius: 10px; text-align: center;
  padding: 8px 16px; margin-top: 12px; font-size: 13px;
}
.err-box { color: #b3261e; background: #fdecea; border-radius: 10px; padding: 12px 16px; margin-bottom: 20px; }

/* Success */
.success-box { text-align: center; padding: 60px 0; }
.success-box h1 { font-size: 32px; margin-bottom: 16px; }
.co-success { max-width: 520px; margin: 0 auto; text-align: center; padding: 40px 0; }
.co-success-icon {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%;
  background: #0a7c2e; color: #fff; font-size: 34px; line-height: 64px;
}
.co-success h1 { font-size: 30px; margin-bottom: 12px; }
.co-success-num { font-size: 17px; margin-bottom: 6px; }
.co-success .co-bank { text-align: left; margin: 20px 0 12px; }
.co-success .btn-add { margin-top: 20px; }

/* ═══════════════════════════════════════════════════════════ */
/* ── L9 · PAGE: account.php (body.page-account) — login / register / profile forms ── */
.account-page .auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  align-items: start;
}

@media (max-width: 700px) {
  .account-page .auth-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

.auth-form {
  display: flex;
  flex-direction: column;
}
.auth-form h2 { font-size: 20px; margin-bottom: 16px; }
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="tel"],
.auth-form .qty-input {
  width: 100% !important;
  padding: 12px 14px;
  border: 1px solid #d2d2d7; border-radius: 8px;
  font-size: 15px; outline: none;
  margin-bottom: 12px;
}
.auth-form input:focus { border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0,113,227,.12); }
.auth-form .consent {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #6e6e73;
  margin-bottom: 16px;
}
.auth-form .consent input[type="checkbox"] {
  margin: 0;
  width: 16px;
  height: 16px;
}
.auth-form button.btn-add {
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════ */
/* ── L10 · ADMIN EDIT MODE (admin only — admin/layout.php edit toolbar & module outlines) ── */
body.admin-edit-mode [data-module] {
  position: relative;
  outline: 2px dashed #0071e3;
  outline-offset: -2px;
  border-radius: 8px;
}

body.admin-edit-mode [data-module]:hover {
  background: rgba(0, 113, 227, 0.05);
}

.drag-handle {
  cursor: move;
  color: #999;
  font-size: 18px;
  margin-right: 8px;
  user-select: none;
  display: inline-block;
}

.edit-toolbar {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1d1d1f;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
}

.edit-toolbar button {
  background: #0071e3;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.edit-toolbar button:hover {
  background: #0077ed;
}

.editable-text {
  outline: none;
  min-height: 1em;
}

.editable-text:focus {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════ */
/* ── L11 · MOBILE / HANDHELD RESPONSIVE (≤768px & ≤480px) ── */

@media (max-width: 768px) {

  /* ── Container ── */
  .container { padding: 0 16px; }

  /* ── Header ── */
  /* Two fixed-height rows: logo (+search) on top, all nav links in a swipeable strip below */
  .header-inner { height: auto; min-height: 84px; flex-wrap: wrap; align-content: center; gap: 0 12px; padding: 6px 0; }
  .logo { font-size: 17px; white-space: nowrap; line-height: 36px; }
  .main-nav {
    order: 3; width: 100%; height: 36px; gap: 18px;
    overflow-x: auto; overflow-y: hidden; white-space: nowrap;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav a { font-size: 14px; flex-shrink: 0; line-height: 36px; }
  /* Cart stays visible at the right edge while the strip scrolls */
  .main-nav .nav-cart {
    position: sticky; right: 0; margin-left: auto;
    padding-left: 12px; background: rgba(251, 251, 253, 0.98);
    box-shadow: -12px 0 12px -6px rgba(251, 251, 253, 0.98);
  }
  /* Tighter vertical rhythm on phones */
  .home-products { padding-top: 16px; }
  .home-module + .home-module { margin-top: 32px; }
  .page-title { font-size: 24px; margin: 8px 0 12px; }
  .site-search input[type="text"] {
    width: 100%;
    max-width: 160px;
    padding: 7px 10px;
    font-size: 13px;
  }

  /* ── Layout grid (sidebar + content) → single column ── */
  .layout-main {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  /* Sidebar becomes a horizontal scrollable category strip */
  .layout-sidebar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    scrollbar-width: thin;
  }
  .layout-sidebar ul { display: flex; gap: 8px; list-style: none; }
  .layout-sidebar li { flex-shrink: 0; }
  .layout-sidebar a,
  .subcat-link {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    background: #f5f5f7;
    font-size: 13px;
    white-space: nowrap;
  }

  /* ── Hero banner ── */
  .hero { padding: 48px 16px; }
  .hero h1 { font-size: 32px; margin-bottom: 10px; }
  .hero p { font-size: 16px; }

  /* ── Product grids ── */
  .product-grid,
  .home-product-grid,
  .search-product-grid,
  .cat-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  .product-card { padding: 14px; border-radius: 12px; }
  .product-image { height: 140px; margin-bottom: 10px; }
  .product-image img { max-height: 120px; }
  .product-card h3 { font-size: 14px; }
  .price { font-size: 16px; }

  /* ── Category page ── */
  .cat-products { padding: 8px 0 24px; }
  .product-controls { flex-wrap: wrap; gap: 8px; padding: 10px; }

  /* ── Product detail ── */
  .product-detail { padding: 24px 0; }
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .gallery .main-image { height: 300px; border-radius: 12px; }
  .main-image img { max-height: 280px; }
  .info h1 { font-size: 22px; }
  .detail-price { font-size: 26px; }
  .thumb { width: 56px; height: 56px; }

  /* ── Cart ── */
  .cart-page { padding: 24px 0; }
  .cart-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cart-table th, .cart-table td { padding: 12px 8px; font-size: 13px; }
  .cart-footer { flex-direction: column; align-items: stretch; text-align: center; }
  .cart-actions { justify-content: center; flex-wrap: wrap; }
  .recommended-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }

  /* ── Checkout ── */
  .checkout-page { padding: 24px 0; overflow-x: hidden; }
  .checkout-grid { grid-template-columns: 1fr; gap: 20px; }
  /* Summary (with the submit button) follows the form on mobile; not sticky */
  .checkout-grid .summary { position: static; padding: 18px; }
  .co-card { padding: 18px; }
  .row2 { grid-template-columns: 1fr; gap: 0 12px; }
  .co-options { grid-template-columns: 1fr; gap: 10px; }

  /* ── Buttons — touch-friendly min tap target ── */
  main .btn, main button, main input[type="submit"] {
    min-height: 44px;
    font-size: 15px;
  }

  /* ── Chat widget — ensure it doesn't obscure content ── */
  /* Anchored to the corner on phones (dragging is a desktop feature) */
  #chat-widget-btn {
    left: auto !important; top: auto !important;
    right: 16px !important; bottom: 16px !important;
    width: 56px !important; height: 56px !important;
    padding: 0 !important; font-size: 24px !important;
    border-radius: 50% !important;
  }
  #chat-btn-label { display: none; }
  #chat-widget-panel {
    left: 8px !important; right: 8px !important; top: auto !important;
    bottom: 84px !important;
    width: auto !important; max-width: none !important;
    height: min(520px, calc(100dvh - 160px)) !important;
  }

  /* Category tree: compact, full width */
  .sidebar-cats { margin-top: 12px; min-width: 0; }
  .sidebar-cats ul.cat-tree a,
  .sidebar-cats .toggle { font-size: 15px; }

  /* ── Footer ── */
  .site-footer { padding: 16px 0; font-size: 12px; }
}

@media (max-width: 480px) {

  /* ── Even tighter on small phones ── */
  .container { padding: 0 12px; }
  .header-inner { min-height: 80px; }
  .logo { font-size: 15px; }
  .site-search input[type="text"] { max-width: 120px; font-size: 12px; }

  /* Product grid → 2 columns */
  .product-grid,
  .home-product-grid,
  .search-product-grid,
  .cat-product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .product-card { padding: 10px; }
  .product-image { height: 120px; }
  .product-image img { max-height: 100px; }
  .product-card h3 { font-size: 13px; }

  /* Hero */
  .hero { padding: 36px 12px; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 14px; }

  /* Product detail */
  .gallery .main-image { height: 240px; }
  .main-image img { max-height: 220px; }
  .info h1 { font-size: 20px; }
  .detail-price { font-size: 22px; }

  /* Cart table → hide redundant subtotal (price×qty is visible) */
  .cart-table .col-subtotal { display: none; }

  /* Checkout summary full width */
  .summary { padding: 14px; }
  .sum-row { font-size: 13px; }

  /* Full-width CTA buttons (page content only — not the chat widget) */
  main .btn, main button, main input[type="submit"] {
    width: 100%;
    text-align: center;
  }
  .cart-actions .btn,
  .cart-actions button { width: auto; }
}

/* Money never wraps inside cart cells */
.cart-table td:nth-child(2), .cart-table .col-subtotal { white-space: nowrap; }
