/* ========== Reset base ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html { /* ✅ Evitar auto-zoom de iOS */
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #334155;
  color: #1e293b;
  line-height: 1.6;
}

/* ✅ Padding seguro en móviles con notch */
:root {
  --safe-x: max(env(safe-area-inset-left), 16px);
  --safe-r: max(env(safe-area-inset-right), 16px);
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: block;
}

.container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-left: var(--safe-x);
  padding-right: var(--safe-r);
}

.container-full {
  min-height: 100vh;
  padding: 1rem;
  padding-left: var(--safe-x);
  padding-right: var(--safe-r);
  max-width: 28rem;
  margin: 0 auto;
}

.card {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 28rem;
}

.card-header {
  padding: 1.5rem;
  text-align: center;
}

.card-content {
  padding: 1.5rem;
  padding-top: 0;
}

.card-title {
  font-size: 1.25rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.logo-container {
  margin-bottom: 1.5rem;
}

.logo-large {
  height: 6rem;
  margin: 0 auto;
  max-width: 100%; /* ✅ Evitar desbordes en móvil */
}

.logo-medium {
  height: 3rem;
  max-width: 100%;
}

.header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  color: white;
}

.header-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.badge {
  background-color: #fbbf24;
  color: #92400e;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  touch-action: manipulation; /* ✅ Mejor respuesta táctil */
}

.btn-primary {
  background-color: #fbbf24;
  color: #92400e;
}

.btn-primary:hover {
  background-color: #f59e0b;
}

.btn-secondary {
  background-color: white;
  color: #1e293b;
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
  background-color: #f8fafc;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid #cbd5e1;
  color: #64748b;
}

.btn-outline:hover {
  background-color: #f8fafc;
}

.btn-ghost {
  background-color: transparent;
  color: #64748b;
}

.btn-ghost:hover {
  background-color: #f8fafc;
}

.btn-back {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.25rem;
}

.btn-back:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.btn-back-white {
  background: none;
  border: none;
  color: white;
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.25rem;
}

.btn-back-white:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.btn-large {
  padding: 1.5rem;
  font-size: 1.125rem;
}

.btn-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.75rem;
}

.btn-close:hover {
  background: rgba(0, 0, 0, 0.7);
}

.input-group {
  margin-bottom: 1rem;
}

.input-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.input-container {
  position: relative;
}

.input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  font-size: 16px; /* ✅ >=16px para evitar zoom iOS */
}

.input:focus {
  outline: none;
  border-color: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
}

.help-text {
  font-size: 0.875rem;
  text-align: center;
  color: #64748b;
  margin: 1rem 0;
}

.footer-text {
  text-align: center;
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 1rem;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: #64748b;
  font-size: 0.875rem;
}

.section-title {
  font-size: 0.875rem;
}

.vehicle-image-container {
  position: relative;
}

.vehicle-image {
  width: 100%;
  height: 12rem;
  object-fit: cover;
  border-radius: 0.5rem;
}

