/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:    #5c6ac4;
  --brand-dk: #3f4eae;
  --danger:   #d72c0d;
  --success:  #108043;
  --text:     #1a1a2e;
  --muted:    #6b7280;
  --border:   #e5e7eb;
  --bg:       #f9fafb;
  --card:     #ffffff;
  --radius:   10px;
}

body { font-family: system-ui, sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

/* ── Header ── */
.site-header { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; }
.logo { font-size: 1.3rem; font-weight: 700; color: var(--brand); }
nav { display: flex; gap: 1.5rem; align-items: center; font-weight: 500; }
.cart-link { position: relative; }
.cart-badge {
  position: absolute; top: -8px; right: -12px;
  background: var(--brand); color: #fff;
  font-size: .65rem; font-weight: 700;
  border-radius: 99px; padding: 1px 5px;
}

/* ── Flash messages ── */
.flash-messages { margin: 1rem auto; }
.flash { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: .5rem; font-size: .9rem; }
.flash-success { background: #d4edda; color: var(--success); border: 1px solid #b8dfc4; }
.flash-error   { background: #fde8e8; color: var(--danger);  border: 1px solid #f5c0c0; }
.flash-info    { background: #e0f0ff; color: #0c5dab;        border: 1px solid #b3d4f5; }

/* ── Main ── */
main.container { padding-top: 2rem; padding-bottom: 4rem; }

/* ── Hero ── */
.hero { text-align: center; padding: 3rem 1rem 2.5rem; }
.hero h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: .5rem; }
.hero p { color: var(--muted); font-size: 1.1rem; }

/* ── Shop controls (search + categories) ── */
.shop-controls { margin-bottom: 1.75rem; display: flex; flex-direction: column; gap: 1rem; }

.search-form { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.search-input-wrap { position: relative; flex: 1; min-width: 220px; }
.search-icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-input { width: 100%; padding: .55rem .75rem .55rem 2.2rem; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; }
.search-input:focus { outline: 2px solid var(--brand); border-color: transparent; }

.category-tabs { display: flex; flex-wrap: wrap; gap: .4rem; }
.cat-tab { padding: .3rem .85rem; border-radius: 99px; font-size: .8rem; font-weight: 600; color: var(--muted); background: var(--card); border: 1px solid var(--border); text-decoration: none; transition: background .15s, color .15s; }
.cat-tab:hover { background: var(--border); color: var(--text); text-decoration: none; }
.cat-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.results-summary { font-size: .9rem; color: var(--muted); margin-bottom: 1rem; }

/* ── Pagination ── */
.pagination { display: flex; justify-content: center; align-items: center; gap: .4rem; margin-top: 2.5rem; flex-wrap: wrap; }
.page-btn { display: inline-block; padding: .45rem .8rem; border-radius: 6px; border: 1px solid var(--border); background: var(--card); font-size: .9rem; font-weight: 500; color: var(--text); text-decoration: none; transition: background .15s; }
.page-btn:hover { background: var(--border); text-decoration: none; }
.page-btn--active { background: var(--brand); color: #fff; border-color: var(--brand); }
.page-btn--disabled { color: var(--muted); pointer-events: none; }
.page-btn--gap { border: none; background: none; color: var(--muted); }

.empty-state { text-align: center; padding: 4rem 1rem; color: var(--muted); font-size: 1.1rem; }

/* ── Product grid ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s;
}
.product-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.08); }

/* ── Placeholder images ── */
.placeholder-img {
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; font-weight: 800; color: var(--brand);
  height: 180px;
}
.placeholder-img--large { height: 360px; border-radius: var(--radius); font-size: 6rem; }
.placeholder-img--small { height: 64px; width: 64px; min-width: 64px; border-radius: 8px; font-size: 1.5rem; }

.product-img-link { display: block; }
.product-img { width: 100%; height: 180px; object-fit: cover; display: block; }
.product-detail-img { width: 100%; height: 400px; object-fit: cover; border-radius: var(--radius); display: block; }
.cart-item-img { width: 64px; height: 64px; min-width: 64px; object-fit: cover; border-radius: 8px; display: block; }

.product-info { padding: 1rem; display: flex; flex-direction: column; flex: 1; gap: .4rem; }
.product-category { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.product-info h2 { font-size: 1rem; font-weight: 600; }
.product-info h2 a { color: var(--text); }
.product-info h2 a:hover { color: var(--brand); text-decoration: none; }
.product-desc { font-size: .85rem; color: var(--muted); flex: 1; }
.product-footer { display: flex; align-items: center; justify-content: space-between; margin-top: .5rem; }
.product-price { font-size: 1.15rem; font-weight: 700; }
.product-price--large { font-size: 2rem; font-weight: 800; }

/* ── Buttons ── */
.btn {
  display: inline-block; cursor: pointer; border: none;
  padding: .5rem 1rem; border-radius: 6px; font-size: .9rem;
  font-weight: 600; transition: background .15s, opacity .15s;
}
.btn-primary  { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dk); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger   { background: #fde8e8; color: var(--danger); }
.btn-danger:hover { background: #fcc; }
.btn--large   { padding: .75rem 1.75rem; font-size: 1rem; }
.btn--small   { padding: .3rem .65rem; font-size: .8rem; }
.btn--full    { width: 100%; text-align: center; padding: .85rem; font-size: 1rem; }

/* ── Product detail ── */
.breadcrumb { margin-bottom: 1.5rem; font-size: .85rem; color: var(--muted); }
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }
@media (max-width: 680px) { .product-detail { grid-template-columns: 1fr; } }
.product-detail-info { display: flex; flex-direction: column; gap: .75rem; }
.product-detail-info h1 { font-size: 1.8rem; font-weight: 800; }
.product-full-desc { color: var(--muted); }
.add-form { display: flex; align-items: center; gap: .75rem; margin-top: .5rem; flex-wrap: wrap; }
.add-form label { font-weight: 600; }
.qty-input { width: 60px; padding: .4rem .5rem; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; text-align: center; }

/* ── Cart ── */
.cart-layout { display: grid; grid-template-columns: 1fr 320px; gap: 2rem; align-items: start; }
@media (max-width: 780px) { .cart-layout { grid-template-columns: 1fr; } }

.cart-items { display: flex; flex-direction: column; gap: 1rem; }
.cart-row {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.cart-item-details { flex: 1; display: flex; flex-direction: column; gap: .2rem; font-weight: 600; }
.cart-item-details a { color: var(--text); }
.cart-qty-form { display: flex; gap: .4rem; align-items: center; }
.cart-subtotal { font-weight: 700; min-width: 70px; text-align: right; }

.cart-summary {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  display: flex; flex-direction: column; gap: 1rem;
  position: sticky; top: 80px;
}
.cart-summary h2 { font-size: 1.1rem; }
.summary-row { display: flex; justify-content: space-between; font-size: .95rem; }
.summary-row--total { font-weight: 800; font-size: 1.1rem; border-top: 1px solid var(--border); padding-top: .75rem; }
.continue-link { text-align: center; font-size: .85rem; color: var(--muted); }

.empty-cart { text-align: center; padding: 4rem 1rem; display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
.empty-cart p { font-size: 1.2rem; color: var(--muted); }

/* ── Success ── */
.success-page { text-align: center; padding: 5rem 1rem; display: flex; flex-direction: column; align-items: center; gap: 1.25rem; }
.success-icon { width: 80px; height: 80px; background: #d4edda; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; color: var(--success); }
.success-page h1 { font-size: 2rem; font-weight: 800; }
.session-id { font-size: .8rem; color: var(--muted); }
.session-id code { background: var(--border); padding: .2rem .4rem; border-radius: 4px; }

/* ── User menu ── */
.user-menu { display: flex; align-items: center; gap: .5rem; }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.user-name { font-weight: 600; font-size: .9rem; }

/* ── Checkout ── */
.checkout-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 1.5rem; }

.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 820px) { .checkout-layout { grid-template-columns: 1fr; } }

.checkout-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.checkout-section h2 { font-size: 1rem; font-weight: 700; margin-bottom: 1.1rem; }

.checkout-main .form-group { margin-bottom: .9rem; }
.checkout-main .form-group label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: .3rem; }
.checkout-main .form-group input,
.checkout-main .form-group select {
  width: 100%; padding: .55rem .75rem;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: .95rem; font-family: inherit;
}
.checkout-main .form-group input:focus,
.checkout-main .form-group select:focus { outline: 2px solid var(--brand); border-color: transparent; }
.form-row-3 { display: grid; grid-template-columns: 1fr .6fr 1fr; gap: .75rem; }
@media (max-width: 500px) { .form-row-3 { grid-template-columns: 1fr; } }
.req { color: var(--danger); }

/* Shipping options */
.shipping-options { display: flex; flex-direction: column; gap: .6rem; }
.shipping-option {
  display: flex; align-items: center; gap: 1rem;
  border: 2px solid var(--border); border-radius: 8px;
  padding: .85rem 1rem; cursor: pointer; transition: border-color .15s;
}
.shipping-option input[type="radio"] { accent-color: var(--brand); width: 16px; height: 16px; flex-shrink: 0; }
.shipping-option.selected { border-color: var(--brand); background: #f0f2ff; }
.shipping-option-info { flex: 1; display: flex; flex-direction: column; gap: .1rem; }
.shipping-label { font-weight: 600; font-size: .9rem; }
.shipping-days { font-size: .8rem; color: var(--muted); }
.shipping-price { font-weight: 700; font-size: .95rem; white-space: nowrap; }

/* Summary */
.checkout-summary { position: sticky; top: 80px; }
.summary-items { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.summary-item { display: flex; align-items: center; gap: .75rem; }
.summary-item-img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.summary-item-details { flex: 1; display: flex; flex-direction: column; gap: .1rem; }
.summary-item-name { font-size: .9rem; font-weight: 600; }
.summary-item-qty { font-size: .8rem; color: var(--muted); }
.summary-item-price { font-weight: 600; font-size: .9rem; white-space: nowrap; }

/* ── Auth pages ── */
.auth-page { display: flex; justify-content: center; padding: 3rem 1rem; }
.auth-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2.25rem 2rem;
  width: 100%; max-width: 420px;
  display: flex; flex-direction: column; gap: 1rem;
}
.auth-card h1 { font-size: 1.5rem; font-weight: 800; }
.auth-subtitle { font-size: .9rem; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: .9rem; }
.auth-form .form-group { display: flex; flex-direction: column; gap: .3rem; }
.auth-form label { font-weight: 600; font-size: .9rem; }
.label-hint { font-weight: 400; color: var(--muted); }
.auth-form input {
  padding: .55rem .75rem; border: 1px solid var(--border);
  border-radius: 6px; font-size: .95rem; width: 100%;
}
.auth-form input:focus { outline: 2px solid var(--brand); border-color: transparent; }

.auth-divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .85rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  padding: .6rem 1rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); font-weight: 600; font-size: .9rem; color: var(--text);
  text-decoration: none; transition: background .15s;
}
.btn-google:hover { background: var(--bg); text-decoration: none; }

/* ── Footer ── */
.site-footer { border-top: 1px solid var(--border); background: var(--card); margin-top: 4rem; }
.site-footer .container { padding: 1.5rem 1.25rem; text-align: center; font-size: .85rem; color: var(--muted); }
