/* ============================================================
   SUPORTE DO GORDINHO - MOBILE FIRST STYLES
   Interface moderna, intuitiva e pensada especialmente para celular
============================================================ */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --accent: #e11d48;
  --accent-light: #ffe4e6;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border: #e2e8f0;
  --border-focus: #6366f1;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  padding-bottom: 3rem;
}

/* App Header - Otimizado para celular */
.mobile-header {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 60%, #4338ca 100%);
  color: #ffffff;
  padding: 1rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-md);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-badge {
  width: 48px;
  height: 48px;
  min-width: 48px;
  background: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  padding: 2px;
  transition: transform 0.2s ease;
}

.brand-badge:hover {
  transform: scale(1.05);
}

.brand-avatar {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  display: block;
}

.header-title h1 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.heart-beat {
  color: #fb7185;
  display: inline-block;
  animation: pulseHeart 1.6s infinite ease-in-out;
}

@keyframes pulseHeart {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

.header-title p {
  font-size: 0.75rem;
  color: #c7d2fe;
}

/* Container Mobile */
.mobile-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Card Padrão */
.m-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.2s ease;
}

/* 1. TELA DE UPLOAD (Destaque Principal) */
.upload-card {
  border: 2px dashed #a5b4fc;
  background: linear-gradient(180deg, #ffffff 0%, #f5f7ff 100%);
  padding: 1.75rem 1.25rem;
  text-align: center;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.upload-card:hover, .upload-card:active {
  border-color: var(--primary);
  background: #eef2ff;
}

.upload-icon-container {
  width: 72px;
  height: 72px;
  background: #e0e7ff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.upload-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1e1b4b;
}

.upload-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 320px;
}

.btn-upload-touch {
  background: var(--primary);
  color: #ffffff;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  margin-top: 0.5rem;
  width: 100%;
  max-width: 300px;
  justify-content: center;
}

.btn-sample-shortcut {
  background: transparent;
  border: 1px solid #c7d2fe;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  margin-top: 0.5rem;
}

.btn-sample-shortcut:hover {
  background: var(--primary-light);
}

/* Status de Carregamento */
.loading-box {
  display: none;
  padding: 2rem;
  text-align: center;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.loading-box.active {
  display: flex;
}

.pulse-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e0e7ff;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 2. CARD DE DADOS EXTRAÍDOS (Aparece após upload) */
.extracted-card {
  display: none;
  animation: slideInUp 0.35s ease-out;
}

.extracted-card.active {
  display: block;
}

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

.success-badge {
  background: #ecfdf5;
  color: var(--success);
  border-bottom: 1px solid #a7f3d0;
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-content-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.client-summary-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--bg-subtle);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.summary-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.summary-row .label {
  color: var(--text-muted);
  font-size: 0.8rem;
  min-width: 65px;
}

.summary-row .val {
  font-weight: 700;
  color: var(--text-main);
  word-break: break-word;
}

/* 3. BOTÕES DE DOWNLOAD (Destaque Principal) */
.action-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #1e1b4b;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.download-buttons-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-mobile-download {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  text-align: left;
  gap: 1rem;
  box-shadow: var(--shadow-md);
  transition: all 0.15s ease;
}

.btn-mobile-download:active {
  transform: scale(0.98);
}

.btn-mobile-download .btn-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.btn-mobile-download .btn-texts {
  display: flex;
  flex-direction: column;
}

.btn-mobile-download .btn-texts strong {
  font-size: 1rem;
  line-height: 1.2;
}

.btn-mobile-download .btn-texts small {
  font-size: 0.75rem;
  opacity: 0.85;
  font-weight: 400;
  margin-top: 2px;
}

.btn-dl-cancel {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%) !important;
  color: #ffffff !important;
}

.btn-dl-rastre {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%) !important;
  color: #ffffff !important;
}

.btn-dl-boleto {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35) !important;
}

/* Motivo do Cancelamento Rápido */
.motivo-box {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.motivo-box label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #9a3412;
}

.motivo-select {
  width: 100%;
  padding: 0.65rem;
  font-size: 0.85rem;
  border: 1px solid #fdba74;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
}

/* Accordion de Ajuste Manual */
.details-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 0.5rem;
}

.details-editor summary {
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--bg-subtle);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.details-editor summary::-webkit-details-marker {
  display: none;
}

.editor-inputs {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #ffffff;
}

.m-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.m-form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.m-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}

.m-input:focus {
  border-color: var(--border-focus);
}

.m-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

/* Botão Recomeçar */
.btn-reset-mobile {
  background: transparent;
  border: 1px dashed var(--text-light);
  color: var(--text-muted);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.btn-reset-mobile:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

/* Modal de Visualização de PDF */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  flex-direction: column;
  justify-content: flex-end;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: #ffffff;
  height: 85vh;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUpModal 0.3s ease;
}

@keyframes slideUpModal {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.btn-close-modal {
  background: var(--bg-subtle);
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.modal-body {
  flex: 1;
  background: #334155;
}

.modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Toast Mobile */
.mobile-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e1b4b;
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  max-width: 90vw;
  text-overflow: ellipsis;
  overflow: hidden;
}

.mobile-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.mobile-toast.success { background: #065f46; border: 1px solid #10b981; }
.mobile-toast.error { background: #881337; border: 1px solid #f43f5e; }
.mobile-toast.info { background: #1e1b4b; border: 1px solid #818cf8; }

/* Botão Criar Boleto / PIX */
.btn-dl-boleto {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
}

/* Modais Tipo Diálogo (Mobile) */
.modal-dialog-mobile {
  height: auto;
  max-height: 90vh;
  border-radius: var(--radius-lg) !important;
  margin: auto;
  max-width: 520px;
  width: 95%;
  animation: scaleUpModal 0.25s ease-out;
}

@keyframes scaleUpModal {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.modal-body-dialog {
  padding: 1.25rem;
  overflow-y: auto;
  max-height: calc(90vh - 70px);
}

/* Opções de Rádio para Motivo do Cancelamento */
.motivo-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.motivo-radio-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.motivo-radio-card:has(input:checked) {
  background: #eef2ff;
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.motivo-radio-card input[type="radio"] {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
}

/* Mini Card do Cliente */
.client-mini-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.m-input-big {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  padding: 0.75rem !important;
  text-align: center;
  color: #047857 !important;
  background: #f0fdf4 !important;
  border-color: #86efac !important;
}

.security-note {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.btn-modal-action {
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-md);
  transition: all 0.15s ease;
}

.btn-modal-action:active {
  transform: scale(0.98);
}

/* Retorno do Boleto (As 3 Opções) */
.boleto-results-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.result-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
}

.result-box-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.result-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.btn-action-sm {
  flex: 1;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-action-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-action-outline {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-action-success {
  background: #059669;
  color: #ffffff;
}

.barcode-number {
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  font-family: monospace, monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e1b4b;
  text-align: center;
  word-break: break-all;
  user-select: all;
  margin-bottom: 0.35rem;
}

/* Botão WhatsApp */
.btn-whatsapp-touch {
  background: #25d366;
  color: #ffffff;
  border: none;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.btn-whatsapp-touch:active {
  transform: scale(0.98);
}
