/* MV2 Mobile — Design System Premium */

:root {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-surface-elevated: #334155;
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-primary-light: #60a5fa;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-text: #f8fafc;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;
  --color-border: rgba(148, 163, 184, 0.15);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.35);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --nav-height: 72px;
  --header-height: 64px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Safe area top para Dynamic Island / notch */
.safe-top {
  height: var(--safe-top);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 200;
}

/* Header fixo */
.mobile-header {
  position: sticky;
  top: var(--safe-top);
  z-index: 100;
  height: var(--header-height);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.mobile-header__logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.mobile-header__title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.mobile-header__action {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.mobile-header__action:active {
  transform: scale(0.92);
  background: var(--color-surface-elevated);
}

/* Conteúdo principal */
.mobile-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(var(--nav-height) + var(--safe-bottom) + 16px);
}

/* Tela cheia para login */
.fullscreen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  padding-top: calc(var(--safe-top) + 24px);
  padding-bottom: calc(var(--safe-bottom) + 24px);
}

/* Cards */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:active {
  transform: scale(0.98);
}

.card--elevated {
  background: linear-gradient(145deg, var(--color-surface-elevated), var(--color-surface));
  box-shadow: var(--shadow-md);
}

.card--primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  border: none;
}

.card__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-text);
}

.card__value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.card__label {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: var(--transition);
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: white;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
}

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

.btn--secondary {
  background: var(--color-surface-elevated);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn--danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

/* Inputs */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  min-height: 56px;
  padding: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 1rem;
  transition: var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

/* Login */
.login-brand {
  text-align: center;
  margin-bottom: 48px;
}

.login-brand__logo {
  width: 120px;
  height: auto;
  margin-bottom: 24px;
  filter: brightness(0) invert(1);
}

.login-brand__title {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.login-brand__subtitle {
  font-size: 1rem;
  color: var(--color-text-secondary);
}

.login-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--color-danger);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.9375rem;
  display: none;
}

.login-error.is-visible {
  display: block;
}

/* Menu grid */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 8px;
}

.menu-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--color-text);
}

.menu-item:active {
  transform: scale(0.96);
  background: var(--color-surface-elevated);
}

.menu-item__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.menu-item__label {
  font-size: 0.9375rem;
  font-weight: 600;
}

/* Barra de navegação inferior */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.bottom-nav__item {
  flex: 1;
  height: var(--nav-height);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.6875rem;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
}

.bottom-nav__item.active {
  color: var(--color-primary-light);
}

.bottom-nav__item svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
  transition: var(--transition);
}

.bottom-nav__item.active svg {
  stroke: var(--color-primary-light);
  transform: translateY(-2px);
}

/* Placeholder de módulo */
.module-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  text-align: center;
  padding: 24px;
}

.module-placeholder__icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin-bottom: 24px;
}

.module-placeholder__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.module-placeholder__text {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* Loading spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface) 25%, var(--color-surface-elevated) 50%, var(--color-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Dashboard stats */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.dashboard-stat {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.dashboard-stat__value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.dashboard-stat__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Utilitários */
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }

/* Ajustes para telas pequenas */
@media (max-width: 374px) {
  html { font-size: 14px; }
  .menu-grid { gap: 12px; }
  .menu-item { padding: 20px 12px; }
  .bottom-nav__item { font-size: 0.625rem; }
}

/* Ajustes para telas grandes (iPhone Pro Max, Android grandes) */
@media (min-width: 428px) {
  html { font-size: 17px; }
  .mobile-content { padding: 20px 20px calc(var(--nav-height) + var(--safe-bottom) + 20px); }
}

/* Landscape prevention — manter experiência mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .bottom-nav {
    position: relative;
  }
  .mobile-content {
    padding-bottom: 16px;
  }
}
