/* ============================================================================
 * ATLAS GESTÃO PREDIAL — DESIGN SYSTEM v4.0 (SAAS / FRACTTAL-INSPIRED)
 * ============================================================================ */

:root {
  --atlas-primary: #0066CC;
  --atlas-primary-hover: #0052A3;
  --atlas-primary-soft: #EBF4FF;
  --atlas-sidebar-bg: #0F172A;
  --atlas-sidebar-hover: #1E293B;
  --atlas-sidebar-active: #0066CC;
  --atlas-navy: #0F172A;
  --atlas-navy-deep: #090F1D;
  --atlas-slate: #1E293B;
  --atlas-emerald: #059669;
  --atlas-emerald-hover: #047857;
  --atlas-bg: #F4F7FA;
  --atlas-surface: #FFFFFF;
  --atlas-border: #E2E8F0;
  --atlas-text: #0F172A;
  --atlas-muted: #64748B;
  --atlas-sidebar-width: 248px;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--atlas-bg);
  color: var(--atlas-text);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

table, .tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ─── FRACTTAL-STYLE APP SHELL (SIDEBAR + TOPBAR) ────────────────────────── */
.atlas-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.atlas-sidebar {
  width: var(--atlas-sidebar-width);
  background: linear-gradient(180deg, var(--atlas-navy-deep) 0%, var(--atlas-sidebar-bg) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  transition: width 0.2s ease, transform 0.25s ease;
  flex-shrink: 0;
}

body.atlas-sidebar-collapsed .atlas-sidebar {
  width: 72px;
}

body.atlas-sidebar-collapsed .atlas-sidebar .sidebar-label,
body.atlas-sidebar-collapsed .atlas-sidebar .sidebar-section-title,
body.atlas-sidebar-collapsed .atlas-sidebar .sidebar-brand-text,
body.atlas-sidebar-collapsed .atlas-sidebar .sidebar-logo-full {
  display: none;
}

body.atlas-sidebar-collapsed .atlas-sidebar .sidebar-logo-icon {
  display: block;
}

body.atlas-sidebar-collapsed .atlas-sidebar .sidebar-brand-header {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  justify-content: center;
  gap: 0.25rem;
}

body.atlas-sidebar-collapsed .atlas-sidebar .sidebar-link {
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: #CBD5E1;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover {
  background-color: var(--atlas-sidebar-hover);
  color: #FFFFFF;
}

.sidebar-link.active {
  background-color: var(--atlas-primary);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.32);
}

.atlas-topbar {
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--atlas-border);
  position: sticky;
  top: 0;
  z-index: 90;
}

/* Legado compatível */
.atlas-header-bar {
  background: linear-gradient(135deg, var(--atlas-navy-deep) 0%, var(--atlas-navy) 100%);
}

/* Cards & Painéis SaaS */
.atlas-card {
  background: var(--atlas-surface);
  border: 1px solid var(--atlas-border);
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.atlas-card:hover.atlas-card-interactive {
  border-color: #93C5FD;
  box-shadow: 0 8px 20px -8px rgba(0, 102, 204, 0.18);
  transform: translateY(-1px);
}

.atlas-kpi-value {
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

/* Abas estilo Fracttal */
.atlas-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 1px solid var(--atlas-border);
}

.atlas-tab {
  padding: 0.625rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--atlas-muted);
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.atlas-tab:hover {
  color: var(--atlas-text);
}

.atlas-tab.active {
  color: var(--atlas-primary);
  border-bottom-color: var(--atlas-primary);
}

/* Inputs e Foco */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--atlas-primary) !important;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.14);
}

/* Normalização visual para cards legados */
main > div > .rounded-3xl,
main > .rounded-3xl {
  border-radius: 0.875rem !important;
}

/* Dropdowns */
.nav-dropdown-menu { display: none; z-index: 130; }
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  display: block !important;
}

/* Print Clean */
@media print {
  .no-print, .atlas-sidebar, .atlas-topbar {
    display: none !important;
  }
  .atlas-shell {
    display: block !important;
  }
  main {
    max-width: 100% !important;
    padding: 0 !important;
  }
}
