/* Theme Dark Premium - Alto Contraste para Uso Externo */
:root {
  --bg-primary: #0a0c10;
  --bg-surface: #14171f;
  --bg-surface-elevated: #1e222d;
  --bg-surface-active: #292e3c;
  --border-color: #2b3140;
  --border-focus: #3b82f6;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #020617;

  --accent-primary: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.25);

  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-danger: #ef4444;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --touch-target: 48px;
  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-base);
  font-size: 15px;
  line-height: 1.4;
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}

#app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 540px;
  margin: 0 auto;
  position: relative;
  background-color: var(--bg-primary);
}

/* Header & Status Bar */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 500;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-success);
}
.status-indicator.offline {
  background-color: var(--status-warning);
}

/* Navigation Bar (Bottom) */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: calc(56px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--touch-target);
  transition: color 0.15s ease;
}

.nav-btn.active {
  color: var(--accent-primary);
}

.nav-btn .icon {
  font-size: 20px;
  margin-bottom: 2px;
}

/* Views Container */
.view-viewport {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(64px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}

/* Common UI Elements */
input, select, textarea, button {
  font-family: inherit;
  font-size: 16px; /* Impede zoom automático no iOS/Android */
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  height: var(--touch-target);
  padding: 0 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-primary:active {
  background-color: var(--accent-hover);
}

.btn-secondary {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  height: var(--touch-target);
  padding: 0 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.btn-secondary:active {
  background-color: var(--bg-surface-active);
}

/* Bottom Sheet */
.bottom-sheet-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(2px);
}

.bottom-sheet-content {
  background-color: var(--bg-surface);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px 16px calc(24px + var(--safe-bottom));
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.bottom-sheet-handle {
  width: 40px;
  height: 4px;
  background-color: var(--border-color);
  border-radius: var(--radius-full);
  margin: -10px auto 16px auto;
}

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

/* Toasts */
.toast-container {
  position: fixed;
  bottom: calc(70px + var(--safe-bottom));
  left: 16px;
  right: 16px;
  max-width: 508px;
  margin: 0 auto;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: fadeIn 0.15s ease-out;
}
.toast-acao {
  background-color: var(--brand-accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 12px;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
