/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px var(--space-md);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { opacity: 0.9; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface2); }

.btn-danger {
  background: var(--accent2);
  color: #fff;
}
.btn-danger:hover { opacity: 0.9; }

.btn-icon {
  background: transparent;
  color: var(--muted2);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
}
.btn-icon:hover { color: var(--text); background: var(--surface2); }

.btn--full  { width: 100%; }
.btn--sm    { padding: 6px 12px; font-size: var(--text-sm); }
.btn--lg    { padding: 14px var(--space-lg); font-size: var(--text-lg); }

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + var(--space-lg));
  right: var(--space-lg);
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-accent);
  border: none;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  z-index: 100;
  text-decoration: none;
}
.fab:hover  { transform: scale(1.08); }
.fab:active { transform: scale(0.95); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
}
.card--interactive {
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}
.card--interactive:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.card--interactive:active { transform: translateY(0); }

/* ============================================================
   INPUTS
   ============================================================ */
.input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px var(--space-md);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  outline: none;
  transition: border-color var(--transition);
  box-sizing: border-box;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--muted); }
.input:disabled { opacity: 0.5; cursor: not-allowed; }
.input[type="number"]::-webkit-inner-spin-button,
.input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

.input-group { display: flex; flex-direction: column; gap: var(--space-sm); }
.input-group__label {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.input-group__hint {
  font-size: var(--text-sm);
  color: var(--muted2);
  margin: 0;
}
.input-group__field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-group__field-wrap .input { padding-right: 44px; }
.input-group__toggle-pw {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}
.input-group__toggle-pw:hover { color: var(--text); }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-green  { background: rgba(34, 197, 94, 0.15);  color: var(--green);  }
.badge-red    { background: rgba(239, 68, 68, 0.15);   color: var(--accent2); }
.badge-yellow { background: rgba(234, 179, 8, 0.15);   color: var(--yellow); }
.badge-blue   { background: rgba(59, 130, 246, 0.15);  color: var(--blue);   }
.badge-orange { background: rgba(249, 115, 22, 0.15);  color: var(--accent); }
.badge-muted  { background: var(--surface2); color: var(--muted2); }

.badge-live {
  animation: livePulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35);
}

@keyframes livePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
  }
  70% {
    transform: scale(1.04);
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background: var(--surface2);
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-md);
  color: var(--muted2);
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-full);
}
.avatar--xl { width: 80px; height: 80px; font-size: 2rem; }
.avatar--lg { width: 64px; height: 64px; font-size: 1.5rem; }
.avatar--md { width: 48px; height: 48px; font-size: 1.25rem; }
.avatar--sm { width: 28px; height: 28px; font-size: 0.75rem; }
.avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
}

/* ============================================================
   SECTION LABEL
   ============================================================ */
.section-label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--mobile-max);
  height: var(--bottom-nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 200;
}
.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  transition: color var(--transition);
}
.bottom-nav__item--form {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.bottom-nav__button {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
}
.bottom-nav__item--active { color: var(--accent); }
.bottom-nav__item:hover   { color: var(--text); }
.bottom-nav__icon { width: 22px; height: 22px; }
.bottom-nav__avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}
.alert__icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.alert--error   { background: rgba(239, 68, 68, 0.12);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }
.alert--success { background: rgba(34, 197, 94, 0.12);  color: #86efac; border: 1px solid rgba(34,197,94,0.25); }
.alert--warning { background: rgba(234, 179, 8, 0.12);  color: #fde047; border: 1px solid rgba(234,179,8,0.25); }
.alert--info    { background: rgba(59, 130, 246, 0.12); color: #93c5fd; border: 1px solid rgba(59,130,246,0.25); }

/* ============================================================
   STEPPER (+/–)
   ============================================================ */
.stepper {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.stepper__btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: var(--text-xl);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
  user-select: none;
  -webkit-user-select: none;
}
.stepper__btn:hover  { background: var(--border); }
.stepper__btn:active { transform: scale(0.9); }
.stepper__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.stepper__value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text);
  min-width: 32px;
  text-align: center;
  /* quando for <input type="number"> */
  background: transparent;
  border: none;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
  width: 40px;
}
.stepper__value::-webkit-outer-spin-button,
.stepper__value::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}
.page-header__back {
  display: flex;
  align-items: center;
  color: var(--muted2);
  text-decoration: none;
  padding: var(--space-sm);
  margin: calc(-1 * var(--space-sm));
  border-radius: var(--radius-sm);
}
.page-header__back:hover { color: var(--text); }
.page-header__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  flex: 1;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.page-header__actions { display: flex; gap: var(--space-sm); margin-left: auto; }

/* ============================================================
   DIVIDER
   ============================================================ */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-md) 0;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
}
.empty-state__icon { color: var(--muted); }
.empty-state__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.empty-state__desc { color: var(--muted2); font-size: var(--text-sm); margin: 0; }

/* ============================================================
   SPINNER
   ============================================================ */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; display: inline-block; }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 90;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1;
  padding: var(--space-md) var(--space-sm);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted2);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
  text-align: center;
}
.tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab:hover:not(.tab--active) { color: var(--text); }

/* ============================================================
   LIST ITEM
   ============================================================ */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item__info { flex: 1; min-width: 0; }
.list-item__title {
  font-weight: 500;
  color: var(--text);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item__sub {
  font-size: var(--text-sm);
  color: var(--muted2);
  margin: 0;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
  position: fixed;
  top: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: calc(var(--mobile-max) - 2 * var(--space-md));
  pointer-events: none;
}
.toast {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  pointer-events: all;
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast--visible {
  opacity: 1;
  transform: translateY(0);
}
.toast--success { background: #14532d; color: #86efac; border: 1px solid rgba(34,197,94,0.3); }
.toast--error   { background: #7f1d1d; color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.toast--warning { background: #713f12; color: #fde047; border: 1px solid rgba(234,179,8,0.3); }

/* ============================================================
   CONFIRM MODAL
   ============================================================ */
.app-confirm {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
}
.app-confirm--visible {
  display: block;
}
.app-confirm__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(2px);
}
.app-confirm__dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -48%);
  width: calc(var(--mobile-max) - 2 * var(--space-md));
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-md);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.app-confirm--visible .app-confirm__dialog {
  opacity: 1;
  transform: translate(-50%, -50%);
}
.app-confirm__head {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text);
}
.app-confirm__message {
  margin-top: var(--space-sm);
  color: var(--muted2);
  font-size: var(--text-sm);
}
.app-confirm__actions {
  margin-top: var(--space-md);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

