/* Product Detail Styles */
.breadcrumbs {
    padding: 15px 20px;
    background-color: white;
    margin-top: 85px; /* Increased from 70px to 80px */
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.breadcrumbs a {
    color: var(--primary);
    text-decoration: none;
}

.detail-container {
    max-width: 1200px;
    margin: 20px auto;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    padding: 0 20px;
}

.product-detail {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    grid-template-areas: 
        "left center"
        "actions actions";
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    gap: 30px;
}

.detail-left {
    flex: 0 0 40%;
}

.detail-center {
    flex: 1;
}

.product-gallery {
    position: relative;
}

.main-image {
    position: relative;
    text-align: center;
    margin-bottom: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
}

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

.thumbnail-container {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.thumbnail {
    width: 70px;
    height: 70px;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 2px;
    cursor: pointer;
    background: none;
}

.thumbnail.active {
    border-color: var(--primary);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
}

.product-name {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: var(--dark);
}

.product-description {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}



.price-container {
    display: flex;
    align-items: center;
    margin: 25px 0;
    gap: 15px;
}

.price-group {
    display: flex;
    flex-direction: column;
}

.original-price {
    text-decoration: line-through;
    color: #999;
    font-size: 1rem;
}

.promo-price {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary);
}

.discount {
    color: purple;
    font-weight: bold;
    white-space: nowrap;
    /* No permite saltos de línea */
    font-size: clamp(1.5rem, 2vw, 2rem);
    /* Reducido el mínimo a 0.9rem para asegurar visibilidad */
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    /* Asegura que el texto pueda encogerse */
    flex-shrink: 1;
    /* Permite que el elemento se encoja si es necesario */
}

.marketplace {
  display: flex;
  align-items: center;
  gap: 8px;            /* ✅ AÑADIR: espacio consistente entre elementos */
  margin: 16px 0;
  font-size: 14px;
  color: #666;
}

.marketplace-icon {
  width: 100px;          /* ✅ CAMBIO: aumentar de ~20px a 32px */
  height: 100px;         /* ✅ CAMBIO: aumentar de ~20px a 32px */
  object-fit: contain;
  margin-right: 2px;
  vertical-align: middle;
}

.last-updated,
.delivery-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.quality-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.quality-rating .quality-label {
    margin-right: 8px;
}

.quality-rating .stars-container {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stars {
    color: #ffc107;
}

.rating-number {
    font-weight: 600;
}

.product-actions {
    grid-area: actions;
    margin-top: 10px;
    display: flex;
    justify-content: center;
    width: 100%;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-primary:hover {
    background-color: #5928ce;
}

.btn-secondary {
    background-color: white;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background-color: #f5f0ff;
}

/* Tag styling */
.tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Marketplace comparisons */
.marketplace-comparisons {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
}

.marketplace-comparisons h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.comparison-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.comparison-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #eee;
    transition: transform 0.2s;
}

.comparison-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
}

.comparison-item.best-price {
    background-color: #f5f9ff;
    border-color: #c9e0ff;
}

.comparison-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.comparison-icon {
    width: 30px;
    height: auto;
}

.comparison-marketplace {
    display: flex;
    flex-direction: column;
}

.comparison-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.comparison-delivery {
    font-size: 0.75rem;
    color: #666;
}

.comparison-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.comparison-original-price {
    text-decoration: line-through;
    color: #999;
    font-size: 0.8rem;
}

.comparison-promo-price {
    font-weight: bold;
    color: var(--primary);
    font-size: 1.1rem;
}

.comparison-button {
    display: block;
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    padding: 5px 10px;
    border-radius: 3px;
    text-decoration: none;
    margin-top: 5px;
    transition: background 0.2s;
}

.comparison-button:hover {
    background: #5928ce;
}

/* Estilos para variantes */
.product-variants-container {
  margin-bottom: 20px;
}

.variant-group {
  margin-bottom: 24px;
}

.variant-title {
  font-weight: 600;
  font-size: 16px;
  color: #333;
  margin-bottom: 12px;
}


.variant-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.variant-option {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}

.variant-option:hover {
  border-color: rgba(103, 58, 183, 0.5); /* Color primario más transparente */
  background-color: rgba(245, 240, 255, 0.5); /* Fondo hover más sutil */
}

.variant-option.selected {
  border-color: #673ab7; /* ✅ CAMBIO: Borde morado consistente */
  background-color: rgba(103, 58, 183, 0.1); /* ✅ CAMBIO: Fondo transparente con tinte morado */
  color: #5a28ce; /* ✅ CAMBIO: Texto morado más oscuro cuando seleccionado */
  font-weight: 600; /* ✅ CAMBIO: Texto más bold cuando seleccionado */
  box-shadow: 0 0 0 1px rgba(103, 58, 183, 0.3); /* ✅ AÑADIR: Sombra de selección */
}

/* Variantes de color especiales */
.variant-option.color-variant {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}


/* Estilos para notificación de variante alternativa */
.variant-notification {
  background-color: #fff3cd;
  color: #856404;
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
  font-size: 14px;
  animation: fadeIn 0.3s ease;
  border-left: 3px solid #ffeeba;
}

.variant-notification.fade-out {
  opacity: 0;
  transition: opacity 0.5s ease;
}

/* Efecto visual para variantes seleccionadas automáticamente */
.variant-option.auto-selected {
  border-color: rgba(255, 193, 7, 0.6); /* Amarillo más tenue */
  position: relative;
}

.variant-option.auto-selected::after {
  background: rgba(255, 193, 7, 0.7); /* Indicador más suave */
}

/* Variantes de texto (storage, ram, etc.) */
.variant-option:not(.color-variant) {
  padding: 12px 16px;
  min-width: auto;
}

.variant-option:not(.color-variant) span {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.variant-option.selected:not(.color-variant) span {
  color: #3b82f6;
}

.color-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-bottom: 4px;
  border: 1px solid #e0e0e0;
  opacity: 0.9; /* Ligeramente más suave */
}

/* Animación de aparición */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Colores específicos - puedes ampliar según necesites */
.color-titanio-negro { background-color: #2a2a2a; }
.color-titanio-blanco { background-color: #f5f5f5; }
.color-titanio-natural { background-color: #d4c5b3; }
.color-titanio-azul { background-color: #394c6a; }

/* Estilos para estados de carga y error en variantes */
.variant-option.loading {
  opacity: 0.6;
  pointer-events: none;
}

.variant-option.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #3b82f6;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.variant-option.error {
  border-color: #dc3545;
  background-color: rgba(220, 53, 69, 0.1);
  animation: shake 0.5s;
}

/* Estilos específicos para variantes de color con imagen */
.color-variant {
  min-width: 80px;
  padding: 6px;
}

.variant-image-container {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f9fafb;
}

.variant-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.variant-label {
  font-size: 12px;
  color: #374151;
  text-align: center;
  margin-top: 4px;
  line-height: 1.2;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

/* Estilos para estado de carga */
.product-detail.loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}

.variant-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  margin-top: 10px;
  font-size: 14px;
  color: #333;
}

.variant-error-message {
  background-color: #ffebee;
  color: #c62828;
  padding: 10px;
  border-radius: 4px;
  margin: 10px 0;
  text-align: center;
  display: none;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.price.promo-price span { font-weight: 700; }
.comparison-promo-price { font-weight: 700; }

/* Responsive styles */
@media (max-width: 992px) {
    .detail-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {

  .specs-table.collapsed tbody tr:nth-child(n+3) { display: none; }
  
  .specs-toggle-btn {
    margin-top: 8px;
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 600;
  }
    
    .breadcrumbs {
        margin-top: 85px; /* Adjusted for mobile */
        padding: 12px 15px; /* Slightly reduced padding on mobile */
    }
    
    .product-detail {
        flex-direction: column;
        padding: 15px;
    }
    
    .detail-left {
        flex: none;
        width: 100%;
    }
    
    .main-image img {
        max-height: 300px;
    }
    
    .product-name {
        font-size: 1.5rem;
    }
    
    .promo-price {
        font-size: 1.5rem;
    }
    
    .product-actions {
        flex-direction: column;
    }
}

/* Actualizar media query para responsive */
@media (max-width: 768px) {
    .product-detail {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "left"
            "center"
            "actions";
        padding: 15px;
    }
    
    .product-actions {
        margin-top: 15px;
    }

    .variant-options {
    gap: 8px;
    }
  
    .color-variant {
        min-width: 70px;
    }
    
    .variant-image-container {
        width: 45px;
        height: 45px;
    }
    
    .variant-label {
        font-size: 11px;
        max-width: 65px;
    }
}

/* Unificar tipografía con product-description - selectores específicos */
.detail-center .marketplace span,
.detail-center .delivery-info span,
.detail-center .quality-rating .quality-label,
.detail-center .last-updated span {
    font-size: 1rem !important;
    line-height: 1.6 !important;
    color: #666 !important;
    font-weight: 400 !important;
}

/* Mantener las estrellas y número del mismo tamaño */
.detail-center .quality-rating .rating-number,
.detail-center .quality-rating .stars {
    font-size: 1rem !important;
}

/* Destacar los valores específicos pero con el mismo tamaño base */
.detail-center .last-updated-date {
    font-size: 1rem !important;
    font-weight: 500 !important;
    color: #333 !important;
}

.verified-badge svg {
    width: auto;
    height: auto;
  }
.verified-badge img { 
display: inline-block; 
vertical-align: text-bottom; 
}
  
  .detail-center .marketplace .verified-badge {
      margin-left: -6px; /* reduce el gap (8px - 6px = ~2px) */
  }

.last-updated span,
.delivery-info span,
.quality-rating .quality-label {
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    color: #666;
}

.last-updated-date {
    font-style: italic !important;
    font-weight: 500 !important;
    color: #333 !important;
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
    border: 1.55px solid #565657;
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.specs-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.specs-table tr:nth-child(odd) {
    background-color: #ffffff;
}

.specs-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
}

.specs-table .spec-key {
    font-weight: 600;
    color: #495057;
    width: 40%;
    min-width: 140px;
}

.specs-table .spec-value {
    color: #6c757d;
    word-break: break-word;
}

.specs-table .spec-single {
    font-weight: 500;
    color: #495057;
}

.specs-table tr:last-child td {
    border-bottom: none;
}