/* ===================================================
   Mobile-First Modern CSS - Geo Notification Test
   =================================================== */

:root {
  --bg-primary: #0b0f19;
  --bg-card: #131b2e;
  --bg-card-alt: #1a253e;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.25);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --border-color: #1e293b;
  --border-active: #334155;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px 12px 32px 12px;
  line-height: 1.5;
}

.app-container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.app-header .header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.app-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.app-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 2px;
}

/* In-App Alert Banner */
.inapp-alert {
  display: none;
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
  animation: slideInDown 0.4s ease-out forwards;
}

.inapp-alert.active {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inapp-alert-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.inapp-alert-content h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

.inapp-alert-content p {
  font-size: 0.825rem;
  opacity: 0.95;
}

/* Status Indicator Card */
.status-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.status-card.inside {
  border-color: var(--success);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.12) 0%, var(--bg-card) 100%);
  box-shadow: 0 0 25px var(--success-glow);
}

.status-card.outside {
  border-color: var(--border-active);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.status-card.outside .status-pill {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid #334155;
}

.status-card.inside .status-pill {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  animation: pulse-border 2s infinite;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: currentColor;
}

.status-card.inside .pulse-dot {
  box-shadow: 0 0 8px #10b981;
}

.distance-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 10px 0 4px 0;
}

.distance-value {
  font-size: 2.5rem;
  font-weight: 900;
  color: #ffffff;
  font-feature-settings: "tnum";
  letter-spacing: -0.03em;
}

.distance-unit {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.status-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.interval-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  margin-bottom: 8px;
}

.notif-counter-bar {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  color: #94a3b8;
}

.notif-counter-bar strong {
  color: #34d399;
  font-size: 0.9rem;
}

/* Cards generic */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.card-title .icon {
  margin-right: 6px;
}

/* Permissions Grid */
.permissions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.perm-item {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.perm-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  width: fit-content;
}

.perm-badge.waiting {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.perm-badge.granted {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.perm-badge.denied {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* Data Rows */
.data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.85rem;
}

.data-row:not(:last-child) {
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.data-label {
  color: var(--text-muted);
}

.data-value {
  color: #ffffff;
  font-weight: 600;
  font-family: monospace;
  font-size: 0.85rem;
}

/* Target Settings Details */
.target-quick-actions {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-toggle-btn {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.config-inputs-box {
  display: none;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-card-alt);
  padding: 12px;
  border-radius: var(--radius-md);
  margin-top: 6px;
}

.config-inputs-box.open {
  display: flex;
}

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

.input-group label {
  font-size: 0.725rem;
  color: var(--text-muted);
  font-weight: 600;
}

.input-group input {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #ffffff;
  padding: 8px 10px;
  font-size: 0.85rem;
  font-family: monospace;
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.btn-secondary-sm {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.btn-secondary-sm:hover {
  background: rgba(59, 130, 246, 0.25);
}

.radius-quick-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}

.btn-radius-preset {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 2px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.btn-radius-preset.active {
  background: rgba(59, 130, 246, 0.25);
  color: #60a5fa;
  border-color: #3b82f6;
  font-weight: 700;
}

.btn-radius-preset:hover {
  background: var(--border-active);
  color: #ffffff;
}

/* Action Buttons */
.actions-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

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

.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-active);
  color: var(--text-muted);
  padding: 10px 14px;
  font-size: 0.825rem;
}

.btn-outline:hover {
  background: var(--bg-card-alt);
  color: #ffffff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Debug Logger */
.debug-card {
  background: #080c14;
  border: 1px solid #1e293b;
  border-radius: var(--radius-lg);
  padding: 14px;
}

.debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.debug-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.debug-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.725rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.debug-clear-btn:hover {
  color: #ffffff;
  background: #1e293b;
}

.debug-console {
  background: #030712;
  border: 1px solid #111827;
  border-radius: var(--radius-sm);
  height: 180px;
  overflow-y: auto;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.725rem;
  line-height: 1.45;
  color: #cbd5e1;
  scroll-behavior: smooth;
}

.log-entry {
  margin-bottom: 4px;
  word-break: break-all;
  display: flex;
  gap: 6px;
}

.log-time {
  color: #64748b;
  flex-shrink: 0;
}

.log-msg {
  flex-grow: 1;
}

.log-msg.info { color: #94a3b8; }
.log-msg.success { color: #34d399; font-weight: 600; }
.log-msg.warn { color: #fbbf24; }
.log-msg.error { color: #f87171; font-weight: 600; }

/* Animations */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-border {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* ===================================================
   iOS Safari PWA Guide Box
   =================================================== */
.ios-guide-box {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 1px solid #3b82f6;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
  margin-top: 4px;
}

.ios-guide-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ios-guide-icon {
  font-size: 1.8rem;
}

.ios-guide-title strong {
  font-size: 0.95rem;
  color: #ffffff;
  display: block;
}

.ios-guide-title p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ios-steps {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  color: #cbd5e1;
}

.ios-steps li strong {
  color: #ffffff;
}

.ios-icon-share, .ios-icon-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.25);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.8rem;
  margin: 0 2px;
}

/* ===================================================
   Modal / Bottom Sheet de Permissões
   =================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 12px 16px 12px;
}

@media (min-width: 500px) {
  .modal-overlay {
    align-items: center;
    padding: 20px;
  }
}

.modal-card {
  background: #131b2e;
  border: 1px solid #2a3a5c;
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  animation: slideUpModal 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-icon-circle {
  width: 60px;
  height: 60px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 14px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 8px;
}

.modal-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 16px;
}

.modal-instruction-area {
  background: #0b0f19;
  border: 1px solid #1e293b;
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 18px;
  text-align: left;
  font-size: 0.825rem;
  color: #cbd5e1;
  display: none;
}

.modal-instruction-area.active {
  display: block;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Toast Message */
.toast-message {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e293b;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border: 1px solid #334155;
  z-index: 10000;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  max-width: 90%;
}

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

