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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f4f4f6;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: linear-gradient(135deg, #1a237e, #283593);
  color: white;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 64px;
}

.logo {
  cursor: pointer;
  flex-shrink: 0;
}

.logo h1 {
  font-size: 1.5rem;
  letter-spacing: 1px;
}

.logo span {
  font-size: 0.7rem;
  opacity: 0.8;
  display: block;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
  max-width: 600px;
}

.search-box {
  flex: 1;
}

.search-box input {
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  background: rgba(255,255,255,0.15);
  color: white;
  transition: background 0.2s;
}

.search-box input::placeholder {
  color: rgba(255,255,255,0.6);
}

.search-box input:focus {
  outline: none;
  background: rgba(255,255,255,0.25);
}

.cart-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  transition: background 0.2s;
  white-space: nowrap;
}

.cart-btn:hover {
  background: rgba(255,255,255,0.25);
}

.cart-count {
  background: #ff5252;
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: bold;
}

.layout {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  gap: 24px;
  flex: 1;
  width: 100%;
}

aside {
  width: 260px;
  flex-shrink: 0;
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  position: sticky;
  top: 84px;
  height: fit-content;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.close-sidebar {
  display: none;
}

aside h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #1a237e;
}

.category-item {
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.88rem;
  transition: all 0.15s;
  display: block;
  text-decoration: none;
  color: #333;
}

.category-item:hover {
  background: #e8eaf6;
  color: #1a237e;
}

.category-item.active {
  background: #1a237e;
  color: white;
  font-weight: 500;
}

.category-item.parent {
  font-weight: 600;
  color: #1a237e;
  margin-top: 4px;
}

.category-item.child {
  padding-left: 24px;
  font-size: 0.83rem;
}

.category-item.grandchild {
  padding-left: 38px;
  font-size: 0.8rem;
  color: #666;
}

main {
  flex: 1;
  min-width: 0;
}

#viewContainer {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  min-height: 500px;
}

/* Product Grid */
.breadcrumb {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 16px;
}

.breadcrumb span {
  cursor: pointer;
  color: #1a237e;
}

.breadcrumb span:hover {
  text-decoration: underline;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.view-header h2 {
  font-size: 1.4rem;
}

.sort-select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.85rem;
  background: white;
}

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

.product-card {
  background: white;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  border-color: #1a237e;
}

.product-card .image-wrap {
  aspect-ratio: 1;
  background: #f9f9f9;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 12px;
}

.product-card img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-card .brand {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #1a237e;
  font-weight: 600;
  margin-bottom: 4px;
}

