* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", sans-serif;
}

body {
  background: #f7f7f7;
  color: #333;
}

/* HEADER */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

/* LEFT STACK */
.topbar-left {
  display: flex;
  align-items: center;

  gap: 10px;
}

/* BIG SEARCH */
.search-big {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f3f3f3;
  padding: 12px 14px;
  border-radius: 14px;
  width: 620px;
  max-width: 100%;
  height: 40px;
}

.search-big i {
  font-size: 18px;
  color: crimson;
}

.search-big input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 16px;
}

/* left */
.logo {
  display: flex;
  flex-direction: column;
}

.logo span {
  font-weight: 700;
  font-size: 14px;
  color: crimson;
}

/* LOGO TEXT LINK */
.logo-text {
  text-decoration: none;
  color: crimson;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
  transition: all 0.25s ease;
}

.logo-text span {
  position: relative;
}

/* hover effect */
.logo-text:hover {
  color: #ff6b6b;
}

/* underline animation (hoverda chiroyli chiqadi) */
.logo-text span::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0%;
  height: 2px;
  background: #ff6b6b;
  transition: width 0.25s ease;
}

.logo-text:hover span::after {
  width: 100%;
}

.logo img {
  width: 60px;
}

/* right */
.cart-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;

  background: linear-gradient(135deg, #dc143c, #ff4d6d);
  color: #fff;

  border: none;
  border-radius: 10px;
  padding: 10px 16px;

  cursor: pointer;
  font-size: 15px;
  font-weight: 600;

  box-shadow: 0 6px 16px rgba(220, 20, 60, 0.35);
  transition: all 0.25s ease;
}

/* icon */
.cart-btn i {
  font-size: 18px;
}

/* cart text */
.cart-btn .cart-text {
  font-size: 14px;
  letter-spacing: 0.3px;
}

/* badge count */
#cartCount {
  position: absolute;
  top: -6px;
  right: -6px;

  background: #fff;
  color: crimson;

  font-size: 11px;
  font-weight: 700;

  padding: 2px 6px;
  border-radius: 50%;
  min-width: 18px;
  text-align: center;

  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* hover */
.cart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(220, 20, 60, 0.45);
}

/* click */
.cart-btn:active {
  transform: scale(0.96);
}

/* RATING */
.rating {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 6px 0;
}

.rating i {
  color: #f5a623; /* gold */
  font-size: 14px;
}

.rating-number {
  margin-left: 6px;
  font-size: 12px;
  color: #777;
  font-weight: 500;
}

.out-of-stock {
  background: #eee;
  color: #999;
  padding: 10px;
  text-align: center;
  border-radius: 6px;
  font-weight: bold;
  cursor: not-allowed;
}

/* price spacing fix */
.card .price {
  margin-top: 6px;
  font-weight: 600;
}

/* LAYOUT */
.layout {
  display: grid;
  grid-template-columns: 220px 1fr 260px;
  height: calc(100vh - 64px);
}

/* LEFT MENU */
.sidebar {
  background: #fff;
  padding: 20px;
  border-right: 1px solid #eee;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  color: #555;
  text-decoration: none;
  border-radius: 10px;
}

.sidebar a:hover {
  background: #ffe4ea;
}

