/* ============================================
   COMPRAORA.NET - E-Commerce Multi-Vendor
   Stile principale
   ============================================ */

:root {
  --primary-dark: #cc0000;
  --secondary-dark: #990000;
  --accent-orange: #febd69;
  --accent-hover: #f3a847;
  --accent-blue: #007185;
  --accent-blue-hover: #005f6b;
  --text-dark: #0f1111;
  --text-light: #565959;
  --bg-page: #eaeded;
  --bg-card: #ffffff;
  --border-color: #d5d9d9;
  --price-color: #b12704;
  --success: #067d62;
  --white: #ffffff;
  --shadow: 0 2px 5px rgba(0,0,0,0.1);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.15);
}

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

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--bg-page);
  color: var(--text-dark);
  line-height: 1.5;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  background-color: var(--primary-dark);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-top {
  display: flex;
  align-items: center;
  padding: 8px 20px;
  gap: 20px;
  max-width: 1500px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--white);
  letter-spacing: 0.5px;
  white-space: nowrap;
  text-transform: uppercase;
}

.logo span {
  font-weight: 400;
  font-size: 1.1rem;
  opacity: 0.9;
}

.search-bar {
  flex: 1;
  display: flex;
  max-width: 700px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
}

.search-select {
  background: #f3f3f3;
  border: none;
  padding: 0 10px;
  font-size: 0.85rem;
  color: var(--text-dark);
  cursor: pointer;
  border-right: 1px solid #cdcdcd;
}

.search-input {
  flex: 1;
  border: none;
  padding: 0 12px;
  font-size: 0.95rem;
  outline: none;
}

.search-btn {
  background: var(--accent-orange);
  border: none;
  width: 45px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.2s;
}

.search-btn:hover {
  background: var(--accent-hover);
}

.header-actions {
  display: flex;
  gap: 24px;
  align-items: center;
}

.header-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 2px;
  transition: outline 0.1s;
  position: relative;
}

.header-action:hover {
  outline: 1px solid var(--white);
}

.header-action small {
  font-size: 0.72rem;
  opacity: 0.9;
}

.header-action strong {
  font-size: 0.9rem;
  font-weight: 700;
}

.header-action.cart {
  flex-direction: row;
  align-items: flex-end;
  gap: 4px;
}

.cart-count {
  position: absolute;
  top: 0;
  right: 4px;
  background: var(--accent-orange);
  color: var(--primary-dark);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0 5px;
  border-radius: 10px;
}

.cart-icon {
  font-size: 1.6rem;
}

/* ============================================
   NAVBAR CATEGORIE
   ============================================ */
.navbar {
  background-color: var(--secondary-dark);
  color: var(--white);
}

.navbar-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 20px;
  max-width: 1500px;
  margin: 0 auto;
  overflow-x: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 0.88rem;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 2px;
  transition: outline 0.1s;
}

.nav-item:hover {
  outline: 1px solid var(--white);
}

.nav-item.all-menu {
  font-weight: 700;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 12px;
}

.breadcrumb a:hover {
  text-decoration: underline;
  color: var(--accent-blue);
}

/* Banner */
.banner {
  background: linear-gradient(90deg, #e74c3c 0%, #c0392b 100%);
  border-radius: 8px;
  padding: 30px 40px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--white);
  position: relative;
  overflow: hidden;
}

.banner-text h2 {
  font-size: 2rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.banner-text p {
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.banner-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  color: #c0392b;
  padding: 10px 24px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.banner-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.banner-img {
  max-width: 280px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  transform: rotate(-5deg);
}

/* ============================================
   FILTRI
   ============================================ */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.filter-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-light);
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--white);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-dark);
}

.filter-chip:hover,
.filter-chip.active {
  background: var(--accent-blue);
  color: var(--white);
  border-color: var(--accent-blue);
}

.sort-bar {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-bar label {
  font-size: 0.82rem;
  color: var(--text-light);
}

.sort-select {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--white);
  font-size: 0.82rem;
  cursor: pointer;
}

/* ============================================
   GRIGLIA PRODOTTI
   ============================================ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

/* Card Prodotto */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  position: relative;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.product-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f7f8f8;
  overflow: hidden;
}

.product-image-wrap img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.product-image-wrap img.active {
  opacity: 1;
}

.product-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--accent-orange);
  color: var(--primary-dark);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 3px;
  text-transform: uppercase;
  z-index: 5;
}