.product-card h3 {
  font-size: 0.88rem;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .cod {
  font-size: 0.7rem;
  color: #999;
  margin-bottom: 8px;
}

.product-card .price {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a237e;
  margin-top: auto;
}

.product-card .stock {
  font-size: 0.75rem;
  margin-top: 4px;
}

.stock.in-stoc {
  color: #2e7d32;
}

.stock.stoc-limitat {
  color: #e65100;
}

.stock.stoc-epuizat {
  color: #c62828;
}

/* Product Detail */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.product-detail .gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-detail .main-image {
  width: 100%;
  aspect-ratio: 1;
  background: #f9f9f9;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-detail .main-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-detail .thumbnails {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.product-detail .thumb {
  width: 60px;
  height: 60px;
  border: 2px solid #eee;
  border-radius: 6px;
  cursor: pointer;
  padding: 4px;
  background: #f9f9f9;
  flex-shrink: 0;
}

.product-detail .thumb.active {
  border-color: #1a237e;
}

.product-detail .thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-detail .info .brand {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #1a237e;
  font-weight: 600;
}

.product-detail .info h2 {
  font-size: 1.5rem;
  margin: 8px 0;
}

.product-detail .info .cod {
  color: #999;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.product-detail .info .pret {
  font-size: 2rem;
  font-weight: 700;
  color: #1a237e;
  margin: 16px 0;
}

.product-detail .info .descriere {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #555;
  margin: 16px 0;
}

.product-detail .info .descriere p {
  margin-bottom: 8px;
}

.add-to-cart-btn {
  background: linear-gradient(135deg, #1a237e, #283593);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s;
  width: 100%;
  margin-top: 16px;
}

.add-to-cart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(26,35,126,0.3);
}

/* Cart */
.cart-view h2 {
  margin-bottom: 20px;
}

.cart-empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.cart-empty p {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-item {
  display: grid;
  grid-template-columns: 80px 1fr auto auto auto;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border: 1px solid #eee;
  border-radius: 10px;
}

.cart-item img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 8px;
  background: #f9f9f9;
}

.cart-item .cart-item-name {
  font-weight: 500;
  cursor: pointer;
}

.cart-item .cart-item-name:hover {
  color: #1a237e;
}

.cart-item .cart-item-price {
  font-weight: 700;
  color: #1a237e;
  white-space: nowrap;
}

.cart-item .qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-item .qty-controls button {
  width: 32px;
  height: 32px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 1.1rem;
}

.cart-item .qty-controls button:hover {
  background: #f0f0f0;
}

.cart-item .qty-controls span {
  min-width: 24px;
  text-align: center;
  font-weight: 500;
}

.cart-item .remove-btn {
  background: none;
  border: none;
  color: #c62828;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
}

.cart-total {
  text-align: right;
  padding: 20px 0;
  border-top: 2px solid #eee;
  margin-top: 20px;
}

.cart-total .total-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a237e;
}

.checkout-btn {
  background: linear-gradient(135deg, #2e7d32, #388e3c);
  color: white;
  border: none;
  padding: 14px 40px;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  margin-top: 12px;
  transition: transform 0.15s;
}

.checkout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(46,125,50,0.3);
}

/* Sidebar toggle mobile */
.sidebar-toggle {
  display: none;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2rem;
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 200;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
}

.toast-item {
  background: #333;
  color: white;
  padding: 14px 24px;
  border-radius: 10px;
  margin-top: 8px;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Footer */
footer {
  background: #1a237e;
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 20px;
  font-size: 0.85rem;
  margin-top: auto;
}

/* Numbers */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.pagination button {
  padding: 8px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 0.85rem;
}

.pagination button:hover {
  background: #e8eaf6;
}

.pagination button.active {
  background: #1a237e;
  color: white;
  border-color: #1a237e;
}

/* Mobile */
@media (max-width: 768px) {
  .header-inner {
    height: auto;
    padding: 12px 0;
    flex-wrap: wrap;
  }

  .sidebar-toggle {
    display: block;
  }

  aside {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    z-index: 300;
    border-radius: 0;
    transition: left 0.3s;
    max-height: 100vh;
    padding-top: 60px;
  }

  aside.open {
    left: 0;
  }

  .close-sidebar {
    display: block;
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
  }

  .overlay.show {
    display: block;
  }

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

  .product-detail {
    grid-template-columns: 1fr;
  }

  .cart-item {
    grid-template-columns: 60px 1fr;
    gap: 10px;
  }

  .cart-item .qty-controls {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .layout {
    padding: 12px;
  }

  #viewContainer {
    padding: 16px;
  }

  .navbar {
    padding: 0 16px;
    overflow-x: auto;
  }

  .navbar a {
    font-size: 0.8rem;
    padding: 10px 12px;
    white-space: nowrap;
  }
}

/* Navbar */
.navbar {
  display: flex;
  background: rgba(0,0,0,0.15);
  padding: 0 24px;
  max-width: 1400px;
  margin: 0 auto;
  gap: 4px;
  border-radius: 0 0 8px 8px;
}

.navbar a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 10px 20px;
  font-size: 0.85rem;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.navbar a:hover {
  color: white;
  background: rgba(255,255,255,0.1);
}

.navbar a.nav-active {
  color: white;
  border-bottom-color: #ff5252;
  background: rgba(255,255,255,0.08);
}
