/* =============================================
   SHOP SECTION - Tienda CIEM
   ============================================= */

.shop-section-fanely {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* HEADER */
.shop-header-fanely {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.shop-title-fanely {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 6px;
  color: #111;
}

.shop-subtitle-fanely {
  color: #888;
  margin: 0;
  font-size: 0.9rem;
}

.cart-toggle-btn {
  position: relative;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.cart-toggle-btn:hover { 
  background: #7c3aed; 
}

.cart-badge-fanely {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #e53e3e;
  color: #fff;
  border-radius: 999px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
}

/* LAYOUT */
.shop-layout-fanely {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

/* GRID DE PRODUCTOS */
.products-grid-fanely {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  flex: 1;
}

.products-grid-fanely.with-cart {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* CARD DE PRODUCTO */
.product-card-fanely {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  transition: box-shadow 0.2s, transform 0.2s;
}

.product-card-fanely:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.product-badge-fanely {
  position: absolute;
  top: -12px;
  left: 20px;
  color: #fff;
  border-radius: 999px;
  padding: 3px 14px;
  font-size: 0.75rem;
  font-weight: 700;
}

.product-icon-fanely {
  font-size: 2.5rem;
  line-height: 1;
}

.product-info-fanely {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.product-name-fanely {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0;
  color: #111;
}

.product-subtitle-fanely {
  color: #007bff;
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0;
}

.product-desc-fanely {
  color: #666;
  font-size: 0.85rem;
  margin: 0;
  line-height: 1.5;
}

.product-features-fanely {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-features-fanely li {
  color: #555;
  font-size: 0.82rem;
}

.product-more-fanely {
  color: #007bff;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.82rem;
}

.product-more-fanely:hover { 
  text-decoration: underline; 
}

.product-footer-fanely {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.product-price-fanely {
  font-size: 1.4rem;
  font-weight: 900;
  color: #111;
}

.product-actions-fanely {
  display: flex;
  gap: 8px;
}

.btn-detail-fanely {
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.82rem;
  color: #666;
  cursor: pointer;
  transition: border-color 0.2s;
}

.btn-detail-fanely:hover { 
  border-color: #007bff; 
  color: #007bff; 
}

.btn-add-fanely {
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-add-fanely:hover:not(:disabled) { 
  background: #7c3aed; 
}

.btn-add-fanely.in-cart {
  background: #10b981;
  cursor: default;
}

.btn-add-fanely:disabled { 
  opacity: 0.8; 
  cursor: default; 
}

/* CARRITO LATERAL */
.cart-panel-fanely {
  width: 320px;
  min-width: 300px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 120px);
  overflow: hidden;
}

.cart-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #f0f0f0;
}

.cart-panel-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #111;
}

.cart-modal-count {
  color: #007bff;
  font-size: 1rem;
}

/* =============================================
   MODAL DE DETALLE - X VISIBLE
   ============================================= */

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #f0f0f0;  /* Fondo gris claro para contraste */
  border: 1px solid #ddd; /* Borde sutil */
  border-radius: 50%;
  width: 17px;
  height: 17px;
  cursor: pointer;
  color: #333;  /* Color oscuro para la X */
  font-size: 1.2rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Sombra suave */
  z-index: 10;
}

.modal-close-btn:hover { 
  background: #fff;  /* Rojo al hacer hover */
  color: #007bff;
  border-color: #fff;
  transform: scale(1.1); /* Efecto de crecimiento */
}

.cart-empty-fanely {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  gap: 8px;
  color: #aaa;
}

.cart-empty-fanely span { 
  font-size: 2.5rem; 
}

.cart-empty-fanely p { 
  margin: 0; 
  font-weight: 600; 
  color: #666; 
}

.cart-empty-sub { 
  font-size: 0.85rem !important; 
  color: #aaa !important; 
  font-weight: 400 !important; 
}

.cart-items-fanely {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  max-height: 320px;
  padding: 8px 0;
}

.cart-item-fanely {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid #f9f9f9;
}

.cart-item-fanely:hover { 
  background: #fafafa; 
}

.cart-item-icon { 
  font-size: 1.4rem; 
  flex-shrink: 0; 
}

.cart-item-info { 
  flex: 1; 
}

.cart-item-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 2px;
}

.cart-item-subtitle {
  font-size: 0.78rem;
  color: #aaa;
  margin-bottom: 4px;
}

.cart-item-price {
  font-size: 0.85rem;
  color: #007bff;
  font-weight: 600;
}

.cart-item-remove {
  background: #f3f4f6;
  border: none;
  border-radius: 6px;
  padding: 6px 9px;
  cursor: pointer;
  color: #aaa;
  font-size: 0.8rem;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.cart-item-remove:hover { 
  background: #fee2e2; 
  color: #e53e3e; 
}

/* RESUMEN Y CHECKOUT */
.cart-summary-fanely {
  padding: 20px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: #666;
}

.cart-summary-row.total {
  font-size: 1rem;
  font-weight: 800;
  color: #111;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.btn-checkout-fanely {
  width: 100%;
  background: linear-gradient(135deg, #007bff, #6d28d9);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-top: 4px;
}

.btn-checkout-fanely:hover { 
  opacity: 0.9; 
}

.cart-secure-note {
  text-align: center;
  color: #aaa;
  font-size: 0.78rem;
  margin: 0;
}

/* MODAL DE DETALLE */
.product-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.product-modal-fanely {
  background: #fff;
  border-radius: 20px;
  padding: 36px;
  max-width: 480px;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #f3f4f6;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: #666;
  font-size: 0.9rem;
}

.modal-close-btn:hover { 
  background: #e5e7eb; 
}

.modal-icon { 
  font-size: 3rem; 
}

.modal-name { 
  font-size: 1.4rem; 
  font-weight: 800; 
  margin: 0; 
  color: #111; 
}

.modal-subtitle { 
  color: #007bff; 
  font-weight: 600; 
  font-size: 0.9rem; 
  margin: 0; 
}

.modal-desc { 
  color: #555; 
  font-size: 0.9rem; 
  margin: 0; 
  line-height: 1.6; 
}

.modal-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-features li { 
  font-size: 0.88rem; 
  color: #444; 
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
  flex-wrap: wrap;
  gap: 12px;
}

.modal-price {
  font-size: 1.6rem;
  font-weight: 900;
  color: #111;
}

/* MODAL DE CARRITO */
.cart-modal-fanely {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.cart-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px 20px;
  border-bottom: 1px solid #f0f0f0;
}

.cart-modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: #111;
}

.cart-modal-items {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 8px 0;
  flex: 1;
}

.cart-modal-summary {
  padding: 20px 28px 24px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .shop-layout-fanely { 
    flex-direction: column; 
  }
  
  .cart-panel-fanely { 
    width: 100%; 
    position: static; 
    max-height: none; 
  }
  
  .products-grid-fanely.with-cart { 
    grid-template-columns: 1fr; 
  }
}