.product-info {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-brand {
  font-size: 0.75rem;
  color: var(--accent-blue);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.product-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-shortdesc {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 10px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  margin-top: auto;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-dark);
}

.product-price .currency {
  font-size: 0.75rem;
  vertical-align: super;
}

.product-price .decimal {
  font-size: 0.85rem;
  vertical-align: super;
}

/* ============================================
   PAGINAZIONE
   ============================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 16px 0;
}

.page-btn {
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  background: var(--white);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
  background: #f0f2f2;
}

.page-btn.active {
  background: var(--accent-orange);
  border-color: var(--accent-orange);
  font-weight: 700;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   PAGINA PRODOTTO
   ============================================ */
.product-page {
  background: var(--white);
  border-radius: 8px;
  padding: 30px;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 40px;
}

.product-gallery {
  position: relative;
}

.product-gallery-main {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f7f8f8;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

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

.product-gallery-thumbs {
  display: flex;
  gap: 10px;
}

.gallery-thumb {
  width: 60px;
  height: 60px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  background: #f7f8f8;
  transition: border-color 0.2s;
}

.gallery-thumb:hover,
.gallery-thumb.active {
  border-color: var(--accent-orange);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-details h1 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.product-details .brand-link {
  color: var(--accent-blue);
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 12px;
}

.product-details .brand-link:hover {
  color: var(--accent-blue-hover);
  text-decoration: underline;
}

.rating {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

.stars {
  color: #ffa41c;
  font-size: 1.1rem;
  letter-spacing: -2px;
}

.rating-count {
  color: var(--accent-blue);
  font-size: 0.85rem;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 16px 0;
}

.detail-price {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.detail-price .currency {
  font-size: 0.9rem;
  vertical-align: super;
}

.detail-price .decimal {
  font-size: 1rem;
  vertical-align: super;
}

.stock-status {
  color: var(--success);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.product-description h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.product-description p {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
}

.buy-box {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #fafafa;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--accent-orange);
  border: none;
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 10px;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--accent-blue);
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-blue);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #f0f8f9;
}

.shipping-info {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--text-light);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background: var(--secondary-dark);
  color: var(--white);
  margin-top: 40px;
  padding: 30px 20px;
  text-align: center;
  font-size: 0.85rem;
}

.footer-brand {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 600px) {
  .header-top {
    flex-wrap: wrap;
    gap: 10px;
  }

  .search-bar {
    order: 3;
    max-width: 100%;
    width: 100%;
  }

  .products-grid {
    grid-template-columns: 1fr;
  }

  .banner {
    flex-direction: column;
    text-align: center;
    padding: 20px;
  }

  .banner-img {
    margin-top: 20px;
    transform: none;
    max-width: 200px;
  }
}

/* ============================================
   DROPDOWN CARRELLO
   ============================================ */
.cart-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: #fff;
  border: 1px solid #d5d9d9;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 12px;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.cart-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.cart-empty {
  text-align: center;
  padding: 20px;
  color: #777;
  font-size: 0.9rem;
}

.cart-items {
  max-height: 280px;
  overflow-y: auto;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  background: #f5f5f5;
  flex-shrink: 0;
}

.cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-qty {
  font-size: 0.75rem;
  color: var(--text-light);
}

.cart-item-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
}

.cart-total {
  text-align: right;
  padding: 10px 0 4px;
  border-top: 1px solid #ddd;
  font-size: 0.95rem;
  color: var(--text-dark);
}

.cart-total strong {
  font-size: 1.1rem;
  color: #cc0000;
}

.cart-checkout {
  display: block;
  text-align: center;
  background: var(--accent-orange);
  color: var(--primary-dark);
  padding: 10px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  margin-top: 8px;
  transition: background 0.2s;
}

.cart-checkout:hover {
  background: var(--accent-hover);
}

/* ============================================
   MENU UTENTE LOGGATO
   ============================================ */
.user-logged { cursor: pointer; }

.user-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.user-trigger:hover {
  background: rgba(255,255,255,0.1);
}

.user-arrow {
  font-size: 0.6rem;
  opacity: 0.7;
  margin-left: 2px;
  transition: transform 0.2s;
}

.user-logged .user-menu.active + .user-arrow,
.user-logged .user-menu.active ~ .user-arrow {
  transform: rotate(180deg);
}

.user-logged .user-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #2d2f33;
  border: none;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  padding: 8px 0;
  min-width: 220px;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.2s;
  overflow: hidden;
  pointer-events: none;
}

.user-logged .user-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 14px;
  border-bottom: 1px solid #444;
  margin-bottom: 4px;
}

.user-menu-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-menu-name {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.user-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: #e8e8e8;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}

.user-menu a:hover {
  background: #3a3d42;
  color: #fff;
}

.user-menu a .icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.user-menu-divider {
  border-top: 1px solid #444;
  margin: 4px 0;
}

.user-logged small,
.user-logged strong {
  display: none !important;
}
