/*
================================================================================
MERCADONA AGENT - ENHANCEMENTS STYLESHEET
================================================================================
Description: Mejoras visuales y funcionales según plan de mejoras
Last Updated: 2026-03-22
================================================================================
*/

/* =====================================================
   ENHANCED PRODUCT CARDS
   ===================================================== */

/* Savings badge */
.product-savings-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
  z-index: 2;
  animation: pulse-savings 2s ease-in-out infinite;
}

@keyframes pulse-savings {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Pack badge */
.product-pack-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(34, 197, 94, 0.9);
  backdrop-filter: blur(8px);
  color: white;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 2;
}

.product-pack-badge i {
  font-size: 0.8rem;
}

/* Best value badge */
.product-best-value-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: white;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
  z-index: 3;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
  }
  50% {
    box-shadow: 0 4px 16px rgba(236, 72, 153, 0.6);
  }
}

/* Reference price */
.product-reference-price {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
  font-weight: 500;
}

/* Price info container */
.product-price-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Enhanced price display */
.product-card-price {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Mini sparkline container */
.product-sparkline-container {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

.product-sparkline {
  width: 100%;
  height: 30px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 4px 0;
}

.sparkline-bar {
  flex: 1;
  background: var(--color-primary);
  opacity: 0.6;
  border-radius: 2px 2px 0 0;
  transition: all 0.2s ease;
  position: relative;
}

.sparkline-bar.up {
  background: #ef4444;
}

.sparkline-bar.down {
  background: #22c55e;
}

.sparkline-bar:hover {
  opacity: 1;
  transform: scaleY(1.1);
}

.sparkline-label {
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 2px;
}

/* Enhanced card hover effect */
.product-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* Product info details */
.product-info-details {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
  line-height: 1.4;
}

.product-info-details i {
  font-size: 0.7rem;
  margin-right: 4px;
  opacity: 0.7;
}

/* =====================================================
   ADVANCED FILTERS
   ===================================================== */

.advanced-filters-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.filter-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.filter-chip {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.filter-chip:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.filter-chip.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.filter-chip i {
  font-size: 0.9rem;
}

.filter-chip-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.filter-chip.active .filter-chip-count {
  background: rgba(255, 255, 255, 0.3);
}

/* Smart filters */
.smart-filters-section {
  margin-top: 16px;
}

.smart-filters-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =====================================================
   GLASSMORPHISM THEME
   ===================================================== */

.glass-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

[data-theme="dark"] .glass-card {
  background: rgba(17, 24, 39, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.glass-header {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .glass-header {
  background: rgba(17, 24, 39, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Gradients */
.gradient-bg {
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
}

[data-theme="dark"] .gradient-bg {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

.gradient-primary {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.gradient-secondary {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
}

/* =====================================================
   LOADING SKELETONS
   ===================================================== */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 0%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-card {
  width: 100%;
  height: 100%;
  min-height: 300px;
}

.skeleton-image {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.skeleton-text {
  height: 16px;
  margin: 8px 0;
  border-radius: 4px;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-price {
  height: 24px;
  width: 80px;
  margin-top: 12px;
}

/* =====================================================
   COMPARISON MODE
   ===================================================== */

.compare-checkbox {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 24px;
  height: 24px;
  background: white;
  border: 2px solid var(--color-primary);
  border-radius: 6px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 4;
  transition: all 0.2s ease;
}

.comparison-mode .compare-checkbox {
  display: flex;
}

.compare-checkbox.checked {
  background: var(--color-primary);
}

.compare-checkbox.checked::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: white;
  font-size: 0.75rem;
}

.compare-fab {
  position: fixed;
  bottom: 80px;
  right: 24px;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: white;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: all 0.3s ease;
}

.compare-fab.visible {
  display: flex;
}

.compare-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(139, 92, 246, 0.5);
}

.compare-fab-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid white;
}

/* =====================================================
   PRICE ALERTS
   ===================================================== */

.price-alert-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #3b82f6;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  z-index: 2;
  animation: bell-ring 2s ease-in-out infinite;
}

@keyframes bell-ring {
  0%, 100% {
    transform: rotate(0deg);
  }
  10%, 30% {
    transform: rotate(-10deg);
  }
  20%, 40% {
    transform: rotate(10deg);
  }
  50% {
    transform: rotate(0deg);
  }
}

.price-dropped-badge {
  position: absolute;
  top: 40px;
  right: 8px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
  z-index: 2;
  animation: drop-bounce 1s ease-out;
}

@keyframes drop-bounce {
  0% {
    transform: translateY(-20px);
    opacity: 0;
  }
  50% {
    transform: translateY(5px);
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* =====================================================
   ENHANCED PRODUCT MODAL
   ===================================================== */

.product-detail-enhanced {
  max-width: 100%;
}

.product-detail-enhanced .product-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.badge-new {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-discount {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* Product Tabs */
.product-tabs {
  display: flex;
  gap: 8px;
  margin: 24px 0 16px;
  border-bottom: 2px solid var(--border-color);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.product-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-tab:hover {
  color: var(--color-primary);
  background: rgba(34, 197, 94, 0.05);
}

.product-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

.product-tabs-content {
  min-height: 200px;
  padding: 20px 0;
}

.product-tab-panel {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.product-tab-panel.active {
  display: block;
}

/* Product Details Grid */
.product-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.detail-item {
  background: var(--bg-secondary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.detail-item.warning {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #d97706;
}

.detail-item i {
  font-size: 1.1rem;
  color: var(--color-primary);
}

.detail-item.warning i {
  color: #d97706;
}

/* Price History Summary */
.price-history-summary {
  display: flex;
  gap: 24px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.price-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.price-stat span {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.price-stat strong {
  font-size: 1.5rem;
  color: var(--color-primary);
  font-weight: 700;
}

.price-history-note {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 8px;
}

.text-muted {
  color: var(--text-secondary);
  font-style: italic;
}

/* Modal Actions */
.product-detail-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.product-detail-actions .btn {
  flex: 1;
}

.product-detail-actions .btn--secondary:last-child {
  flex: 0 0 auto;
  min-width: 48px;
  padding: 0;
}

/* =====================================================
   RESPONSIVE ADJUSTMENTS
   ===================================================== */

@media (max-width: 768px) {
  .product-savings-badge {
    font-size: 0.7rem;
    padding: 3px 6px;
  }

  .product-pack-badge {
    font-size: 0.65rem;
    padding: 3px 8px;
  }

  .product-best-value-badge {
    font-size: 0.65rem;
    padding: 4px 8px;
  }

  .compare-fab {
    bottom: 70px;
    right: 16px;
    width: 48px;
    height: 48px;
  }
}

/* =====================================================
   MICRO-ANIMATIONS
   ===================================================== */

@keyframes pop-in {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.pop-animation {
  animation: pop-in 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Cart button animation */
.product-card-cart-btn.adding {
  animation: pop-in 0.3s ease-out;
}

/* =====================================================
   UTILITY CLASSES
   ===================================================== */

.text-gradient {
  background: linear-gradient(135deg, var(--color-primary), #16a34a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer-slide 2s infinite;
}

@keyframes shimmer-slide {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}
