:root {
  --primary: #3b82f6;
  --dark: #0f172a;
  --gray: #64748b;
  --bg: #f8fafc;
  --border: #e2e8f0;
}

body {
  background: var(--bg);
  font-family: "Poppins", sans-serif;
}

.catalog-container {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
  display: flex;
  gap: 30px;
  min-height: 80vh;
  position: relative;
}

/* Sidebar */
.catalog-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: white;
  padding: 25px;
  border-radius: 16px;
  border: 1px solid var(--border);
  height: fit-content;
  position: sticky;
  top: 90px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.01);
}
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.sidebar-header h3 {
  font-size: 1.1rem;
  color: var(--dark);
  font-weight: 600;
}
.close-sidebar {
  display: none;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
}
.filter-group {
  margin-bottom: 24px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 20px;
}
.filter-group:last-child {
  border: none;
  margin: 0;
  padding: 0;
}
.filter-group h4 {
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: var(--dark);
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Inputs */
.search-group {
  position: relative;
  border: none;
  padding: 0;
}
.search-group i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
}
.search-group input {
  width: 100%;
  padding: 12px 12px 12px 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: #f8fafc;
  transition: 0.2s;
}
.search-group input:focus {
  border-color: var(--primary);
  background: white;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  color: var(--gray);
  font-size: 0.9rem;
}
.checkbox-label input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}
.price-inputs {
  display: flex;
  gap: 10px;
  align-items: center;
}
.price-inputs input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  font-size: 0.9rem;
}

/* Switch */
.switch-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.switch-label span {
  font-size: 0.9rem;
  color: var(--gray);
  font-weight: 500;
}
.switch-label input {
  display: none;
}
.slider {
  width: 36px;
  height: 20px;
  background-color: #cbd5e1;
  border-radius: 20px;
  position: relative;
  transition: 0.3s;
}
.slider:before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
}
input:checked + .slider {
  background-color: var(--primary);
}
input:checked + .slider:before {
  transform: translateX(16px);
}

/* Main Content */
.catalog-main {
  flex: 1;
}
.catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}
.catalog-header p {
  color: var(--gray);
  font-size: 0.95rem;
}
.sort-wrapper select {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  color: var(--dark);
  cursor: pointer;
  background: white;
  font-weight: 500;
}

/* Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 25px;
}
.product-card {
  background: white;
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.08);
  border-color: transparent;
}

.card-image-wrapper {
  position: relative;
  padding-top: 75%;
  overflow: hidden;
  background: #f1f5f9;
}
.card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}
.product-card:hover .card-image {
  transform: scale(1.05);
}

.card-body {
  padding: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.card-category {
  font-size: 0.7rem;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #eff6ff;
  padding: 4px 8px;
  border-radius: 4px;
}
.card-tag {
  font-size: 0.75rem;
  color: var(--gray);
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-title {
  font-size: 1.1rem;
  color: var(--dark);
  margin-bottom: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.price-box {
  display: flex;
  flex-direction: column;
}
.old-price {
  font-size: 0.85rem;
  text-decoration: line-through;
  color: #94a3b8;
  margin-bottom: 2px;
}
.final-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dark);
}

.offer-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #ef4444;
  color: white;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
  z-index: 2;
}

/* Quantity Controls */
.qty-control {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid var(--primary);
  border-radius: 50px;
  overflow: hidden;
  height: 38px;
}
.qty-btn {
  width: 32px;
  height: 100%;
  background: white;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qty-btn:hover {
  background: #eff6ff;
}
.qty-val {
  width: 30px;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--dark);
}

.add-btn-init {
  height: 38px;
  padding: 0 20px;
  background: var(--dark);
  color: white;
  border: none;
  border-radius: 50px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.add-btn-init:hover {
  background: var(--primary);
  transform: scale(1.02);
}

/* Mobile Toggle & Empty State */
.filter-toggle {
  display: none;
  margin-bottom: 20px;
  width: 100%;
  padding: 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  color: var(--dark);
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}
.empty-state {
  text-align: center;
  padding: 60px 20px;
  grid-column: 1 / -1;
}
.empty-icon {
  width: 80px;
  height: 80px;
  background: #f1f5f9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 2rem;
  color: #94a3b8;
}

/* Responsive */
@media (max-width: 900px) {
  .catalog-container {
    flex-direction: column;
  }
  .catalog-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    z-index: 2000;
    transition: 0.3s;
    border-radius: 0;
    border: none;
    overflow-y: auto;
  }
  .catalog-sidebar.active {
    left: 0;
  }
  .filter-toggle {
    display: block;
  }
  .close-sidebar {
    display: block;
  }
}

/* Toast */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: #1e293b;
  color: white;
  padding: 14px 24px;
  border-radius: 50px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;
}
.toast.error {
  background: #ef4444;
}
.toast.success {
  background: #10b981;
}
@keyframes slideIn {
  from {
    transform: translateY(-20px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
