/* ========================================
   SMART BUY BOX - MODAL COMPARADOR
   ======================================== */

/* ── Modal Overlay ── */
.ef-buybox-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ef-buybox-modal.hidden {
  display: none;
}

.ef-buybox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1;
}

/* ── Modal Container ── */
.ef-buybox-container {
  position: relative;
  z-index: 2;
  background: #fff;
  border-radius: 12px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.ef-buybox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 2rem;
  color: #999;
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s;
}

.ef-buybox-close:hover {
  color: #333;
}

/* ── Content ── */
.ef-buybox-content {
  padding: 32px;
}

.ef-buybox-header {
  margin-bottom: 24px;
  text-align: center;
}

.ef-buybox-header h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: #0f1e5a;
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.ef-buybox-subheader {
  font-size: 0.85rem;
  color: #999;
  font-family: 'IBM Plex Mono', monospace;
  margin: 0;
}

/* ── Savings Alert ── */
.ef-buybox-savings {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #E8F5E9;
  border: 1px solid #81C784;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 24px;
  color: #2E7D32;
  font-weight: 600;
  font-size: 0.95rem;
}

.ef-savings-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

/* ── Options Grid ── */
.ef-buybox-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* ── Single Option Card ── */
.ef-buybox-option {
  position: relative;
  background: #f9f9f9;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ef-buybox-option:hover {
  border-color: #00AECC;
  background: #f5fbfd;
}

.ef-buybox-option.selected {
  border-color: #1B2F8A;
  background: #f0f5ff;
  box-shadow: 0 4px 12px rgba(27, 47, 138, 0.15);
}

.ef-buybox-option.ef-best {
  border-color: #00AECC;
  background: linear-gradient(135deg, #f0fbfd 0%, #e3f8fc 100%);
}

/* Best Badge */
.ef-best-badge {
  position: absolute;
  top: -10px;
  left: 16px;
  background: #00AECC;
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px rgba(0, 174, 204, 0.25);
}

/* Option Header */
.ef-option-header {
  padding-top: 4px;
}

.ef-option-header h4 {
  font-weight: 700;
  color: #0f1e5a;
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.ef-option-location {
  font-size: 0.85rem;
  color: #666;
  margin: 0;
}

/* Option Details */
.ef-option-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  padding: 14px 0;
}

.ef-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.ef-detail-label {
  color: #999;
  font-weight: 600;
}

.ef-detail-value {
  color: #333;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
}

/* Option Total */
.ef-option-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #ddd;
}

.ef-total-label {
  font-size: 0.9rem;
  color: #666;
  font-weight: 600;
}

.ef-total-price {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: #1B2F8A;
}

/* Option Button */
.ef-option-select-btn {
  background: #ddd;
  color: #666;
  border: none;
  padding: 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ef-buybox-option:hover .ef-option-select-btn {
  background: #1B2F8A;
  color: #fff;
}

.ef-buybox-option.selected .ef-option-select-btn {
  background: #00AECC;
  color: #fff;
}

/* ── Footer ── */
.ef-buybox-footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid #e0e0e0;
}

.ef-selected-info {
  background: #E3F2FD;
  border: 1px solid #90CAF9;
  border-radius: 6px;
  padding: 12px 16px;
  color: #0D47A1;
  font-size: 0.95rem;
}

.ef-selected-info p {
  margin: 0;
}

.ef-buybox-select-btn {
  background: #1B2F8A;
  color: #fff;
  border: none;
  padding: 16px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ef-buybox-select-btn:hover:not(:disabled) {
  background: #00AECC;
}

.ef-buybox-select-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Error/Success States ── */
.ef-buybox-error,
.ef-buybox-success {
  padding: 32px;
  text-align: center;
  border-radius: 8px;
  font-size: 1rem;
}

.ef-buybox-error {
  background: #FFEBEE;
  color: #C62828;
  border: 1px solid #FFCDD2;
}

.ef-buybox-error p,
.ef-buybox-success p {
  margin: 0;
  font-weight: 600;
}

.ef-buybox-success {
  background: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #81C784;
}

.ef-buybox-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px 24px;
  text-align: center;
}

.ef-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #f0f0f0;
  border-top-color: #00AECC;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Responsive ── */
@media (max-width: 768px) {
  .ef-buybox-container {
    max-height: 95vh;
  }

  .ef-buybox-content {
    padding: 20px;
  }

  .ef-buybox-header h3 {
    font-size: 1.4rem;
  }

  .ef-buybox-options {
    grid-template-columns: 1fr;
  }

  .ef-option-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .ef-option-total {
    grid-column: 1 / -1;
  }

  .ef-total-price {
    font-size: 1.4rem;
  }
}

@media (max-width: 480px) {
  .ef-buybox-container {
    max-width: 100%;
    border-radius: 8px;
  }

  .ef-buybox-content {
    padding: 16px;
  }

  .ef-buybox-header h3 {
    font-size: 1.2rem;
  }

  .ef-buybox-close {
    top: 12px;
    right: 12px;
    font-size: 1.5rem;
  }

  .ef-buybox-select-btn {
    padding: 14px;
    font-size: 0.95rem;
  }

  .ef-option-details {
    grid-template-columns: 1fr;
  }
}