/* PRODUCTS */
.products {
  padding: 20px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.card .product-title {
  position: relative;
  display: block;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
}

.product-title::after {
  content: attr(data-full);
  position: absolute;
  left: 50%;
  bottom: 120%;
  transform: translateX(-50%);
  background: #222;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
}

.product-title:hover::after {
  opacity: 1;
}

.card img {
  width: 140px;
  height: 140px;
  object-fit: cover;
}

.card button {
  margin-top: 10px;
  background: crimson;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 16px;
  cursor: pointer;
}

/* NOT FOUND */
.not-found {
  grid-column: 1 / -1;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  color: #555;
  text-align: center;
  padding: 40px;
  animation: fadeUp 0.4s ease;
}

.not-found i {
  font-size: 48px;
  color: crimson;
  margin-bottom: 14px;
}

.not-found p {
  font-size: 15px;
  color: #666;
  margin-bottom: 6px;
}

.not-found span {
  font-size: 13px;
  color: #999;
}

/* animation */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================== CATEGORIES PANEL ================== */
.categories {
  background: #fff; /* clean white */
  padding: 20px;
  border-left: 1px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 16px;

  /* subtle shadow for depth */
  box-shadow: -6px 0 20px rgba(0, 0, 0, 0.05);
}

/* ================== CATEGORY TITLE ================== */
.categories-title {
  font-size: 18px;
  cursor: pointer;
  font-weight: 800;
  color: #dc143c;
  text-transform: uppercase;
  position: relative;
  padding-left: 12px;

  /* vertical accent line */
  border-left: 6px solid #dc143c;

  /* shadow / depth */
  box-shadow: 2px 2px 10px rgba(220, 20, 60, 0.1);
  border-radius: 6px;
  padding: 6px 0;
}

/* subtle horizontal underline */
.categories-title::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 12px;
  width: 45%;
  height: 3px;
  background: linear-gradient(90deg, #dc143c, transparent);
  border-radius: 2px;
}

/* ================== CATEGORY LIST ================== */
.categories-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ================== CATEGORY ITEM ================== */
.category-item {
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  color: #444;
  background: #f9f9f9;

  display: flex;
  justify-content: space-between;
  align-items: center;

  /* subtle shadow */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  cursor: pointer;

  transition: all 0.2s ease;
}

/* active category */
.category-item.active {
  background: linear-gradient(135deg, #dc143c, #ff4d6d);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(220, 20, 60, 0.3);
  border-radius: 14px;
}

/* optional: simple hover (light) */
.category-item:hover {
  background: #ffe4ea;
  color: #dc143c;
}

/* active indicator dot */
.category-item.active::after {
  content: "●";
  font-size: 10px;
  color: #fff;
}

/* CART DRAWER */
.cart-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 380px;
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: -6px 0 24px rgba(0, 0, 0, 0.15);
  transition: right 0.35s ease;
  z-index: 20;
}

.cart-drawer.open {
  right: 0;
}

/* HEADER */
.cart-header {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
}

.cart-header h2 {
  font-size: 18px;
}

.cart-header button {
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
}

/* BODY */
.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* ITEM */
.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  width: 300px;
  border-bottom: 1px solid #f0f0f0;
}

.cart-item img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 10px;
}

.cart-info {
  flex: 1;
}

.cart-info h4 {
  font-size: 14px;
  margin-bottom: 6px;
  width: 190px;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}

.cart-price {
  font-weight: 600;
}

/* ACTIONS */
.cart-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
}

.qty {
  min-width: 20px;
  text-align: center;
}

/* SQUARE REMOVE BUTTON */
.remove-btn {
  width: 50%;
  height: 32px;
  margin-top: 10px;
  margin-left: 20px;
  border-radius: 6px; /* square, not circle */
  border: none;
  background: linear-gradient(135deg, #dc143c, #ff4d6d);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(220, 20, 60, 0.35);
  transition: all 0.25s ease;
}

/* hover */
.remove-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(220, 20, 60, 0.5);
}

/* click */
.remove-btn:active {
  transform: scale(0.97);
}

/* subtle danger feel */
.remove-btn::before {
  content: "";
  margin-right: 6px;
}

/* FOOTER */
.cart-footer {
  padding: 16px;
  border-top: 1px solid #eee;
}

.cart-summary {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 16px;
  background-color: #ffe4ea;
  padding: 10px 18px;
}

