/* ==========================================================================
   SISTEMA DE DESIGN & CRIAÇÃO DE TEMA (LARANJA & BRANCO PREMIUM)
   ========================================================================== */
:root {
  /* Harmonious Color Palette */
  --primary-orange: #FF7A00;       /* Laranja Premium */
  --primary-orange-hover: #E06B00; /* Laranja Dourado */
  --primary-orange-light: #FFEEDB; /* Laranja Creme Suave */
  --primary-orange-glow: rgba(255, 122, 0, 0.35);
  
  --text-primary: var(--dark-text);
  --text-secondary: var(--medium-text);
  
  --pure-white: #FFFFFF;
  --off-white: #FCFBF7;
  
  --dark-text: #1E1E24;            /* Slate/Charcoal - Contraste e Legibilidade */
  --medium-text: #5C5E69;
  --light-gray: #E0E2EB;
  
  --success-color: #2ECC71;
  --error-color: #E74C3C;
  --error-light: #FDEDEC;
  
  /* Glassmorphism & Shadow Tokens */
  --glass-bg: rgba(255, 255, 255, 0.88);
  --glass-border: rgba(255, 255, 255, 0.7);
  --card-shadow: 0 24px 64px rgba(30, 30, 36, 0.08), 
                 0 8px 24px rgba(255, 122, 0, 0.06);
  --input-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  
  /* Typography */
  --font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Animation Timing */
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo-badge i {
  font-size: 36px;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.25));
}

.event-logo-box {
  width: min(100%, 320px);
  margin: 22px auto 0;
  padding: 18px 22px;
  background: #1a1f2e;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.sgp-logo-box {
  background: #000;
}

.sgp-logo-box + .event-logo-box {
  margin-top: 14px;
}

.event-logo {
  display: block;
  width: 100%;
  height: auto;
}

.driver-selector {
  margin-bottom: 24px;
}

.driver-select-mode > .card-header,
.driver-select-mode > form {
  display: none;
}

.driver-select-mode .driver-selector {
  margin-bottom: 0;
}

.driver-selector label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.driver-search-results {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.driver-result-item,
.driver-result-empty {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
}

.driver-result-item {
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.driver-result-item:hover,
.driver-result-item:focus-visible {
  border-color: var(--primary-orange);
  background: rgba(255, 255, 255, 0.14);
  outline: none;
  transform: translateY(-1px);
}

.driver-result-empty {
  color: var(--text-secondary);
}

.ticket-buy-btn {
  margin-top: 18px;
  text-decoration: none;
}

.btn-export-drivers {
  white-space: nowrap;
}

/* Base Resets & Layout */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--off-white);
  color: var(--dark-text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
  padding: 1.5rem;
}

/* 
   Animated Radial Mesh Background 
   Cria um fundo sutil, flutuante e dinâmico combinando laranja e branco 
*/
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: 
    radial-gradient(circle at 10% 20%, rgba(255, 238, 219, 0.6) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(255, 122, 0, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 1) 0%, rgba(252, 251, 247, 1) 100%);
  animation: backgroundPulse 12s ease-in-out infinite alternate;
}

@keyframes backgroundPulse {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 50% 50%;
  }
}

/* Container de Layout */
.app-container {
  width: 100%;
  max-width: 480px;
  perspective: 1000px; /* Para efeitos 3D futuros */
  z-index: 10;
}

/* ==========================================================================
   GLASSMORPHISM CARD
   ========================================================================== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 2.5rem 2.25rem;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

@media (max-width: 400px) {
  .glass-card {
    padding: 2rem 1.5rem;
  }
}

/* Decorador de brilho sutil no topo do card */
.glass-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--primary-orange-light), var(--primary-orange), var(--primary-orange-light));
}

/* ==========================================================================
   TÍTULOS E CABEÇALHOS
   ========================================================================== */
.card-header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-badge {
  background-color: var(--primary-orange-light);
  color: var(--primary-orange-hover);
  width: 68px;
  height: 68px;
  border-radius: 20px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 20px rgba(255, 122, 0, 0.2);
  transition: var(--transition-smooth);
  animation: float 4s ease-in-out infinite;
}

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

h1 {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--dark-text);
  letter-spacing: -0.5px;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--medium-text);
  font-weight: 400;
}

/* ==========================================================================
   FORMULÁRIOS E INPUTS
   ========================================================================== */
.input-group {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark-text);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--medium-text);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: var(--transition-fast);
}

input {
  width: 100%;
  padding: 0.9rem 1rem 0.9rem 42px;
  font-size: 0.95rem;
  font-family: var(--font-family);
  background-color: var(--pure-white);
  border: 1.5px solid var(--light-gray);
  border-radius: 14px;
  color: var(--dark-text);
  outline: none;
  transition: var(--transition-fast);
  box-shadow: var(--input-shadow);
}

/* Efeito de foco elegante e iluminado em laranja */
input:focus {
  border-color: var(--primary-orange-hover);
  box-shadow: 0 0 0 4px var(--primary-orange-glow);
}

