/* ============================================================
   Ecom Store - Default Theme Stylesheet
   ============================================================ */

:root {
  --primary:   #2563eb;
  --primary-d: #1d4ed8;
  --secondary: #f59e0b;
  --dark:      #1e293b;
  --text:      #374151;
  --muted:     #6b7280;
  --border:    #e5e7eb;
  --bg:        #f9fafb;
  --white:     #ffffff;
  --danger:    #ef4444;
  --success:   #22c55e;
  --info:      #3b82f6;
  --radius:    8px;
  --shadow:    0 1px 3px rgba(0,0,0,.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--white);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ---- Utility ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.mt-1  { margin-top: .25rem; }  .mt-2 { margin-top: .5rem; }
.mt-3  { margin-top: .75rem; } .mt-4 { margin-top: 1rem; }
.mb-4  { margin-bottom: 1rem; }
.d-flex { display: flex; }
.gap-2  { gap: .5rem; }
.gap-3  { gap: .75rem; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ---- Alert / Flash ---- */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1.4rem; border-radius: var(--radius);
  font-size: .9rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all .2s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary   { background: var(--primary);   color: #fff; }
.btn-primary:hover   { background: var(--primary-d); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-outline   { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-sm { padding: .35rem .8rem; font-size: .8rem; }
.btn-lg { padding: .8rem 2rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: .4rem; font-size: .9rem; }
.form-control {
  width: 100%; padding: .6rem .9rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .95rem; color: var(--text); background: var(--white);
  transition: border-color .2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-error { color: var(--danger); font-size: .82rem; margin-top: .25rem; }

/* ---- Navbar ---- */
.navbar {
  background: var(--white);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  position: sticky; top: 0; z-index: 100;
}
.navbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1rem; max-width: 1200px; margin: 0 auto; gap: 1rem;
}
.navbar-brand {
  font-size: 1.4rem; font-weight: 700; color: var(--dark);
  text-decoration: none; white-space: nowrap;
}
.navbar-brand:hover { text-decoration: none; color: var(--primary); }
.navbar-search { flex: 1; max-width: 500px; }
.navbar-search form { display: flex; gap: .4rem; }
.navbar-search input {
  flex: 1; padding: .5rem .9rem; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: .9rem;
}
.navbar-search button {
  padding: .5rem 1rem; background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius); cursor: pointer;
}
.navbar-actions { display: flex; align-items: center; gap: 1rem; }
.navbar-actions a { color: var(--text); font-size: .9rem; font-weight: 500; white-space: nowrap; }
.navbar-actions a:hover { color: var(--primary); text-decoration: none; }
.cart-badge {
  background: var(--primary); color: #fff;
  border-radius: 50%; padding: .1rem .45rem; font-size: .7rem;
  font-weight: 700; margin-left: .15rem;
}

/* Category nav bar */
.category-bar {
  background: var(--dark); color: #fff;
}
.category-bar .container {
  display: flex; gap: .1rem; overflow-x: auto;
  scrollbar-width: none;
}
.category-bar a {
  color: rgba(255,255,255,.85); padding: .6rem 1rem;
  font-size: .88rem; white-space: nowrap;
  display: block; transition: background .2s;
}
.category-bar a:hover { background: rgba(255,255,255,.1); text-decoration: none; color: #fff; }

/* ---- Hero / Banner ---- */
.hero-banner {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff; text-align: center; padding: 4rem 1rem;
}
.hero-banner h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 1rem; }
.hero-banner p  { font-size: 1.15rem; opacity: .9; margin-bottom: 2rem; }
.hero-banner img { width: 100%; max-height: 400px; object-fit: cover; border-radius: var(--radius); }

/* ---- Section ---- */
.section { padding: 3rem 0; }
.section-title { font-size: 1.5rem; font-weight: 700; color: var(--dark); margin-bottom: 1.5rem; }
.section-title span { color: var(--primary); }

/* ---- Product Grid ---- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}
.product-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--white); overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.product-card-image {
  aspect-ratio: 1; overflow: hidden; background: var(--bg);
}
.product-card-image img {
  width: 100%; height: 100%; object-fit: cover; transition: transform .3s;
}
.product-card:hover .product-card-image img { transform: scale(1.05); }
.product-card-body { padding: .9rem; }
.product-card-title { font-size: .95rem; font-weight: 600; color: var(--dark); margin-bottom: .4rem; line-height: 1.3; }
.product-card-title a { color: inherit; text-decoration: none; }
.product-card-title a:hover { color: var(--primary); }
.product-price { font-size: 1.05rem; font-weight: 700; color: var(--primary); }
.product-price .old-price { font-size: .85rem; text-decoration: line-through; color: var(--muted); font-weight: 400; margin-right: .4rem; }
.product-badge {
  display: inline-block; padding: .15rem .5rem;
  border-radius: 4px; font-size: .75rem; font-weight: 600; margin-bottom: .4rem;
}
.badge-sale     { background: #fee2e2; color: #991b1b; }
.badge-new      { background: #dcfce7; color: #166534; }
.badge-featured { background: #fef9c3; color: #854d0e; }
.badge-oos      { background: #f3f4f6; color: var(--muted); }
.product-card-footer { padding: .6rem .9rem .9rem; }

/* ---- Product Detail ---- */
.product-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }
.product-detail-gallery { position: relative; }
.product-main-image { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); aspect-ratio: 1; object-fit: cover; }
.product-thumbs { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.product-thumb { width: 70px; height: 70px; object-fit: cover; border-radius: 4px; border: 2px solid transparent; cursor: pointer; }
.product-thumb.active, .product-thumb:hover { border-color: var(--primary); }
.product-detail-title { font-size: 1.8rem; font-weight: 700; color: var(--dark); margin-bottom: .5rem; }
.product-detail-price { font-size: 2rem; font-weight: 700; color: var(--primary); margin-bottom: 1rem; }
.product-detail-price .old { font-size: 1.2rem; text-decoration: line-through; color: var(--muted); font-weight: 400; }
.product-description { color: var(--text); line-height: 1.8; }
.qty-input { width: 80px; text-align: center; padding: .5rem; border: 1px solid var(--border); border-radius: var(--radius); }
.product-video { margin-top: 2rem; }
.product-video iframe { width: 100%; aspect-ratio: 16/9; border-radius: var(--radius); border: none; }

/* ---- Breadcrumb ---- */
.breadcrumb { display: flex; gap: .5rem; align-items: center; font-size: .88rem; color: var(--muted); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--border); }

/* ---- Sidebar Filters ---- */
.shop-layout { display: grid; grid-template-columns: 240px 1fr; gap: 2rem; align-items: start; }
.filter-sidebar { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.filter-section { margin-bottom: 1.5rem; }
.filter-section h4 { font-size: .95rem; font-weight: 600; margin-bottom: .75rem; color: var(--dark); }

/* ---- Cart ---- */
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th, .cart-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); }
.cart-table th { background: var(--bg); font-weight: 600; font-size: .88rem; }
.cart-item-image { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; }
.cart-summary { background: var(--bg); border-radius: var(--radius); padding: 1.5rem; }
.cart-summary-row { display: flex; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.cart-summary-row:last-child { border: none; font-size: 1.1rem; font-weight: 700; }

/* ---- Checkout ---- */
.checkout-grid { display: grid; grid-template-columns: 1fr 360px; gap: 2rem; align-items: start; }

/* ---- Order Success ---- */
.order-success-icon { font-size: 4rem; color: var(--success); margin-bottom: 1rem; }

/* ---- Reviews ---- */
.review-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.star { color: var(--secondary); }

/* ---- Pagination ---- */
.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 2rem; }
.pagination a, .pagination span {
  padding: .45rem .85rem; border-radius: var(--radius);
  border: 1px solid var(--border); font-size: .88rem;
}
.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { color: var(--muted); pointer-events: none; }

/* ---- Footer ---- */
footer {
  background: var(--dark); color: rgba(255,255,255,.8);
  padding: 3rem 0 1.5rem;
}
footer h5 { color: #fff; font-size: 1rem; margin-bottom: 1rem; }
footer a { color: rgba(255,255,255,.7); font-size: .9rem; }
footer a:hover { color: #fff; text-decoration: none; }
footer ul { list-style: none; }
footer ul li { margin-bottom: .4rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 1.5rem; text-align: center; font-size: .85rem; }

/* ---- Account ---- */
.account-layout { display: grid; grid-template-columns: 240px 1fr; gap: 2rem; }
.account-sidebar { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.account-nav a {
  display: block; padding: .6rem .9rem; border-radius: 4px;
  color: var(--text); font-size: .92rem; margin-bottom: .2rem;
}
.account-nav a:hover, .account-nav a.active { background: var(--primary); color: #fff; text-decoration: none; }

/* ---- Status Badges ---- */
.status { display: inline-block; padding: .2rem .65rem; border-radius: 20px; font-size: .78rem; font-weight: 600; }
.status-pending    { background: #fef9c3; color: #854d0e; }
.status-confirmed  { background: #dbeafe; color: #1e40af; }
.status-processing { background: #ede9fe; color: #4c1d95; }
.status-shipped    { background: #e0f2fe; color: #0369a1; }
.status-delivered  { background: #dcfce7; color: #166534; }
.status-cancelled  { background: #fee2e2; color: #991b1b; }
.status-refunded   { background: #f3f4f6; color: #374151; }
.status-paid       { background: #dcfce7; color: #166534; }
.status-failed     { background: #fee2e2; color: #991b1b; }

/* ---- Card ---- */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); font-weight: 600; }
.card-body { padding: 1.25rem; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .product-detail-grid { grid-template-columns: 1fr; }
  .shop-layout { grid-template-columns: 1fr; }
  .checkout-grid { grid-template-columns: 1fr; }
  .account-layout { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero-banner h1 { font-size: 1.8rem; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .navbar-search { display: none; }
}