.checkout {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: crimson;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.category-title {
  grid-column: 2 / 3;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  padding: 12px 0;
  color: #333;
}

/* EMPTY CART */
.empty-cart {
  height: 100%;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #777;
  padding: 20px;
}

.empty-cart i {
  font-size: 54px;
  color: #dc143c;
  margin-bottom: 14px;
}

.empty-cart h3 {
  font-size: 18px;
  margin-bottom: 6px;
  color: #444;
}

.empty-cart p {
  font-size: 14px;
  color: #888;
}

.back-products-btn {
  display: none;
}

/* ================= MODERN TOAST ================= */
.toast {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  opacity: 0;
  pointer-events: none;

  display: flex;
  align-items: center;
  gap: 10px;

  padding: 14px 20px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;

  color: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  transition: all 0.35s ease;
  z-index: 9999;
}

/* SHOW */
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ICON */
.toast i {
  font-size: 18px;
}

/* TYPES */
.toast-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.toast-error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.toast-info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

/* CHECKOUT MODAL BACKDROP */
.checkout-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6); /* darker for focus */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px); /* modern blur effect */
  transition: opacity 0.3s ease;
}

.checkout-modal.show {
  display: flex;
  opacity: 1;
}

/* CHECKOUT BOX */
.checkout-box {
  background: #fff;
  width: 90%;
  max-width: 420px;
  border-radius: 20px;
  padding: 30px 25px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.4s ease;
}