input:focus + .input-icon {
  color: var(--primary-orange-hover);
}

.input-hint {
  font-size: 0.75rem;
  color: var(--medium-text);
  margin-top: 0.4rem;
  font-weight: 300;
}

/* Botão de Envio Principal */
.btn {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-family);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-orange-hover) 100%);
  color: var(--pure-white);
  box-shadow: 0 8px 24px rgba(224, 107, 0, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(224, 107, 0, 0.5);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 4px 12px rgba(224, 107, 0, 0.3);
}

/* ==========================================================================
   ALERTAS E ERROS
   ========================================================================== */
.alert-container {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  animation: shake 0.4s ease-in-out;
  transition: var(--transition-smooth);
}

.alert-container.error {
  background-color: var(--error-light);
  border-left: 4px solid var(--error-color);
  color: var(--error-color);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ==========================================================================
   CARREGAMENTO E SPINNER
   ========================================================================== */
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(30, 30, 36, 0.1);
  border-top-color: var(--dark-text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
}

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

/* ==========================================================================
   ESTADO DE TRANSIÇÃO (VIEWS)
   ========================================================================== */
.view-state {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
  display: none;
}

.view-state.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   TELA DE SUCESSO & REVELAÇÃO DO CUPOM
   ========================================================================== */
.success-badge {
  color: var(--success-color);
  background-color: rgba(46, 204, 113, 0.1);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1.25rem;
  box-shadow: 0 10px 25px rgba(46, 204, 113, 0.15);
  animation: scaleUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleUp {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.success-title {
  font-size: 2rem;
  font-weight: 850;
  color: var(--dark-text);
  letter-spacing: -0.5px;
}

.success-subtitle {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--medium-text);
  margin-bottom: 2rem;
}

/* 
   O Box do Cupom
   Design tátil que implora para ser clicado (Call to Action)
*/
.coupon-box {
  background: linear-gradient(135deg, var(--pure-white) 0%, var(--off-white) 100%);
  border: 2px dashed var(--primary-orange-hover);
  border-radius: 20px;
  padding: 1.75rem 1.5rem;
  cursor: pointer;
  text-align: center;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.02);
  margin-bottom: 2rem;
  outline: none;
}

/* Efeitos táteis ao passar o mouse */
.coupon-box:hover, .coupon-box:focus {
  border-color: var(--primary-orange-hover);
  background: var(--primary-orange-light);
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 12px 28px var(--primary-orange-glow);
}

.coupon-box:active {
  transform: translateY(-1px) scale(0.99);
}

/* Indicador pulsante sobre o botão de clique */
.coupon-teaser {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: pulseButton 2s infinite;
}

@keyframes pulseButton {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.teaser-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--dark-text);
  letter-spacing: -0.2px;
}

.teaser-sub {
  font-size: 0.8rem;
  color: var(--medium-text);
  font-weight: 400;
  margin-top: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Área do Cupom Revelado */
.coupon-revealed {
  animation: revealPulse 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes revealPulse {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.revealed-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--medium-text);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.5rem;
}

.revealed-code-wrapper {
  background-color: var(--pure-white);
  border: 1.5px solid var(--light-gray);
  border-radius: 12px;
  padding: 0.8rem 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 0.5rem;
  box-shadow: var(--input-shadow);
  transition: var(--transition-fast);
}

.revealed-code-wrapper:hover {
  border-color: var(--primary-orange-hover);
  box-shadow: 0 0 0 3px var(--primary-orange-glow);
}

.coupon-code {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--dark-text);
  letter-spacing: 2px;
  user-select: all; /* Facilita seleção manual */
}

.copy-icon-btn {
  color: var(--medium-text);
  display: flex;
  align-items: center;
  transition: var(--transition-fast);
}

.revealed-code-wrapper:hover .copy-icon-btn {
  color: var(--primary-orange-hover);
  transform: scale(1.1);
}

.coupon-copy-tip {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--medium-text);
  transition: var(--transition-fast);
}

/* Mensagem amigável de cupom copiado */
.coupon-copy-tip.copied {
  color: var(--success-color);
  font-weight: 700;
}

.footer-tip {
  font-size: 0.8rem;
  color: var(--medium-text);
  font-weight: 400;
  text-align: center;
}

/* ==========================================================================
   ESTILOS ESPECÍFICOS DO PAINEL DE CONTROLE (/ADMIN)
   ========================================================================== */

/* Aumenta a largura do card no painel admin para acomodar melhor a tabela */
.admin-container {
  max-width: 720px;
}

@media (max-width: 768px) {
  .admin-container {
    max-width: 100%;
  }
}

/* Alinhamento do cabeçalho admin com botão de logout */
.admin-header .header-main-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.admin-title-area {
  text-align: left;
}

.admin-header {
  margin-bottom: 1.5rem;
}

/* Botão de Logout */
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--error-light);
  color: var(--error-color);
  border: 1px solid rgba(231, 76, 60, 0.2);
  border-radius: 12px;
  padding: 0.5rem 1rem;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-logout:hover {
  background-color: var(--error-color);
  color: var(--pure-white);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.15);
  transform: translateY(-1px);
}

