:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --text-subtle: #64748b;
  --border: #e2e8f0;
  --primary: #9333ea;
  --primary-hover: #7e22ce;
  --primary-light: #f3e8ff;
  --radius: 12px;
}

html.dark {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f8fafc;
  --text-subtle: #94a3b8;
  --border: #334155;
  --primary-light: #3b0764;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease,
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s ease;
}

body {
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Navbar */
.header {
  position: sticky;
  top: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  z-index: 40;
  backdrop-filter: blur(8px);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.logo-box {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.site-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-title {
  font-weight: bold;
  color: var(--primary);
  display: block;
}

.brand-subtitle {
  font-size: 0.7rem;
  color: var(--text-subtle);
}

.nav-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Badge */
.relative {
  position: relative;
}

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  font-size: 0.7rem;
  font-weight: bold;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(147, 51, 234, 0.4);
}

.btn-primary:active,
.btn-icon:active,
.cat-btn:active {
  transform: scale(0.95);
}

.btn-icon {
  background: var(--card);
  border: 1px solid var(--border);
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.btn-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

/* Layout */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  flex: 1;
  width: 100%;
}

.hero {
  background: linear-gradient(135deg, #9333ea, #4f46e5);
  color: white;
  padding: 1.75rem 1.25rem;
  border-radius: 16px;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 25px -5px rgba(147, 51, 234, 0.3);
  animation: slideDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-tag {
  background: rgba(255, 255, 255, 0.2);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  display: inline-block;
  backdrop-filter: blur(4px);
}

.hero h1 {
  font-size: 1.4rem;
  margin: 8px 0;
}

.hero p {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Categories Bar */
.section-group {
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1rem;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.categories-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 10px 2px;
  scrollbar-width: thin;
}

.cat-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.cat-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

.cat-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

@media (min-width: 640px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
  }
}

.no-products {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--text-subtle);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: fadeInUp 0.4s ease forwards;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-light);
}

.card-img-wrapper {
  width: 100%;
  height: 250px;
  overflow: hidden;
  background: var(--border);
  cursor: pointer;
}

.product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.card:hover .product-img {
  transform: scale(1.05);
}

.product-body {
  padding: 10px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.product-title {
  font-size: 0.9rem;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-desc {
  font-size: 0.75rem;
  color: var(--text-subtle);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  gap: 4px;
}

.price-container {
  display: flex;
  flex-direction: column;
}

.price-tag {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
}

.old-price {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.card-actions {
  display: flex;
  gap: 4px;
}

/* Form & Input */
.input {
  width: 100%;
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  outline: none;
  font-size: 0.85rem;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.hidden {
  display: none !important;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mb-1 {
  margin-bottom: 0.75rem;
}

.pill {
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: bold;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
  animation: fadeIn 0.25s ease;
}

.modal-card {
  background: var(--card);
  padding: 1.25rem;
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-img-box {
  width: 100%;
  height: 300px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
  background: var(--border);
}

.modal-img-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.close-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  border: none;
  background: rgba(0, 0, 0, 0.1);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-label {
  font-size: 0.8rem;
  font-weight: bold;
  display: block;
  margin-bottom: 4px;
}

.options-container {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.option-btn {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.border-top {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
}

/* Cart Overlay & Drawer */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.3s ease;
}

.cart-drawer {
  background: var(--card);
  width: 100%;
  max-width: 380px;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
  animation: slideLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  font-size: 1rem;
  color: var(--primary);
}

.cart-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.cart-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-item-img {
  width: 45px;
  height: 45px;
  object-fit: cover;
  border-radius: 6px;
}

.cart-item-name {
  font-size: 0.85rem;
}

.delete-btn {
  color: #ef4444;
}

.empty-cart {
  text-align: center;
  color: var(--text-subtle);
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-cart i {
  font-size: 2.5rem;
  opacity: 0.4;
}

.cart-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.cart-inputs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 0.75rem;
}

.cart-total-price {
  color: var(--primary);
  font-size: 1.2rem;
  font-weight: 800;
}

.checkout-btn {
  padding: 12px;
  font-size: 0.9rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Footer Section */
.site-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  margin-top: auto;
  padding: 2rem 1rem 1rem;
  text-align: center;
}

.footer-content {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-logo-box {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 0.75rem;
  border: 2px solid var(--primary);
  box-shadow: 0 4px 15px rgba(147, 51, 234, 0.2);
}

.footer-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.footer-title {
  font-size: 1.25rem;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.footer-subtitle {
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-bottom: 1.25rem;
}

.social-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.social-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1rem;
}

.social-icon:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-3px);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideLeft {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}
