/* KaanCart default storefront theme — mobile-first, no build step required. */
:root {
  --primary: #0f766e;
  --accent: #f59e0b;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 12px rgba(15, 23, 42, .05);
  --font: "Noto Sans", "Noto Sans Tamil", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; font-size: 16px; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand img { height: 36px; width: auto; }
.search { flex: 1; display: flex; order: 3; width: 100%; }
.search input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius) 0 0 var(--radius); font: inherit; }
.search button { padding: 0 14px; border: 0; background: var(--primary); color: #fff; border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.header-row { flex-wrap: wrap; }
.cart-link { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; background: var(--primary); color: #fff; font-weight: 600; }
.cart-link:hover { text-decoration: none; filter: brightness(1.05); }
.badge { background: var(--accent); color: #111; border-radius: 999px; padding: 0 7px; font-size: .8rem; font-weight: 700; }
.lang a { font-size: .9rem; color: var(--muted); padding: 4px 6px; }
.lang a.active { color: var(--text); font-weight: 700; }
.nav { display: flex; gap: 4px; overflow-x: auto; padding: 0 0 8px; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { white-space: nowrap; padding: 6px 12px; border-radius: 999px; color: var(--text); background: var(--bg); font-size: .92rem; }
.nav a:hover { background: var(--border); text-decoration: none; }

/* Layout */
main { padding: 16px 0 40px; min-height: 60vh; }
.section { margin: 24px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.alert { padding: 12px 14px; border-radius: var(--radius); margin: 0 0 16px; }
.alert-success { background: #dcfce7; color: #14532d; }
.alert-error { background: #fee2e2; color: #7f1d1d; }
.breadcrumbs { font-size: .875rem; color: var(--muted); margin-bottom: 12px; }

/* Hero / banners */
.hero { border-radius: var(--radius); padding: 32px 20px; color: #fff; background: linear-gradient(135deg, var(--primary), #134e4a); background-size: cover; background-position: center; position: relative; overflow: hidden; }
.hero.has-image::before { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.35); }
.hero > * { position: relative; }
.hero h1 { font-size: 1.75rem; }
.hero p { opacity: .92; max-width: 560px; }
.banner img { border-radius: var(--radius); width: 100%; }

/* Grids */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cat-grid { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cat-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; text-align: center; color: var(--text); font-size: .9rem; }
.cat-tile img, .cat-tile .ph { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--bg); }
.ph { display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; font-size: 1.4rem; background: #eef2f7; }

/* Product card */
.product-card { display: flex; flex-direction: column; overflow: hidden; color: var(--text); height: 100%; }
.product-card:hover { text-decoration: none; box-shadow: 0 6px 20px rgba(15,23,42,.1); }
.product-card .thumb { aspect-ratio: 1 / 1; background: #eef2f7; overflow: hidden; }
.product-card .thumb img, .product-card .thumb .ph { width: 100%; height: 100%; object-fit: cover; }
.product-card .info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product-card .name { font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-weight: 700; }
.price del { color: var(--muted); font-weight: 400; font-size: .85em; margin-left: 6px; }
.tag { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: #fee2e2; color: #991b1b; }
.tag-ok { background: #dcfce7; color: #166534; }

/* Product page */
.product-layout { display: grid; gap: 20px; }
.gallery-main { aspect-ratio: 1 / 1; border-radius: var(--radius); overflow: hidden; background: #eef2f7; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.thumbs img.active { border-color: var(--primary); }
.variant-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.variant-list label { border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; cursor: pointer; background: var(--surface); }
.variant-list input { position: absolute; opacity: 0; }
.variant-list input:checked + span { font-weight: 700; color: var(--primary); }
.variant-list label:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.variant-list label:has(input:disabled) { opacity: .5; text-decoration: line-through; }
.prose { overflow-wrap: anywhere; }
.prose img { border-radius: 8px; }
.sticky-buy { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0; border-top: 1px solid var(--border); display: flex; gap: 8px; }

/* Forms & buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 18px; border-radius: var(--radius); border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-accent { background: var(--accent); color: #111; }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; color: var(--danger); cursor: pointer; font: inherit; padding: 0; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-weight: 600; font-size: .9rem; }
.field input, .field select, .field textarea, .qty { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font: inherit; background: #fff; }
.field .error { color: var(--danger); font-size: .85rem; }
.row-2 { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
.qty { width: 80px; text-align: center; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

/* Cart & checkout */
.cart-line { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cart-line img, .cart-line .ph { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; }
.cart-line .actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.summary dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: right; }
.summary .total { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.summary .discount { color: #0a7d32; }
.codes { margin-top: 14px; display: grid; gap: 8px; }
.code-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.code-form input:not([type=checkbox]) { flex: 1; min-width: 0; }
.code-chip { display: flex; gap: 8px; align-items: center; }
.error { color: #b42318; }
.checkout-layout, .cart-layout { display: grid; gap: 16px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0 8px 16px; border-left: 2px solid var(--border); }

/* Toolbar & pagination */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar select { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); font: inherit; }
.pagination { display: flex; gap: 6px; justify-content: center; margin: 24px 0; flex-wrap: wrap; list-style: none; padding: 0; }
.pagination a, .pagination span { display: inline-block; min-width: 40px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; text-align: center; background: var(--surface); }
.pagination .active span { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled span { color: var(--muted); }

/* Footer */
.site-footer { background: #0f172a; color: #cbd5e1; padding: 28px 0; font-size: .92rem; }
.site-footer a { color: #e2e8f0; }
.footer-grid { display: grid; gap: 16px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin: 4px 0; }

/* Vendor shop header */
.vendor-hero { position: relative; overflow: hidden; margin-bottom: 16px; background: linear-gradient(135deg, var(--primary), #134e4a); background-size: cover; background-position: center; color: #fff; }
.vendor-hero::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .35); }
.vendor-hero-inner { position: relative; display: flex; gap: 16px; align-items: center; padding: 24px 20px; }
.vendor-hero h1 { margin: 0 0 4px; }
.vendor-hero p { margin: 0 0 4px; opacity: .92; }
.vendor-logo { width: 72px; height: 72px; border-radius: 16px; object-fit: cover; background: #fff; color: var(--primary); flex-shrink: 0; font-size: 2rem; }

/* Listings with filters */
.listing { display: grid; gap: 16px; }
.listing-main { min-width: 0; }
.filters { padding: 12px 14px; }
.filters summary { cursor: pointer; display: flex; align-items: center; gap: 8px; list-style: none; }
.filters summary::-webkit-details-marker { display: none; }
.filters summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.filter-form { display: grid; gap: 12px; margin-top: 12px; }
.filter-form fieldset { border: 0; border-top: 1px solid var(--border); padding: 10px 0 0; margin: 0; display: grid; gap: 4px; }
.filter-form legend { font-weight: 600; font-size: .9rem; padding: 0; margin-bottom: 4px; }
.filter-form .check { display: flex; gap: 8px; align-items: center; font-size: .92rem; cursor: pointer; }
.price-range { display: flex; gap: 6px; align-items: center; }
.price-range input { width: 100%; min-width: 0; padding: 8px; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.seller { display: block; }
.seller-line a { color: var(--primary); }
.specs { width: 100%; border-collapse: collapse; font-size: .95rem; }
.specs td, .specs th { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.specs td:first-child { color: var(--muted); width: 40%; }
.specs .spec-group th { background: var(--bg); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.thumb img, .gallery-main img { background: #eef2f7; }

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .row-2 { grid-template-columns: 1fr 1fr; }
  .hero { padding: 48px 36px; }
  .hero h1 { font-size: 2.25rem; }
}
@media (min-width: 900px) {
  h1 { font-size: 1.85rem; }
  .search { order: 0; width: auto; max-width: 520px; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cat-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .product-layout { grid-template-columns: 1fr 1fr; gap: 32px; }
  .sticky-buy { position: static; border: 0; padding: 0; }
  .checkout-layout { grid-template-columns: 1.4fr 1fr; align-items: start; }
  .cart-layout { grid-template-columns: 1.6fr 1fr; align-items: start; }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
  .listing { grid-template-columns: 250px minmax(0, 1fr); align-items: start; }
  .listing aside { position: sticky; top: 100px; }
  .listing .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters[open] summary::after, .filters summary::after { content: ""; }
  .summary { position: sticky; top: 90px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.delivery-check { margin-top: 12px; }
.account-stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 12px 0; }
.account-stats .card { display: flex; flex-direction: column; gap: 4px; }
.order-row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: inherit; text-decoration: none; }
.address { border-bottom: 1px solid var(--border); padding: 8px 0; }
.stars { color: #f59e0b; letter-spacing: 1px; }
.review { border-top: 1px solid var(--border); padding: 12px 0; }
.wish-btn { background: none; border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.wish-btn.on { color: #e11d48; border-color: #e11d48; }
.account-link { font-size: 1.2rem; text-decoration: none; }
.announcement { background: var(--primary); color: #fff; text-align: center; padding: 6px 12px; font-size: .9rem; }
.site-header[data-style="centered"] .header-row { justify-content: center; flex-wrap: wrap; }
.site-header[data-style="centered"] .brand { width: 100%; text-align: center; }
.site-header[data-style="compact"] .header-row { padding-top: 4px; padding-bottom: 4px; }
.footer-note { opacity: .8; padding-top: 8px; }
