@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  /* Colors */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --text-dark: #0f172a;
  --text-mid: #475569;
  --text-light: #94a3b8;
  --bg-page: #f8f9fa;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --border: #e2e8f0;
  --danger: #ef4444;
  --hero-bg-start: #eff6ff;
  --hero-bg-end: #dbeafe;
  --hero-tag-bg: #dbeafe;
  --hero-tag-color: #1d4ed8;

  /* Spacing */
  --space-sm: 8px;
  --space-md: 14px;
  --space-lg: 24px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Text */
  --text-body: #64748b;

  /* Card */
  --card-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
  --card-shadow-hover: 0 4px 16px rgba(37, 99, 235, 0.1);

  /* Category */
  --cat-bg: #f0f7ff;
  --cat-border: #bfdbfe;
}

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

body {
  font-family: "Inter", sans-serif;
  background: var(--bg-page);
  color: var(--text-dark);
}

/* ============ NAVBAR ============ */

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.navbar__logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-dark);
}

.navbar__logo span {
  color: var(--primary);
}

.cart-text {
  display: none;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  padding: var(--space-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  position: relative;
}

.cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--danger);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============ HERO ============ */

.hero {
  display: flex;
  align-items: center;
  padding: var(--space-md);
  background: linear-gradient(135deg, var(--hero-bg-start), var(--hero-bg-end));
  gap: var(--space-md);
}

.hero__tag {
  background-color: var(--hero-tag-bg);
  color: var(--hero-tag-color);
  font-size: 0.9rem;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  display: inline-block;
  font-weight: 600;
}

.hero__image {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
}

.hero__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.hero__title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 6px;
  line-height: 1.3;
}

.hero__sub {
  font-size: 0.85rem;
  color: var(--text-body);
  margin-bottom: 12px;
  line-height: 1.5;
}

.hero__btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* ============ CONTROLS ============ */

.controls {
  padding: var(--space-md);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.controls__search {
  display: flex;
  border: 1.5px;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  padding: 4px 4px 4px 16px;
  background: var(--bg-input);
  align-items: center;
}

.inpt-box {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.9rem;
  color: var(--text-dark);
}

.search-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.controls__filters {
  display: flex;
  gap: var(--space-sm);
}

.filter-select {
  flex: 1;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-mid);
  font-size: 0.85rem;
  outline: none;
}

.categories {
  padding: var(--space-md);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.categories__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: var(--space-sm);
}

.categories__grid {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
}

/* ============ PRODUCTS ============ */

.products {
  padding: var(--space-md);
}

.category-card:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.category-card:hover .category-card__name {
  color: white;
}

.categories__grid::-webkit-scrollbar {
  height: 3px;
}

.categories__grid::-webkit-scrollbar-track {
  background: var(--bg-page);
}

.categories__grid::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

.products__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.products__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.products__count {
  font-size: 0.85rem;
  color: var(--text-light);
}

.products-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.message-container {
  display: none;
  text-align: center;
  padding: var(--space-lg);
  color: var(--text-mid);
  font-size: 0.9rem;
}

/* Card  */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: none;
}

.image-container {
  height: 130px;
  background: var(--cat-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.image-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card__body {
  padding: 10px;
}

.card__category {
  font-size: 0.7rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.price {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
}

.add-to-cart-btn {
  padding: 7px 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.card__footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.add-to-cart-btn {
  width: 100%;
  padding: 8px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.add-to-cart-btn:active {
  background: #2564eb9f;
  color: white;
  transform: scale(0.95);
}

.cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
}

/* ============ CART DRAWER ============ */
.cart-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-md);
  z-index: 101;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  max-height: 80vh;
  overflow-y: auto;
}

.cart-drawer.open {
  transform: translateY(0);
}

.cart-overlay.open {
  display: block;
}

.cart-drawer__handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.cart-drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.cart-drawer__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.cart-drawer__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mid);
}

.cart-drawer__footer {
  border-top: 1.5px solid var(--border);
  padding-top: var(--space-md);
  margin-top: var(--space-md);
}

.cart-drawer__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.cart-drawer__checkout {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.cart-empty {
  text-align: center;
  padding: var(--space-lg);
  color: var(--text-light);
  font-size: 0.9rem;
  display: none;
}

.cart-empty i {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

/* ============ CART ITEMS ============ */
.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}

.cart-item__img {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--cat-bg);
  flex-shrink: 0;
}

.cart-item__info {
  flex: 1;
}

.cart-item__title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.3;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item__price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}

.cart-item__controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-dark);
}

.qty-num {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  min-width: 16px;
  text-align: center;
}

.remove-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: #fee2e2;
  color: var(--danger);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.load-more-wrap {
  text-align: center;
  padding: var(--space-lg);
}

.load-more-btn {
  padding: 10px 32px;
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.load-more-btn:hover {
  background: var(--primary);
  color: white;
}

@media (min-width: 1024px) {
  .hero {
    padding: 40px var(--space-lg);
    min-height: 280px;
    align-items: center;
  }

  .hero__text {
    max-width: 600px;
  }

  .hero__title {
    font-size: 2rem;
    margin-bottom: 10px;
  }

  .hero__sub {
    font-size: 1rem;
    margin-bottom: 16px;
    max-width: 500px;
  }
  .hero__image {
    width: 110px;
    height: 110px;
    flex-shrink: 0;
  }

  .hero__image img {
    object-fit: contain;
  }
}

/* ============ DESKTOP 1024px ============ */
@media (min-width: 1024px) {
  .navbar {
    padding: var(--space-sm) var(--space-lg);
  }

  .cart-text {
    display: inline;
  }

  .hero {
    padding: var(--space-lg);
    display: flex;
    justify-content: space-between;
  }

  .hero__title {
    font-size: 1.8rem;
    margin: 10px;
  }

  .hero__image {
    width: 220px;
    height: 220px;
    flex-shrink: 0;
  }
  .hero {
    max-width: 1200px;
    margin: 0 auto;
  }

  .products {
    max-width: 1200px;
    margin: 0 auto;
  }

  .controls {
    max-width: 1200px;
    margin: 0 auto;
  }

  .controls {
    padding: var(--space-md) var(--space-lg);
    flex-direction: row;
    align-items: center;
  }

  .controls__search {
    flex: 1;
  }

  .controls__filters {
    display: flex;
    gap: var(--space-sm);
  }

  .products-container {
    grid-template-columns: repeat(4, 1fr);
  }

  .cart-drawer {
    width: 400px;
    left: auto;
    right: 0;
    top: 0;
    bottom: 0;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    transform: translateX(100%);
    max-height: 100vh;
  }

  .cart-drawer.open {
    transform: translateX(0);
  }
}
