/* ==========================================================================
   UrbanPilot — Design System & Custom CSS
   Paleta Oficial:
   Navy: #0F172A / #1E293B
   Royal Blue: #2563EB / #1D4ED8
   Emerald Green: #10B981 / #059669
   Background: #F8FAFC
   ========================================================================== */

:root {
  --up-navy: #0F172A;
  --up-navy-light: #1E293B;
  --up-navy-border: #334155;
  --up-blue: #2563EB;
  --up-blue-dark: #1D4ED8;
  --up-blue-light: #EFF6FF;
  --up-emerald: #10B981;
  --up-emerald-dark: #059669;
  --up-emerald-light: #ECFDF5;
  --up-bg: #F8FAFC;
  --up-surface: #FFFFFF;
  --up-border: #E2E8F0;
  --up-text-main: #0F172A;
  --up-text-muted: #64748B;
  --up-sidebar-width: 260px;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--up-bg);
  color: var(--up-text-main);
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* --------------------------------------------------------------------------
   Layout Shell
   -------------------------------------------------------------------------- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar Desktop */
.app-sidebar {
  width: var(--up-sidebar-width);
  background-color: var(--up-navy);
  color: #F8FAFC;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all 0.25s ease-in-out;
  z-index: 1020;
}

.app-sidebar .sidebar-brand {
  padding: 1.25rem 1.5rem;
  background-color: #0B1120;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--up-navy-border);
}

.app-sidebar .sidebar-brand img {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.app-sidebar .nav-link {
  color: #94A3B8;
  padding: 0.75rem 1.25rem;
  font-size: 0.925rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.375rem;
  margin: 0.2rem 0.75rem;
  transition: all 0.15s ease;
}

.app-sidebar .nav-link:hover {
  color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.08);
}

.app-sidebar .nav-link.active {
  color: #FFFFFF;
  background-color: var(--up-blue);
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.sidebar-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748B;
  padding: 1rem 1.25rem 0.35rem;
  font-weight: 700;
}

/* Main Content Area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--up-bg);
}

/* Top Navbar */
.app-navbar {
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--up-border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.context-badge {
  background-color: var(--up-blue-light);
  color: var(--up-blue-dark);
  border: 1px solid #BFDBFE;
  padding: 0.35rem 0.75rem;
  border-radius: 2rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.org-badge {
  background-color: var(--up-emerald-light);
  color: var(--up-emerald-dark);
  border: 1px solid #A7F3D0;
  padding: 0.25rem 0.6rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Cards & Surfaces */
.up-card {
  background: var(--up-surface);
  border: 1px solid var(--up-border);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-bottom: 1.5rem;
  transition: box-shadow 0.2s ease;
}

.up-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
}

.up-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--up-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
}

.up-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--up-navy);
  margin: 0;
}

.up-card-body {
  padding: 1.25rem;
}

/* Stat Cards */
.stat-card {
  padding: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--up-border);
  background: #FFFFFF;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.stat-icon-blue {
  background-color: var(--up-blue-light);
  color: var(--up-blue);
}

.stat-icon-emerald {
  background-color: var(--up-emerald-light);
  color: var(--up-emerald);
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--up-navy);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--up-text-muted);
  font-weight: 500;
}

/* Table Design */
.up-table-responsive {
  border-radius: 0.5rem;
  overflow: hidden;
}

.table.up-table {
  margin-bottom: 0;
  vertical-align: middle;
}

.table.up-table thead th {
  background-color: #F1F5F9;
  color: #475569;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--up-border);
}

.table.up-table tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--up-border);
  color: #1E293B;
  font-size: 0.9rem;
}

.table.up-table tbody tr:hover {
  background-color: #F8FAFC;
}

/* Help Button & Drawer */
.btn-help-trigger {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #F1F5F9;
  color: var(--up-navy);
  border: 1px solid var(--up-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.15s ease;
  cursor: pointer;
  text-decoration: none;
}

.btn-help-trigger:hover {
  background-color: var(--up-blue);
  color: #FFFFFF;
  border-color: var(--up-blue);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.help-drawer {
  width: 380px !important;
  max-width: 90vw;
  background-color: #FFFFFF;
}

/* Empty State Component */
.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-state-icon {
  font-size: 2.5rem;
  color: #94A3B8;
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--up-navy);
  margin-bottom: 0.5rem;
}

.empty-state-description {
  font-size: 0.9rem;
  color: var(--up-text-muted);
  max-width: 400px;
  margin: 0 auto;
}

/* Buttons */
.btn-up-primary {
  background-color: var(--up-blue);
  border-color: var(--up-blue);
  color: #FFFFFF;
  font-weight: 500;
  padding: 0.55rem 1.15rem;
  border-radius: 0.45rem;
}

.btn-up-primary:hover {
  background-color: var(--up-blue-dark);
  border-color: var(--up-blue-dark);
  color: #FFFFFF;
}

.btn-up-success {
  background-color: var(--up-emerald);
  border-color: var(--up-emerald);
  color: #FFFFFF;
  font-weight: 500;
}

.btn-up-success:hover {
  background-color: var(--up-emerald-dark);
  border-color: var(--up-emerald-dark);
  color: #FFFFFF;
}

/* Auth Layout */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #1E293B, #0F172A);
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #FFFFFF;
  border-radius: 1rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  padding: 2.25rem;
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-logo img {
  max-width: 220px;
  height: auto;
}

/* --------------------------------------------------------------------------
   Mobile Responsiveness (360px / 768px / 1440px)
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -100%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
  }

  .app-sidebar.show {
    left: 0;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1015;
  }

  .sidebar-backdrop.show {
    display: block;
  }
}

@media (max-width: 576px) {
  .app-navbar {
    padding: 0.5rem 1rem;
  }
  .context-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }
  .auth-card {
    padding: 1.5rem;
  }
}

/* Password Visibility Toggle (Olhinho) */
.btn-toggle-password {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 0.75rem;
  color: #64748B;
  background-color: #FFFFFF;
  border-color: #CBD5E1;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.btn-toggle-password:hover {
  color: var(--up-blue);
  background-color: #F8FAFC;
  border-color: #94A3B8;
}

.btn-toggle-password:focus {
  box-shadow: none;
  border-color: var(--up-blue);
  color: var(--up-blue);
}