.ticket-overlay {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.info-card {
  text-align: center;
  padding: 1rem;
}

.icon-large {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.info-label {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.info-value {
  font-size: 1.5rem;
  font-weight: bold;
}

.info-value-large {
  font-size: 1.125rem;
  font-weight: 600;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.upload-area {
  border: 2px dashed #cbd5e1;
  border-radius: 0.5rem;
  padding: 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.upload-text {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 1rem;
}

.upload-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.voucher-result {
  margin-bottom: 1.5rem;
}

.voucher-image-container {
  position: relative;
  margin-bottom: 1rem;
}

.voucher-image {
  width: 100%;
  height: 12rem;
  object-fit: cover;
  border-radius: 0.5rem;
  border: 1px solid #cbd5e1;
}

.discount-card {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.discount-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.discount-icon {
  width: 2.5rem;
  height: 2.5rem;
  background-color: #dcfce7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #16a34a;
}

.discount-title {
  font-weight: 600;
  color: #166534;
}

.discount-subtitle {
  font-size: 0.875rem;
  color: #16a34a;
}

.discount-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.discount-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
}

.discount-text {
  color: #16a34a;
  font-weight: 500;
}

.discount-total {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  font-size: 1.125rem;
  border-top: 1px solid #bbf7d0;
  padding-top: 0.5rem;
}

.total-amount {
  color: #16a34a;
}

.strikethrough {
  text-decoration: line-through;
}

.receipt-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.receipt-option {
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.receipt-option:hover {
  border-color: #fbbf24;
}

.receipt-option.active {
  border-color: #fbbf24;
  background-color: rgba(251, 191, 36, 0.05);
}

.option-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.option-icon {
  font-size: 1.25rem;
}

.option-title {
  font-weight: 500;
}

.option-subtitle {
  font-size: 0.875rem;
  color: #64748b;
}

.option-indicator {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  margin-left: auto;
}

.option-indicator.active {
  background-color: #fbbf24;
}

.invoice-form {
  border-top: 1px solid #e2e8f0;
  padding-top: 1rem;
  margin-bottom: 1rem;
}

.form-title {
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.form-group {
  margin-bottom: 0.75rem;
}

.payment-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.izipay-header {
  background-color: black;
  color: white;
  padding: 1rem;
  border-radius: 0.5rem 0.5rem 0 0;
  text-align: center;
  font-weight: bold;
}

.izi-red {
  color: #ef4444;
}

.izi-white {
  color: white;
}

.payment-card {
  border-radius: 0 0 0.5rem 0.5rem;
}

.payment-methods-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.payment-methods {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.payment-method {
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.payment-method:hover {
  border-color: #fbbf24;
}

.payment-method.active {
  border-color: #fbbf24;
  background-color: rgba(251, 191, 36, 0.1);
}

.method-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.method-icon {
  font-size: 1.25rem;
}

.method-name {
  font-weight: 500;
}

.method-indicator {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  margin-left: auto;
}

.method-indicator.active {
  background-color: #fbbf24;
}

.yape-icon {
  width: 1.25rem;
  height: 1.25rem;
  background-color: #7c3aed;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
}

.card-form {
  margin-bottom: 1.5rem;
}

.form-help {
  font-size: 0.875rem;
  text-align: center;
  color: #64748b;
  margin-bottom: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0.75rem;
}

.form-group-1 {
  grid-column: span 1;
}

.form-group-2 {
  grid-column: span 2;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
}

.checkbox-group label {
  font-size: 0.875rem;
  margin-bottom: 0;
}

.powered-by {
  text-align: center;
  font-size: 0.75rem;
  color: #64748b;
  margin: 1rem 0;
}

.success-content {
  text-align: center;
  padding: 2rem;
}

.success-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.5rem;
  background-color: #dcfce7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #16a34a;
}

.success-message {
  margin-bottom: 1.5rem;
}

.success-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: #16a34a;
  margin-bottom: 0.5rem;
}

.success-subtitle {
  color: #64748b;
}

.success-details {
  background-color: #f8fafc;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.detail-row:last-child {
  margin-bottom: 0;
}

.detail-row span:first-child {
  color: #64748b;
}

.detail-row span:last-child {
  font-weight: 500;
}

/* ========== Responsive ========== */
@media (max-width: 640px) {
  .container,
  .container-full {
    padding: 0.5rem;
    padding-left: var(--safe-x);
    padding-right: var(--safe-r);
  }

  .card { margin: 0; }

  .info-grid { grid-template-columns: 1fr; }

  .form-row { grid-template-columns: 1fr; }

  .form-group-2 { grid-column: span 1; }

  /* ✅ Botones a ancho completo en móvil */
  .btn,
  .button-group .btn,
  .upload-buttons .btn,
  .payment-method,
  .receipt-option {
    width: 100%;
  }

  /* ✅ Overlay más pequeño para que no tape la foto */
  .ticket-overlay {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
  }
}
