/**
 * Checkout - Estilos da página de finalização de compra
 * Otimizado para conversão e confiança
 */

/* =============== Variáveis =============== */
:root {
  --checkout-primary: #0056b3;
  --checkout-success: #28a745;
  --checkout-warning: #ffc107;
  --checkout-danger: #dc3545;
  --checkout-light: #f8f9fa;
  --checkout-border: #dee2e6;
}

/* =============== Progress Steps =============== */
.checkout-progress {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.checkout-progress .progress-step {
  flex: 1;
  position: relative;
  text-align: center;
  font-size: 0.875rem;
  color: #6c757d;
}

.checkout-progress .progress-step::before {
  counter-increment: step;
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 auto 0.5rem;
  border-radius: 50%;
  background: #e9ecef;
  color: #6c757d;
  font-weight: 600;
  transition: all 0.3s;
}

.checkout-progress .progress-step::after {
  content: '';
  position: absolute;
  top: 20px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: #e9ecef;
  z-index: -1;
}

.checkout-progress .progress-step:last-child::after {
  display: none;
}

.checkout-progress .progress-step.active::before {
  background: var(--checkout-primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(0, 86, 179, 0.1);
}

.checkout-progress .progress-step.completed::before {
  background: var(--checkout-success);
  color: #fff;
  content: '\f00c';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
}

.checkout-progress .progress-step.completed::after {
  background: var(--checkout-success);
}

.checkout-progress .progress-step.active {
  color: var(--checkout-primary);
  font-weight: 600;
}

.checkout-progress .progress-step.completed {
  color: var(--checkout-success);
}

/* Mobile: steps mais compactos */
@media (max-width: 576px) {
  .checkout-progress .progress-step::before {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
  }

  .checkout-progress .progress-step {
    font-size: 0.75rem;
  }

  .checkout-progress .progress-step span {
    display: none; /* Esconde o texto em telas muito pequenas */
  }
}

/* =============== Price Box =============== */
.price-box {
  background: linear-gradient(135deg, var(--checkout-primary) 0%, #003d82 100%);
  color: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 86, 179, 0.2);
}

.price-option {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.price-option:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.price-label {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.price-value {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.price-installment {
  font-size: 0.9rem;
  opacity: 0.9;
}

.price-discount {
  background: var(--checkout-warning);
  color: #000;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  margin-left: 0.5rem;
  display: inline-block;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =============== Payment Options =============== */
.checkout-card-body > .row {
  display: flex;
  align-items: stretch;
}

.checkout-card-body > .row > [class*="col-"] {
  display: flex;
}

.payment-option {
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid var(--checkout-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  position: relative;
  background: #fff;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.payment-option:hover {
  border-color: var(--checkout-primary);
  box-shadow: 0 4px 12px rgba(0, 86, 179, 0.15);
  transform: translateY(-2px);
}

.payment-option.selected {
  border-color: var(--checkout-primary);
  background: linear-gradient(135deg, rgba(0, 86, 179, 0.04) 0%, rgba(0, 86, 179, 0.08) 100%);
  box-shadow: 0 0 0 0.2rem rgba(0, 86, 179, 0.15);
}

.payment-option.selected .payment-option-icon {
  color: var(--checkout-primary);
}

.payment-option input[type="radio"] {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: var(--checkout-primary);
}

.payment-option-icon {
  font-size: 2rem;
  color: #6c757d;
  margin-bottom: 0.75rem;
  line-height: 1;
}

.payment-option-icon svg {
  vertical-align: middle;
}

.payment-option.selected .payment-option-icon,
.payment-option:hover .payment-option-icon {
  color: var(--checkout-primary);
}

.payment-option-icon.pix-icon svg {
  fill: currentColor;
}

.payment-option-title {
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
  color: #212529;
}

.payment-option-desc {
  font-size: 0.875rem;
  color: #6c757d;
  margin-bottom: 0;
}

.payment-option .mt-3 {
  margin-top: auto !important;
}

/* =============== Installment Select =============== */
.installment-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--checkout-border);
  border-radius: 8px;
  margin-top: 1rem;
  background: #fff;
  font-size: 0.95rem;
  transition: all 0.3s;
}

.installment-select:focus {
  border-color: var(--checkout-primary);
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(0, 86, 179, 0.15);
}

.installment-select option {
  padding: 0.75rem;
}

/* =============== Trust Signals =============== */
.trust-signals {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--checkout-light);
  border-radius: 8px;
  margin: 1.5rem 0;
}

.trust-signal {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #495057;
}

.trust-signal i {
  font-size: 1.25rem;
  color: var(--checkout-success);
}

@media (max-width: 768px) {
  .trust-signals {
    flex-direction: column;
    gap: 1rem;
  }

  .trust-signal {
    width: 100%;
    justify-content: center;
  }
}

/* =============== Course Preview =============== */
.course-preview {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--checkout-border);
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.course-preview-image {
  flex: 0 0 120px;
  width: 120px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--checkout-light);
}

.course-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.course-preview-content {
  flex: 1;
  min-width: 0;
}

.course-preview-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  color: #212529;
}

.course-preview-author {
  font-size: 0.875rem;
  color: #6c757d;
  margin-bottom: 0;
}

/* =============== Coupon Section =============== */
.coupon-section {
  background: #fff;
  border: 2px dashed var(--checkout-border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.coupon-section.has-discount {
  border-color: var(--checkout-success);
  background: rgba(40, 167, 69, 0.03);
}

.coupon-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.coupon-header i {
  font-size: 1.5rem;
  color: var(--checkout-primary);
}

.coupon-input-group {
  display: flex;
  gap: 0.5rem;
}

.coupon-input-group input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--checkout-border);
  border-radius: 6px;
  font-size: 0.95rem;
}

.coupon-input-group button {
  white-space: nowrap;
}

/* =============== Summary Box =============== */
.summary-box {
  background: #fff;
  border: 1px solid var(--checkout-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  position: sticky;
  top: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--checkout-border);
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-row.total {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--checkout-primary);
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 2px solid var(--checkout-border);
}

.summary-label {
  font-size: 0.95rem;
  color: #495057;
}

.summary-value {
  font-weight: 600;
  color: #212529;
}

.summary-value.discount {
  color: var(--checkout-success);
}

/* =============== Submit Button =============== */
.btn-checkout {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.btn-checkout:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-checkout.loading {
  color: transparent;
  pointer-events: none;
}

.btn-checkout.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-left: -10px;
  margin-top: -10px;
  border: 3px solid #fff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spinner 0.6s linear infinite;
}

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

/* =============== Alert Styles =============== */
.alert-checkout {
  border-radius: 8px;
  border: none;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.alert-checkout i {
  margin-right: 0.5rem;
}

/* =============== Card Styles =============== */
.checkout-card {
  border: 1px solid var(--checkout-border);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.checkout-card-header {
  background: var(--checkout-light);
  border-bottom: 1px solid var(--checkout-border);
  padding: 1.25rem;
  font-weight: 600;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.checkout-card-header i {
  color: var(--checkout-primary);
  font-size: 1.25rem;
}

.checkout-card-body {
  padding: 1.5rem;
}

/* =============== Responsive =============== */
@media (max-width: 768px) {
  .price-box {
    padding: 1.25rem;
    margin-bottom: 1.25rem;
  }

  .price-value {
    font-size: 1.5rem;
  }

  .summary-box {
    position: static;
  }

  .course-preview {
    flex-direction: column;
  }

  .course-preview-image {
    flex: 0 0 auto;
    width: 100%;
    height: 150px;
  }
}

/* =============== Accessibility =============== */
.payment-option:focus-within {
  outline: 2px solid var(--checkout-primary);
  outline-offset: 2px;
}

/* =============== Animations =============== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeIn 0.4s ease-out;
}

/* =============== Loading States =============== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

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

/* =============== Performance - Reduce Motion =============== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