/* Slide-up animation */
@keyframes slideUp {
  0% {
    transform: translateY(30px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* HEADER */
.checkout-box h2 {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: #dc143c;
  margin-bottom: 25px;
}

/* FORM LABELS */
.checkout-box label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #555;
  margin-bottom: 15px;
}

/* INPUTS & TEXTAREA */
.checkout-box input,
.checkout-box textarea {
  width: 100%;
  padding: 12px 15px;
  margin-top: 5px;
  border-radius: 12px;
  border: 1px solid #ddd;
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
  background-color: #fafafa;
}

/* Focus effect */
.checkout-box input:focus,
.checkout-box textarea:focus {
  border-color: #dc143c;
  box-shadow: 0 0 8px rgba(220, 20, 60, 0.2);
  background-color: #fff;
}

/* TEXTAREA HEIGHT */
.checkout-box textarea {
  resize: none;
  height: 90px;
}

/* ACTION BUTTONS */
.checkout-actions {
  display: flex;
  gap: 15px;
  margin-top: 20px;
}

/* CONFIRM BUTTON */
.checkout-actions button:first-child {
  flex: 1;
  padding: 12px 0;
  background: linear-gradient(135deg, #dc143c, #ff4d6d);
  color: #fff;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.checkout-actions button:first-child:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(220, 20, 60, 0.35);
}

/* CANCEL BUTTON */
.checkout-actions .cancel {
  flex: 1;
  padding: 12px 0;
  background: #f3f3f3;
  color: #555;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.checkout-actions .cancel:hover {
  background: #e0e0e0;
}

@media (min-width: 851px) {
  .layout {
    height: calc(100vh - 64px);
  }
}

/* ================= MOBILE CATEGORY BAR (APP STYLE) ================= */
@media (max-width: 850px) {
  .categories {
    grid-row: 2;
    top: 64px;
    z-index: 20;
    display: flex;
    flex-direction: row;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    border-bottom: 1px solid #eee;
    overflow-x: auto;
    white-space: nowrap;
    position: sticky !important;
    grid-area: categories !important;
  }

  /* Scroll bar yashirish */
  .categories::-webkit-scrollbar {
    display: none;
  }

  /* Title mini badge */
  .categories-title {
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
    color: crimson;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(220, 20, 60, 0.1);
  }

  /* Category chip */
  .category-item {
    flex-shrink: 0;
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 500;
    background: #f3f3f3;
    color: #333;
    cursor: pointer;
    transition: all 0.25s ease;
  }

  .category-item:hover {
    background: #ffe1e8;
    color: crimson;
  }

  /* Active chip */
  .category-item.active {
    background: linear-gradient(135deg, #dc143c, #ff4d6d);
    color: #fff;
    box-shadow: 0 4px 10px rgba(220, 20, 60, 0.35);
  }

  /* active dotni o‘chiramiz mobile’da */
  .category-item.active::after {
    display: none;
  }
}

@media (max-width: 850px) {
  body {
    overflow: hidden;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    top: 0;
    position: sticky !important;
    z-index: 50;
    grid-area: topbar !important;
  }

  .search-big {
    width: 100%;
  }
  .logo {
    display: flex;
  }

  .cart-btn {
    align-self: flex-end;
  }

  .cart-drawer {
    z-index: 60;
    width: 100%;
  }
  .layout {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto 1fr !important;
    grid-template-areas:
      "topbar"
      "categories"
      "products" !important;

    height: 100vh !important;
    min-height: 100vh !important;
  }
  .products {
    grid-area: products !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 340px !important; /* bottom nav safe */
  }
  .products > * {
    max-height: none;
  }

  /* BOTTOM NAV */
  .sidebar {
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    padding: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid #ddd;
    border-right: none;
    position: fixed !important;
    z-index: 60;
    background: #fff;
  }

  .sidebar a {
    flex-direction: column;
    font-size: 12px;
    gap: 4px;
    padding: 6px 0;
  }

  .sidebar i {
    font-size: 18px;
  }

  .empty-cart {
    min-height: 220px;
  }

  .empty-cart i {
    font-size: 46px;
  }

  .back-products-btn {
    margin-top: 10px;
    width: 100%;
    padding: 12px;
    border: 1px solid crimson;
    border-radius: 10px;
    background: #fff;
    color: crimson;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
  }

  .back-products-btn i {
    font-size: 16px;
  }

  .back-products-btn:active {
    transform: scale(0.97);
  }
}

/* ================= APP STYLE PRODUCT CARD (MOBILE) ================= */
@media (max-width: 600px) {
  .products {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .card {
    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 12px 10px;
    border-radius: 18px;

    background: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .card:active {
    transform: scale(0.97);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  }

  /* TITLE */
  .card .product-title {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    margin: 4px 0;
    line-height: 1.3;
  }

  /* PRICE */
  .card .price {
    font-size: 14px;
    font-weight: 700;
    color: crimson;
    margin: 6px 0;
  }

  /* RATING */
  .rating {
    margin: 4px 0;
  }

  .rating i {
    font-size: 12px;
  }

  .rating-number {
    font-size: 11px;
  }

  /* BUTTON */
  .card button {
    margin-top: auto;
    width: 100%;
    padding: 10px 0;

    border-radius: 14px;
    border: none;

    background: linear-gradient(135deg, #dc143c, #ff4d6d);
    color: #fff;

    font-size: 13px;
    font-weight: 600;
    cursor: pointer;

    box-shadow: 0 4px 10px rgba(220, 20, 60, 0.35);
    transition: transform 0.2s ease;
  }

  .card button:active {
    transform: scale(0.96);
  }

  /* OUT OF STOCK */
  .out-of-stock {
    width: 100%;
    margin-top: auto;
    padding: 10px 0;
    border-radius: 14px;
    font-size: 12px;
  }
}

/* MOBILE: FORCE 2 PRODUCTS PER ROW */
@media (max-width: 600px) {
  .products {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .card {
    padding: 10px;
  }

  .card img {
    width: 140px;
    height: 140px;
    object-fit: cover;
  }
}

/* MOBILE */
@media (max-width: 600px) {
  .toast {
    left: 50%;
    height: 40px;
    width: 250px;
    bottom: 80px; /* bottom nav ustida */
    transform: translateX(-50%) translateY(100px);
    color: #fff;
    padding: 16px 24px;
    font-size: 12px;
  }
  .toast.show {
    transform: translateX(-50%) translateY(0); /* slide up */
  }
}

/* RESPONSIVE FOR MOBILE */
@media (max-width: 500px) {
  .checkout-box {
    padding: 25px 20px;
  }

  .checkout-box h2 {
    font-size: 20px;
  }

  .checkout-actions {
    flex-direction: column;
    gap: 12px;
  }

  .checkout-actions button {
    width: 100%;
  }
}
