:root {
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-light: #eef2ff;
  --accent: #f59e0b;
  --radius: 14px;
}

body {
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: #f6f7fb;
  color: #1f2937;
}

/* ---------- Brand helpers ---------- */
.bg-brand { background: linear-gradient(90deg, var(--brand-dark), var(--brand)); }
.text-brand { color: var(--brand) !important; }
.link-brand { color: var(--brand); }
.link-brand:hover { color: var(--brand-dark); }

.btn-brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-brand:hover, .btn-brand:focus {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
}
.btn-brand:active { transform: translateY(0); }

.card { border-radius: var(--radius); }
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .15);
}

.navbar .nav-link { transition: color .15s; }
.navbar .dropdown-menu { border: 0; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12); }

.section-title { font-weight: 700; position: relative; padding-bottom: .4rem; }
.section-title::after {
  content: ''; position: absolute; left: 0; bottom: 0;
  width: 48px; height: 3px; border-radius: 3px; background: var(--accent);
}

/* ---------- Hero ---------- */
.hero {
  background: radial-gradient(circle at 80% 20%, #6366f1 0%, transparent 45%),
              linear-gradient(135deg, #1e1b4b 0%, #3730a3 55%, #4f46e5 100%);
  overflow: hidden;
}
.hero h1 { animation: slideUp .7s ease both; }
.hero .lead { animation: slideUp .7s .1s ease both; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.hero-grid img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius);
  background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  transition: transform .3s ease;
  animation: float 6s ease-in-out infinite;
}
.hero-grid a:nth-child(2) img { animation-delay: 1.5s; }
.hero-grid a:nth-child(3) img { animation-delay: 3s; }
.hero-grid a:nth-child(4) img { animation-delay: 4.5s; }
.hero-grid img:hover { transform: scale(1.04) rotate(-1deg); }

/* ---------- Features & categories ---------- */
.features > div { padding: 1.25rem .5rem; background: #fff; border-radius: var(--radius); border: 8px solid #f6f7fb; }
.features i { font-size: 2rem; color: var(--brand); display: block; margin-bottom: .4rem; }
.features h6 { margin-bottom: .1rem; font-weight: 600; }

.category-tile {
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  padding: 1.5rem 1rem; background: #fff; border-radius: var(--radius);
  color: #1f2937; box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: transform .2s ease, box-shadow .2s ease;
}
.category-tile i {
  font-size: 1.8rem; color: var(--brand); width: 60px; height: 60px;
  display: grid; place-items: center; border-radius: 50%; background: var(--brand-light);
  transition: background .2s, color .2s;
}
.category-tile:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(79,70,229,.15); color: var(--brand); }
.category-tile:hover i { background: var(--brand); color: #fff; }

/* ---------- Product cards ---------- */
.product-card { transition: transform .2s ease, box-shadow .2s ease; overflow: hidden; }
.product-card:hover { transform: translateY(-5px); box-shadow: 0 14px 30px rgba(0,0,0,.12) !important; }
.product-img-wrap { position: relative; display: block; background: #fff; overflow: hidden; }
.product-img-wrap img { aspect-ratio: 1; object-fit: contain; padding: .75rem; transition: transform .35s ease; }
.product-card:hover .product-img-wrap img { transform: scale(1.07); }
.product-card .card-title {
  font-size: .95rem; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.price { font-weight: 700; color: var(--brand); font-size: 1.05rem; }
.price-lg { font-weight: 700; color: var(--brand); }
.no-image { aspect-ratio: 1; display: grid; place-items: center; font-size: 3rem; color: #cbd5e1; background: #f1f5f9; }
.add-to-cart-form .btn.loading { pointer-events: none; opacity: .7; }

.detail-img img { width: 100%; aspect-ratio: 1; object-fit: contain; }

/* ---------- Quantity input ---------- */
.qty-group { max-width: 140px; flex-wrap: nowrap; }
.qty-group input::-webkit-outer-spin-button,
.qty-group input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-group input[type=number] { -moz-appearance: textfield; }

/* ---------- Sidebar list ---------- */
.category-pills { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; }
.category-pills::-webkit-scrollbar { display: none; }
.category-pills .btn { white-space: nowrap; border-radius: 999px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.list-group-item.active { background: var(--brand); border-color: var(--brand); }

.pagination .page-link { color: var(--brand); border-radius: 8px; margin: 0 2px; }
.pagination .active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Cart & checkout ---------- */
.cart-item { transition: background .2s; }
.cart-item:hover { background: #fafbff; }
.summary-card { position: sticky; top: 90px; }

.empty-state i { font-size: 4.5rem; color: #c7d2fe; }

.checkout-steps { display: flex; justify-content: center; gap: .5rem; flex-wrap: wrap; }
.checkout-steps .step {
  display: flex; align-items: center; gap: .5rem; padding: .45rem 1rem;
  border-radius: 999px; background: #fff; color: #6b7280; font-weight: 500; font-size: .9rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.checkout-steps .step span {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: #e5e7eb; font-size: .8rem;
}
.checkout-steps .step.active { color: var(--brand); }
.checkout-steps .step.active span { background: var(--brand); color: #fff; }
.checkout-steps .step.done span { background: #10b981; color: #fff; }

/* ---------- Orders ---------- */
.order-card { transition: transform .2s ease, box-shadow .2s ease; }
.order-card:hover { transform: translateX(4px); box-shadow: 0 8px 20px rgba(0,0,0,.08) !important; }

.status-pending { background: #fef3c7; color: #92400e; }
.status-processing { background: #dbeafe; color: #1e40af; }
.status-shipped { background: #e0e7ff; color: #3730a3; }
.status-delivered { background: #d1fae5; color: #065f46; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

.order-tracker { display: flex; justify-content: space-between; position: relative; background: #fff; border-radius: var(--radius); padding: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.track-step { flex: 1; text-align: center; position: relative; color: #9ca3af; font-size: .85rem; }
.track-step i {
  width: 44px; height: 44px; margin: 0 auto .35rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.2rem; background: #f3f4f6; position: relative; z-index: 1;
}
.track-step:not(:last-child)::after {
  content: ''; position: absolute; top: 22px; left: 50%; width: 100%; height: 3px; background: #e5e7eb;
}
.track-step.done { color: #059669; }
.track-step.done i { background: #10b981; color: #fff; }
.track-step.done:not(:last-child)::after { background: #10b981; }
.track-step.active { color: var(--brand); font-weight: 600; }
.track-step.active i { background: var(--brand); color: #fff; animation: pulse 1.8s infinite; }

/* ---------- Auth & result pages ---------- */
.auth-card { border-radius: 20px; }
.auth-icon {
  width: 70px; height: 70px; margin: 0 auto; border-radius: 50%;
  background: var(--brand-light); color: var(--brand);
  display: grid; place-items: center; font-size: 2rem;
}
.toggle-password {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  border: 0; color: #6b7280; z-index: 5;
}
.toggle-password-plain { top: 2.35rem; transform: none; }

.pay-methods { display: flex; justify-content: center; flex-wrap: wrap; gap: .5rem; }
.pay-methods span { background: #f3f4f6; border-radius: 999px; padding: .35rem .85rem; font-size: .85rem; }

.result-icon {
  width: 90px; height: 90px; margin: 0 auto; border-radius: 50%;
  display: grid; place-items: center; font-size: 3rem; color: #fff;
  animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) both;
}
.result-icon.success { background: #10b981; box-shadow: 0 0 0 12px #d1fae5; }
.result-icon.failed { background: #ef4444; box-shadow: 0 0 0 12px #fee2e2; }

/* ---------- Animations ---------- */
#cart-count.bump { animation: bump .4s ease; }
.reveal {
  opacity: 0; translate: 0 18px;
  transition: opacity .5s ease, translate .5s ease, transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
.reveal.visible { opacity: 1; translate: none; }

@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes bump { 0% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.5); } 100% { transform: translate(-50%, -50%) scale(1); } }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(79,70,229,.5); } 70% { box-shadow: 0 0 0 10px rgba(79,70,229,0); } 100% { box-shadow: 0 0 0 0 rgba(79,70,229,0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; translate: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .summary-card { position: static; }
  .navbar-collapse { padding-bottom: .75rem; }
}
@media (max-width: 575.98px) {
  .hero h1 { font-size: 2rem; }
  .product-card .card-body { padding: .75rem; }
  .product-card .card-title { font-size: .85rem; }
  .price { font-size: .95rem; }
  .track-step span { font-size: .7rem; }
  .track-step i { width: 36px; height: 36px; font-size: 1rem; }
  .track-step:not(:last-child)::after { top: 18px; }
  .category-tile { padding: 1rem .5rem; }
}

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