/* ============================================================
   MY STORE — Stylesheet
   Simple, beginner-friendly, mobile-first CSS.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --color-primary: #4f46e5;
  --color-primary-dark: #4338ca;
  --color-primary-light: #eef2ff;
  --color-accent: #f97316;
  --color-accent-dark: #ea580c;
  --color-text: #111827;
  --color-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-bg: #ffffff;
  --color-bg-soft: #f8fafc;
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-full: 999px;
  --max-width: 1120px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.06);
  --shadow-md: 0 8px 20px rgba(17, 24, 39, 0.08);
  --shadow-lg: 0 16px 40px rgba(17, 24, 39, 0.14);
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.logo {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.logo::before {
  content: "🛍️";
  font-size: 1.15rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-weight: 600;
  font-size: 0.95rem;
}

.main-nav a {
  color: var(--color-muted);
  transition: color 0.15s ease;
}

.main-nav a:hover {
  color: var(--color-primary);
}

.cart-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--color-text) !important;
}

.cart-badge {
  background: var(--color-accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius-full);
  padding: 13px 26px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  width: 100%;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.32);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #fff;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-bg-soft);
  border-color: #d1d5db;
}

.btn-large {
  padding: 16px 28px;
  font-size: 1.08rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  background: linear-gradient(135deg, #4f46e5 0%, #6d28d9 60%, #4338ca 100%);
  color: #fff;
  text-align: center;
  padding: 88px 20px;
  overflow: hidden;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
  opacity: 0.25;
  background: #fff;
}

.hero::before {
  width: 280px;
  height: 280px;
  top: -120px;
  left: -80px;
}

.hero::after {
  width: 340px;
  height: 340px;
  bottom: -160px;
  right: -100px;
  background: var(--color-accent);
  opacity: 0.3;
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  margin: 0 0 14px;
  letter-spacing: -0.5px;
}

.hero p {
  font-size: 1.15rem;
  margin: 0 0 32px;
  opacity: 0.92;
}

.hero .btn-primary {
  width: auto;
  background: var(--color-accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.hero .btn-primary:hover {
  background: var(--color-accent-dark);
}

/* ---------- Sections ---------- */

.section {
  padding: 56px 0;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0 0 32px;
  text-align: center;
  letter-spacing: -0.3px;
}

/* ---------- Loading state ---------- */

.loading-state {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 0;
  color: var(--color-muted);
  font-weight: 600;
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Product Grid ---------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 26px;
}

.product-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.product-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: transparent;
}

.product-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--color-bg-soft);
}

.product-info {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.product-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.product-description {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
  flex: 1;
}

.product-price {
  margin: 4px 0 6px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-primary);
}

/* ---------- Cart Page ---------- */

.cart-item {
  display: grid;
  grid-template-columns: 74px 1fr auto auto auto;
  align-items: center;
  gap: 16px;
  padding: 18px 4px;
  border-bottom: 1px solid var(--color-border);
}

.cart-item-image {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--color-bg-soft);
}

.cart-item-details h4 {
  margin: 0 0 4px;
  font-weight: 700;
}

.cart-item-details p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.cart-item-quantity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qty-btn {
  width: 30px;
  height: 30px;
  border: 1.5px solid var(--color-border);
  background: #fff;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  color: var(--color-text);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.qty-btn:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.cart-item-subtotal {
  font-weight: 800;
  min-width: 80px;
  text-align: right;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--color-danger);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
}

.btn-remove:hover {
  text-decoration: underline;
}

.empty-cart {
  text-align: center;
  padding: 60px 0;
  color: var(--color-muted);
  font-size: 1.05rem;
}

.empty-cart a {
  color: var(--color-primary);
  font-weight: 700;
}

.cart-summary {
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 26px;
  margin-top: 26px;
  box-shadow: var(--shadow-sm);
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 1rem;
}

.cart-summary-row.total {
  font-size: 1.3rem;
  font-weight: 800;
  border-top: 1px solid var(--color-border);
  margin-top: 8px;
  padding-top: 16px;
  color: var(--color-primary);
}

.cart-actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.cart-actions .btn {
  flex: 1;
  min-width: 160px;
}

/* ---------- Checkout Page ---------- */

.checkout-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 800px) {
  .checkout-layout {
    grid-template-columns: 1.3fr 1fr;
  }
}

.checkout-summary {
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 26px;
  height: fit-content;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 90px;
}

.checkout-item {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.95rem;
}

.checkout-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.3rem;
  font-weight: 800;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid var(--color-border);
  color: var(--color-primary);
}

.checkout-total-qty {
  color: var(--color-muted);
  font-size: 0.9rem;
  font-weight: 400;
  margin-top: 4px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 15px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 520px) {
  .form-row-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.error-message {
  color: var(--color-danger);
  font-size: 0.85rem;
  margin-top: 4px;
  display: block;
  min-height: 1em;
}

.payment-method-box {
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-primary-light);
  font-weight: 600;
}

.confirm-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}

.confirm-row input {
  margin-top: 4px;
  width: auto;
}

.confirm-row label {
  font-size: 0.95rem;
}

/* ---------- Order Success ---------- */

.order-success {
  text-align: center;
  padding: 60px 20px;
  max-width: 520px;
  margin: 0 auto;
}

.order-success .icon {
  font-size: 3.2rem;
  margin-bottom: 12px;
}

.order-success h1 {
  font-weight: 800;
  letter-spacing: -0.3px;
}

.order-details {
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 28px 0;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.order-details-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.order-details-row:last-child {
  border-bottom: none;
}

.order-details-row .label {
  color: var(--color-muted);
}

.order-details-row .value {
  font-weight: 800;
  text-align: right;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 28px 0;
  margin-top: 48px;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.9rem;
}

/* ---------- Utilities ---------- */

.text-center {
  text-align: center;
}

@media (max-width: 640px) {
  .checkout-summary {
    position: static;
  }

  .cart-item {
    grid-template-columns: 60px 1fr;
    grid-template-areas:
      "image details"
      "image quantity"
      "image subtotal"
      "image remove";
    row-gap: 8px;
  }

  .cart-item-image { grid-area: image; }
  .cart-item-details { grid-area: details; }
  .cart-item-quantity { grid-area: quantity; }

  .cart-item-subtotal {
    grid-area: subtotal;
    text-align: left;
  }

  .btn-remove {
    grid-area: remove;
    text-align: left;
    justify-self: start;
  }
}
