/* ==========================================================================
   CSS: Estilos Modernos, Temáticos e Responsivos (Mobile-First)
   ========================================================================== */

/* Resets e Configurações Globais */
:root {
  --bg-color: #000000;
  --bg-solid: #000000; /* Preto sólido */
  --card-bg: rgba(18, 18, 24, 0.4);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  
  /* Cores de Destaque Sólidas */
  --primary-color: #2563eb; /* Azul sólido */
  --accent-cyan: #00f5ff;
  --accent-purple: #8a2be2;
  
  /* Status */
  --color-positive: #10b981;
  --color-positive-bg: rgba(16, 185, 129, 0.1);
  --color-negative: #f43f5e;
  --color-negative-bg: rgba(244, 63, 94, 0.1);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.1);
  
  --font-family: 'Outfit', sans-serif;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent; /* Remove highlight azul no mobile */
}

html {
  background-color: var(--bg-color);
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-solid); /* Fundo sólido, sem degradê */
  color: var(--text-primary);
  min-height: 100vh;
  padding: 16px;
  overflow-x: hidden;
}

/* Container do App */
.app-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 500px; /* Ótimo para simular mobile no desktop */
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0 auto;
}

/* Header */
.app-header {
  text-align: center;
  padding: 10px 0;
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.4);
}

.logo-icon svg {
  width: 18px;
  height: 18px;
}

.app-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.app-header h1 span {
  font-weight: 300;
  color: var(--accent-cyan);
}

.subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 300;
}

/* Layout dos Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

.title-icon {
  width: 18px;
  height: 18px;
  color: var(--accent-cyan);
}

/* Presets rápidos */
.preset-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-preset {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-family: var(--font-family);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-smooth);
  width: 100%;
}

.btn-preset:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.btn-preset:active {
  transform: translateY(0);
}

/* Formulários e Inputs */
#person-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.flex-1 {
  flex: 1;
}

.input-group label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input[type="text"],
.input-group input[type="number"] {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 14px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 15px;
  width: 100%;
  transition: var(--transition-smooth);
}

.input-group input[type="text"]:focus,
.input-group input[type="number"]:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.25);
}

/* Remove as setinhas de aumentar/diminuir do campo number */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
}

/* Custom Checkbox / Toggle */
.toggle-container {
  display: flex;
  align-items: center;
  height: 50px; /* Alinha verticalmente com o input ao lado */
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  width: 100%;
}

.checkbox-label input {
  display: none;
}

.custom-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  display: inline-block;
  position: relative;
  transition: var(--transition-smooth);
  background: transparent;
  flex-shrink: 0;
}

.checkbox-label input:checked + .custom-checkbox {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.checkbox-label input:checked + .custom-checkbox::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid #000;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.hidden {
  display: none !important;
}

/* Botões */
.btn-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 15px;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-primary .btn-icon {
  width: 18px;
  height: 18px;
}

.btn-primary:hover {
  background: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.btn-primary:active {
  background: #1d4ed8;
  transform: translateY(0);
}

/* Lista de Participantes */
.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 12px;
}

.btn-clear-all {
  background: transparent;
  border: none;
  color: var(--color-negative);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-clear-all:hover {
  opacity: 0.8;
}

.empty-state {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 6px;
}

.empty-state .tip {
  font-size: 11px;
  opacity: 0.7;
  display: block;
}

.participants-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 350px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Custom scrollbar para a lista */
.participants-list::-webkit-scrollbar {
  width: 4px;
}

.participants-list::-webkit-scrollbar-track {
  background: transparent;
}

.participants-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.participant-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideIn 0.3s ease forwards;
}

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

.participant-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.participant-name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

.participant-values {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
}

.participant-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}

.badge-paid {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.badge-spent {
  background: rgba(138, 43, 226, 0.15);
  color: #c084fc;
}

.participant-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.participant-balance {
  font-size: 14px;
  font-weight: 600;
}

.balance-positive {
  color: var(--color-positive);
}

.balance-negative {
  color: var(--color-negative);
}

.balance-zero {
  color: var(--text-secondary);
}

.btn-delete {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.btn-delete:hover {
  background: rgba(244, 63, 94, 0.15);
  color: var(--color-negative);
}

.btn-delete svg {
  width: 16px;
  height: 16px;
}

/* Botão Calcular */
.action-bar {
  margin: 10px 0;
}

.btn-calculate {
  background: #10b981; /* Verde sólido */
  border: none;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 700;
  width: 100%;
  padding: 16px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  animation: green-pulse 2s infinite ease-in-out;
}

.btn-calculate:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
}

.btn-calculate:active {
  background: #047857;
  transform: translateY(0);
}

.btn-calculate svg {
  width: 20px;
  height: 20px;
  stroke: #ffffff;
  transition: var(--transition-smooth);
}

.btn-calculate:hover svg {
  transform: translateX(4px);
}

/* Banner de Alerta / Divergência */
.warning-banner {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideIn 0.3s ease forwards;
}

.warning-content {
  display: flex;
  gap: 10px;
}

.warning-icon {
  width: 24px;
  height: 24px;
  color: var(--color-warning);
  flex-shrink: 0;
}

.warning-banner p {
  font-size: 13px;
  line-height: 1.4;
  color: #fff;
}

.warning-banner .diff-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-warning);
  margin-top: 2px;
}

