:root {
  --primary-color: #03b4ae;
  --primary-dark: #029a95;
  --background-color: #f0f2f5;
  --card-bg: #ffffff;
  --text-color: #333333;
  --text-muted: #666666;
  --border-color: #d5d5d5;
  --success-color: #28a745;
  --error-color: #dc3545;
  --border-radius: 8px;
  --spacing: 16px;
  --font-family: "Roboto", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Top Bar */
.top-bar {
  background-color: #864ee9;
  color: white;
  padding: 8px 0;
  overflow: hidden;
  position: relative;
  font-size: 0.8rem;
  font-weight: bold;
  text-transform: uppercase;
  white-space: nowrap;
}

.marquee {
  display: inline-block;
  white-space: nowrap;
  animation: marquee 30s linear infinite;
}

.marquee span {
  display: inline-block;
  white-space: nowrap;
}

@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(
      -50%
    ); /* Move half width since content is duplicated */
  }
}

/* Header */
.checkout-header {
  background-color: #fff;
  padding: 10px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  margin-top: 10px; /* Add space from top bar */
}

.container {
  width: 100%;
  max-width: 600px; /* Mobile-first container constraint */
  margin: 0 auto;
  padding: 0 var(--spacing);
}

.header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-content i {
  font-size: 24px;
  color: var(--text-color);
}

.header-text {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.header-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.header-product {
  color: var(--text-color);
}

/* Main Content */
main {
  padding-bottom: 40px;
}

.promo-banner {
  margin: var(--spacing) 0;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.promo-banner img {
  width: 100%;
  display: block;
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  margin-bottom: var(--spacing);
  overflow: hidden;
}

.card-header {
  background-color: #f8f9fa;
  padding: 12px var(--spacing);
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-badge {
  background-color: #864ee9;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
}

.card-header h2 {
  font-size: 0.9rem;
  color: #999;
  font-weight: 700;
  text-transform: uppercase;
}

.step-section .card-header h2 {
  color: #999; /* Inactive/default color */
}

/* Active step styling logic could be added via JS, but for now strict to CSS */

.card-body {
  padding: var(--spacing);
}

/* Forms */
.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text-color);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  color: var(--text-color);
  background-color: #fff;
  transition: border-color 0.2s;
  outline: none;
  height: 44px; /* Touch friendly */
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(3, 180, 174, 0.1);
}

.form-group input.valid {
  border-color: var(--success-color);
  box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.1);
}

.form-group input.invalid {
  border-color: var(--error-color);
  box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1);
}

.form-row {
  display: flex;
  gap: 15px;
}

.col-half {
  flex: 1;
}

.expiry-inputs {
  display: flex;
  gap: 10px;
}

/* Payment Methods */
.payment-methods {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding: 10px; /* Scrollbar space and badge space */
}

.payment-method-option {
  flex: 1;
  min-width: 100px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
  position: relative;
  gap: 8px;
}

.payment-method-option input {
  display: none;
}

.payment-method-option.active {
  border-color: #28a745;
  background-color: #eaffea;
  color: #28a745;
}

/* Add a checkmark for active */
.payment-method-option.active::after {
  content: "✓";
  position: absolute;
  top: -6px;
  right: -6px;
  background: #28a745;
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  z-index: 10;
}

.payment-method-option i {
  font-size: 24px;
}

.payment-method-option img {
  height: 24px;
}

.payment-method-option span {
  font-size: 0.8rem;
  font-weight: 500;
}

/* Payment Content */
.payment-content {
  display: none;
}

.payment-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.installments-banner {
  background-color: #f8f9fa;
  padding: 10px;
  text-align: center;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  border: 1px solid #eee;
}

.text-green {
  color: var(--success-color);
}

/* Card Preview (Mobile Friendly) */
.card-preview-container {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

.card-preview {
  width: 100%;
  max-width: 320px;
  height: 180px;
  background: linear-gradient(135deg, #ddd 0%, #eee 100%);
  border-radius: 12px;
  position: relative;
  padding: 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  color: #888;
}

.card-chip {
  width: 40px;
  height: 30px;
  background: #ccc;
  border-radius: 4px;
  margin-bottom: 40px;
}

.card-number-display {
  font-size: 1.2rem;
  letter-spacing: 2px;
  margin-bottom: 20px;
  font-family: monospace;
}

.card-details-display {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  text-transform: uppercase;
}

/* Info Box for Pix/PicPay */
.info-box {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-bottom: 20px;
}

.info-item {
  padding: 12px;
  display: flex;
  gap: 10px;
  border-bottom: 1px solid #eee;
}

.info-item:last-child {
  border-bottom: none;
}

.info-number {
  font-weight: bold;
  color: #28a745;
}

.info-item p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Summary Section */
.summary-section h2 {
  color: var(--text-color);
}

.product-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 20px;
}

.product-summary img {
  max-width: 200px;
  margin-bottom: 10px;
  border-radius: 8px;
}

.product-summary h3 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.promo-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.price-row,
.total-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.95rem;
}

.price-value {
  color: var(--success-color);
  font-weight: 500;
}

.total-row {
  background-color: #f0f2f5;
  padding: 12px;
  border-radius: 4px;
  margin-top: 10px;
  font-weight: bold;
}

.total-value {
  color: var(--success-color);
  font-size: 1.1rem;
}

/* Submit Button */
.btn-submit {
  width: 100%;
  padding: 16px;
  background-color: var(--success-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  transition: background-color 0.2s;
  box-shadow: 0 4px 6px rgba(40, 167, 69, 0.2);
}

.btn-submit:hover {
  background-color: #218838;
}

/* Footer */
.checkout-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #e9ecef;
  padding: 6px 12px;
  border-radius: 20px;
  margin-bottom: 15px;
  font-weight: bold;
  color: #495057;
}

.footer-text {
  margin-bottom: 15px;
  line-height: 1.4;
}

.trust-badges {
  display: flex;
  justify-content: center;
  gap: 15px;
  font-size: 24px;
  color: #adb5bd;
}

/* Responsiveness tweaks for smaller screens */
@media (max-width: 360px) {
  .payment-methods {
    flex-direction: column; /* Stack payment methods on very small screens */
  }

  .payment-method-option {
    flex-direction: row;
    justify-content: flex-start;
    padding: 15px;
  }
}

/* Toast Notifications */
.notification-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  pointer-events: none;
}

.notification-toast {
  background-color: #fff;
  border-left: 4px solid var(--success-color);
  padding: 15px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 10px;
  pointer-events: auto;
  animation: notification-life 4s ease forwards;
  max-width: 300px;
  width: 90vw; /* Responsive width */
}

.notification-icon {
  background-color: #e6f9e9;
  color: var(--success-color);
  width: 40px;
  height: 40px;
  min-width: 40px; /* Prevent shrinking */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.notification-content {
  font-size: 0.85rem;
  line-height: 1.3;
}

.notification-name {
  font-weight: bold;
  color: var(--text-color);
  display: block;
}

.notification-action {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.notification-time {
  display: block;
  font-size: 0.75rem;
  color: #999;
  margin-top: 2px;
}

@keyframes notification-life {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  10% {
    opacity: 1;
    transform: translateY(0);
  }
  80% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* Adjust position for mobile to not cover important buttons if needed */
@media (max-width: 768px) {
  .notification-container {
    bottom: 10px;
    left: 10px;
    right: 10px; /* Center horizontally if wanted, or just left */
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Align left */
  }
  .notification-toast {
    width: auto;
    max-width: 100%;
  }
}
