:root {
  --primary: #00A651;
  --primary-dark: #007A3D;
  --primary-light: #00C863;
  --primary-tint: rgba(0,166,81,0.12);
  --primary-border: rgba(0,166,81,0.4);
  --gradient: linear-gradient(135deg, #00A651 0%, #00C863 100%);
  --bg: #0D0D0D;
  --surface: #1A1A1A;
  --surface-elevated: #242424;
  --border: #2A2A2A;
  --white: #ffffff;
  --text: #FFFFFF;
  --text-muted: #A0A0A0;
  --danger: #EF4444;
  --shadow: 0 8px 32px rgba(0,0,0,0.5);
  --radius: 16px;
}

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

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at 50% 0%, #101a14 0%, #0D0D0D 55%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--text);
}

.container {
  width: 100%;
  max-width: 440px;
}

/* Card principal */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Header do card */
.card-header {
  background: linear-gradient(160deg, #0D0D0D 0%, #10251a 60%, #0D0D0D 100%);
  padding: 32px 24px 24px;
  text-align: center;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.logo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: auto;
  width: 200px;
  max-width: 82%;
  object-fit: contain;
  animation: pulse 2s infinite;
}

.logo-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  font-weight: 400;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.03); }
}

/* Card body */
.card-body {
  padding: 28px 28px 28px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  text-align: center;
}

.card-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Tabs: cliente x visitante */
.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 22px;
}

.mode-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 700;
  padding: 10px 8px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-tab.active {
  background: var(--gradient);
  color: #05170c;
}

/* Form */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  background: var(--bg);
}

.form-control::placeholder { color: #5a5a5a; }

.form-control:focus {
  border-color: var(--primary);
  background: #111;
  box-shadow: 0 0 0 3px var(--primary-tint);
}

/* Phone input com bandeira */
.phone-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.phone-wrapper:focus-within {
  border-color: var(--primary);
  background: #111;
  box-shadow: 0 0 0 3px var(--primary-tint);
}

.phone-prefix {
  padding: 14px 12px;
  font-size: 16px;
  color: var(--text-muted);
  border-right: 2px solid var(--border);
  white-space: nowrap;
  background: inherit;
  user-select: none;
}

.phone-wrapper input {
  flex: 1;
  padding: 14px 16px;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  outline: none;
}

/* OTP input */
.otp-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 8px 0;
}

.otp-input {
  width: 52px;
  height: 60px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: all 0.2s;
}

.otp-input:focus {
  border-color: var(--primary);
  background: #111;
  box-shadow: 0 0 0 3px var(--primary-tint);
  transform: scale(1.05);
}

.otp-input.filled {
  border-color: var(--primary);
  background: var(--primary-tint);
}

/* Botões */
.btn {
  display: block;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  text-decoration: none;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: var(--gradient);
  color: #05170c;
  box-shadow: 0 4px 16px rgba(0,166,81,0.35);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,166,81,0.45);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  color: var(--primary-light);
  border: 2px solid var(--primary);
  margin-top: 10px;
}

.btn-outline:hover {
  background: var(--primary-tint);
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(5,23,12,0.35);
  border-top-color: #05170c;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

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

/* Alert messages */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-error {
  background: rgba(239,68,68,0.12);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.35);
}

.alert-success {
  background: var(--primary-tint);
  color: var(--primary-light);
  border: 1px solid var(--primary-border);
}

.alert-info {
  background: rgba(59,130,246,0.12);
  color: #93c5fd;
  border: 1px solid rgba(59,130,246,0.35);
}

/* Footer */
.card-footer {
  padding: 16px 28px 24px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.footer-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer-text a {
  color: var(--primary-light);
  text-decoration: none;
  font-weight: 600;
}

/* Resend timer */
.resend-timer {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
}

.resend-btn {
  background: none;
  border: none;
  color: var(--primary-light);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.resend-btn:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  text-decoration: none;
}

/* Success page */
.success-icon {
  font-size: 72px;
  text-align: center;
  margin-bottom: 16px;
  animation: bounceIn 0.6s ease;
}

@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.access-info {
  background: var(--primary-tint);
  border: 2px solid var(--primary-border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin: 20px 0;
}

.access-info .time-badge {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary-light);
  display: block;
}

.access-info .time-label {
  font-size: 14px;
  color: var(--primary-light);
  font-weight: 600;
}

.credentials {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
  text-align: left;
}

.credentials h4 {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cred-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.cred-row:last-child { border-bottom: none; }
.cred-label { color: var(--text-muted); }
.cred-value { font-weight: 700; color: var(--text); font-family: monospace; }

/* Steps indicator */
.steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.3s;
}

.step-dot.active {
  background: var(--primary);
  transform: scale(1.4);
}

.step-dot.done {
  background: var(--primary);
}

/* Hidden */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 480px) {
  .card-body { padding: 24px 20px 20px; }
  .otp-input { width: 44px; height: 52px; font-size: 20px; }
}

/* Desktop: card um pouco maior */
@media (min-width: 600px) {
  .container { max-width: 480px; }
}

@media (min-width: 900px) {
  .container { max-width: 500px; }
  .card-body { padding: 36px 36px 32px; }
}

/* Modal de Termos de Uso */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  backdrop-filter: blur(3px);
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; color: var(--text); }
.modal-close {
  border: none;
  background: none;
  font-size: 26px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
}
.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.65;
  color: #cfcfcf;
}
.modal-body p { margin-bottom: 12px; }
.terms-updated { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.modal-footer {
  padding: 12px 20px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}
.modal-footer .btn { min-width: 160px; justify-content: center; }
