/* ============================================
   PRICE HISTORY BUTTON & MODAL
   ============================================ */

/* Botões base (usado na página do produto) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn--primary {
  background: var(--accent-orange);
  color: #fff;
}

.btn--primary:hover {
  background: #e55a00;
  transform: translateY(-1px);
}

.btn--secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn--secondary:hover {
  border-color: var(--accent-orange);
  background: rgba(255, 255, 255, 0.14);
}

.btn--large {
  padding: 14px 24px;
  font-size: 15px;
}

.btn-price-history {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255, 101, 0, 0.1);
  border: 1px solid var(--accent-orange);
  border-radius: 20px;
  color: var(--accent-orange);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 8px;
}

.btn-price-history:hover {
  background: var(--accent-orange);
  color: #fff;
}

.btn-price-history svg {
  width: 14px;
  height: 14px;
}

/* Botões do Card */
.product-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  position: relative;
  z-index: 3;
}

.product-card__actions .btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.product-card__actions .btn--primary {
  background: var(--accent-orange);
  color: #fff;
}

.product-card__actions .btn--primary:hover {
  background: #e55a00;
  transform: translateY(-1px);
}

.product-card__actions .btn--secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.product-card__actions .btn--secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--accent-orange);
}

.product-card__actions .btn svg {
  width: 14px;
  height: 14px;
}

/* Links do card */
.product-card__image-link,
.product-card__title-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.product-card__title-link:hover .product-card__title {
  color: var(--accent-orange);
}

/* Ícone da loja no badge */
.badge--store-ml::before { content: "🛒 "; }
.badge--store-shopee::before { content: "🛍️ "; }
.badge--store-amazon::before { content: "📦 "; }
.badge--store-magalu::before { content: "🏪 "; }

/* Price History Modal */
.price-history-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.price-history-modal.active {
  display: flex;
}

.price-history-modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.price-history-modal__content {
  position: relative;
  background: var(--bg-secondary);
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  display: flex;
  flex-direction: column;
}

.price-history-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  z-index: 10;
}

.price-history-modal__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.price-history-modal__header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border-color);
}

.price-history-modal__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.price-history-modal__subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 8px 0 0;
  line-height: 1.4;
}

.price-history-modal__body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.price-history-modal__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 16px;
}

.price-history-modal__loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 101, 0, 0.3);
  border-top-color: var(--accent-orange);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.price-history-modal__chart {
  margin-bottom: 24px;
}

.price-history-modal__chart svg {
  width: 100%;
  height: auto;
}

.price-history-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.price-history-stat {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 8px;
  text-align: center;
}

.price-history-stat__label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.price-history-stat__value {
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.price-history-stat__value--current {
  color: var(--accent-orange);
}

.price-history-stat__value--low {
  color: var(--accent-green);
}

.price-history-stat__value--good {
  color: var(--accent-green);
}

.price-history-stat__value--bad {
  color: #FF4444;
}

.price-history-recommendation {
  background: rgba(255, 101, 0, 0.1);
  border: 1px solid var(--accent-orange);
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}

.price-history-modal__error {
  text-align: center;
  padding: 40px;
  color: #FF4444;
}

.price-history-modal__footer {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border-color);
}

.price-history-modal__buy-btn {
  display: block;
  width: 100%;
  text-align: center;
}

@media (max-width: 480px) {
  .price-history-modal__content {
    width: 95%;
    max-height: 95vh;
  }

  .price-history-stats {
    grid-template-columns: 1fr;
  }
}