.btn-logout:active {
  transform: translateY(1px);
}

/* Botão de alternar exibição de senha */
.password-toggle-btn {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--medium-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
  transition: var(--transition-fast);
}

.password-toggle-btn:hover {
  color: var(--primary-orange-hover);
  background-color: rgba(30, 30, 36, 0.04);
}

/* Seção de Formulário de Motoristas */
.form-card-section {
  background: var(--pure-white);
  border: 1.5px solid var(--light-gray);
  border-radius: 20px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--input-shadow);
}

.form-card-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark-text);
  margin-bottom: 1rem;
  letter-spacing: -0.2px;
}

.driver-form-row {
  display: flex;
  gap: 1rem;
  align-items: center;
}

@media (max-width: 580px) {
  .driver-form-row {
    flex-direction: column;
    align-items: stretch;
  }
}

.no-margin {
  margin-bottom: 0 !important;
  flex: 1;
}

.form-actions-row {
  display: flex;
  gap: 0.5rem;
}

.btn-add-driver, .btn-cancel-driver {
  width: auto;
  padding: 0.9rem 1.5rem;
}

@media (max-width: 580px) {
  .btn-add-driver, .btn-cancel-driver {
    flex: 1;
    width: 100%;
  }
}

.btn-secondary {
  background-color: var(--pure-white);
  color: var(--dark-text);
  border: 1.5px solid var(--light-gray);
  box-shadow: var(--input-shadow);
}

.btn-secondary:hover {
  border-color: var(--dark-text);
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: translateY(1px);
}

/* Seção da Tabela de Motoristas */
.drivers-list-section h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--dark-text);
  margin-bottom: 1rem;
  letter-spacing: -0.3px;
}

.drivers-table-wrapper {
  background: var(--pure-white);
  border: 1.5px solid var(--light-gray);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--input-shadow);
}

.drivers-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.drivers-table th, .drivers-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--light-gray);
  vertical-align: middle;
}

.drivers-table th {
  background-color: var(--off-white);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--medium-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.drivers-table tr:last-child td {
  border-bottom: none;
}

.drivers-table tr:hover td {
  background-color: rgba(255, 238, 219, 0.15);
}

.driver-name-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark-text);
}

.driver-link-preview {
  font-size: 0.75rem;
  color: var(--medium-text);
  margin-top: 0.25rem;
  word-break: break-all;
  font-family: monospace;
}

/* Coluna de Ações */
.actions-col {
  width: 240px;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 580px) {
  .actions-col {
    width: auto;
  }
}

.btn-table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  border: 1.5px solid var(--light-gray);
  background-color: var(--pure-white);
  color: var(--medium-text);
  transition: var(--transition-fast);
  margin-left: 0.35rem;
}

.btn-table-action:hover {
  transform: translateY(-1px);
  color: var(--dark-text);
  border-color: var(--dark-text);
}

.btn-copy-link {
  background-color: var(--primary-orange-light);
  color: var(--dark-text);
  border-color: rgba(255, 122, 0, 0.4);
}

.btn-copy-link:hover {
  background-color: var(--primary-orange);
  border-color: var(--primary-orange-hover);
}

/* Estado de Copiado */
.btn-copy-link.copied {
  background-color: rgba(46, 204, 113, 0.15);
  color: var(--success-color);
  border-color: rgba(46, 204, 113, 0.3);
}

.btn-copy-link.copied:hover {
  background-color: rgba(46, 204, 113, 0.25);
}

.btn-edit-item:hover {
  background-color: var(--off-white);
}

.btn-delete-item:hover {
  background-color: var(--error-light);
  color: var(--error-color);
  border-color: rgba(231, 76, 60, 0.3);
}

/* Placeholder de lista vazia */
.no-data-placeholder {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--medium-text);
  font-size: 0.95rem;
}

/* ==========================================================================
   MODAL DE CONFIRMAÇÃO SEGURO (NÃO-BLOQUEANTE)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(30, 30, 36, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 1;
  transition: var(--transition-smooth);
}

.modal-card {
  background: var(--pure-white);
  border-radius: 24px;
  width: 90%;
  max-width: 420px;
  padding: 2rem;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.16);
  border: 1px solid var(--light-gray);
  animation: modalScaleUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

@keyframes modalScaleUp {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-card h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--dark-text);
  margin-bottom: 0.75rem;
}

.modal-card p {
  font-size: 0.95rem;
  color: var(--medium-text);
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.modal-card p strong {
  color: var(--dark-text);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.modal-footer .btn {
  width: auto;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
}

.btn-danger {
  background-color: var(--error-color);
  color: var(--pure-white);
  box-shadow: 0 6px 18px rgba(231, 76, 60, 0.25);
}

.btn-danger:hover {
  background-color: #C0392B;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(231, 76, 60, 0.4);
}

.btn-danger:active {
  transform: translateY(1px);
}