.warning-actions {
  display: flex;
  justify-content: flex-end;
}

.btn-warning-action {
  background: var(--color-warning);
  color: #000;
  border: none;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-warning-action:hover {
  opacity: 0.9;
}

/* Seção de Resultados */
.results-section {
  animation: slideIn 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  border-color: rgba(0, 245, 255, 0.2);
}

.text-gradient {
  color: var(--accent-cyan);
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.metric-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

/* Lista de Transações */
.transactions-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--card-border);
  padding-top: 16px;
}

.transactions-container h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-transactions {
  text-align: center;
  font-size: 14px;
  padding: 10px;
  color: var(--color-positive);
}

.transactions-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transaction-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.transaction-parties {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.party-name {
  font-weight: 600;
  color: #fff;
}

.transaction-arrow {
  color: var(--color-negative);
  display: flex;
  align-items: center;
  font-weight: bold;
}

.transaction-arrow svg {
  width: 16px;
  height: 16px;
}

.transaction-amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-positive);
  background: var(--color-positive-bg);
  padding: 4px 10px;
  border-radius: 20px;
}

/* Botões finais */
.results-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.btn-share-whatsapp {
  background: #25d366;
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  width: 100%;
  padding: 14px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
  transition: var(--transition-smooth);
}

.btn-share-whatsapp:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

.btn-share-whatsapp:active {
  transform: translateY(0);
}

.btn-share-whatsapp svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 10px 0;
  color: var(--text-secondary);
  font-size: 11px;
  opacity: 0.6;
}

/* Responsividade Adicional */
@media (max-width: 480px) {
  body {
    padding: 10px;
  }
  .app-container {
    gap: 15px;
  }
  .card {
    padding: 16px;
  }
  .app-header h1 {
    font-size: 24px;
  }
  .input-row {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .toggle-container {
    height: auto;
    padding: 8px 0;
  }
}

/* Canvas de Partículas no Fundo */
#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
  background: transparent;
}

/* Efeito de Borda com Linha Única Girando */
.btn-border-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  fill: none;
  z-index: 1;
}

.btn-border-rect {
  x: 1px;
  y: 1px;
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  rx: 11px;
  ry: 11px;
  stroke-linecap: round;
  fill: none;
  stroke-width: 1.2px; /* Linha mais fina */
  stroke-dasharray: 15 85; /* Linha de 15% do perímetro, gap de 85% */
  animation: run-border 4.5s linear infinite; /* Movimento mais lento */
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.95)); /* Efeito de brilho */
}

@keyframes run-border {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: -100; /* Movimento contínuo horário (esquerda para a direita no topo) */
  }
}

/* Garante que conteúdo fique acima da borda animada */
.btn-icon,
.btn-text {
  position: relative;
  z-index: 2;
}

@keyframes green-pulse {
  0% {
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3), 0 0 0 0 rgba(16, 185, 129, 0.4);
  }
  70% {
    box-shadow: 0 4px 25px rgba(16, 185, 129, 0.5), 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3), 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Modal Overlay / Glassmorphic Custom Confirmation Popup */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out forwards;
}

.modal-card {
  background: rgba(20, 21, 28, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 90%;
  max-width: 380px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

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

.modal-warning-icon {
  width: 26px;
  height: 26px;
  color: var(--color-negative);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.modal-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.modal-text strong {
  color: #fff;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.modal-actions button {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition-smooth);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-primary) !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  transform: translateY(-2px);
}

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

.btn-danger {
  background: var(--color-negative) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.2);
}

.btn-danger:hover {
  background: #e11d48 !important;
  box-shadow: 0 6px 16px rgba(244, 63, 94, 0.4);
  transform: translateY(-2px);
}

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

/* Animações */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Linha de botões de ações finais da divisão */
.split-actions-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.split-actions-row button {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  transition: var(--transition-smooth);
}

.split-actions-row button svg {
  width: 16px;
  height: 16px;
}

.btn-adjust {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-primary) !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.btn-adjust:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  transform: translateY(-2px);
}

.btn-adjust:active {
  transform: translateY(0);
}

.btn-reset-app {
  background: rgba(244, 63, 94, 0.15) !important;
  color: var(--color-negative) !important;
  border: 1px solid rgba(244, 63, 94, 0.2) !important;
}

.btn-reset-app:hover {
  background: rgba(244, 63, 94, 0.25) !important;
  transform: translateY(-2px);
}

.btn-reset-app:active {
  transform: translateY(0);
}

/* Divisor decorativo de divisão concluída */
.split-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 12px 0 4px 0;
  animation: fadeIn 0.4s ease-out forwards;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.divider-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--color-positive);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.divider-badge svg {
  width: 14px;
  height: 14px;
}

/* Badge indicando que participante não consumiu bebidas */
.badge-no-drinks {
  background: rgba(245, 158, 11, 0.12) !important;
  color: var(--color-warning) !important;
  border: 1px solid rgba(245, 158, 11, 0.2) !important;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 12px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: inline-block;
  vertical-align: middle;
}

