/* ==========================================================================
   Sidebar Layout
   ========================================================================== */

:root {
  --vp-sidebar-w: 240px;
  --vp-sidebar-w-collapsed: 64px;
  --vp-topbar-h: 56px;
}

/* ── Wrapper geral ── */
.vp-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ── Sidebar ── */
.vp-sidebar {
  width: var(--vp-sidebar-w);
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1040;
  background: var(--vp-surface);
  border-right: 1px solid var(--vp-border);
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--vp-border) transparent;
}

.vp-sidebar::-webkit-scrollbar { width: 4px; }
.vp-sidebar::-webkit-scrollbar-track { background: transparent; }
.vp-sidebar::-webkit-scrollbar-thumb { background: var(--vp-border); border-radius: 2px; }

/* ── Área principal ── */
.vp-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--vp-sidebar-w);
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Estado colapsado (desktop apenas) ── */
@media (min-width: 768px) {
  .vp-layout.sidebar-collapsed .vp-sidebar {
    width: var(--vp-sidebar-w-collapsed);
  }
  .vp-layout.sidebar-collapsed .vp-main {
    margin-left: var(--vp-sidebar-w-collapsed);
  }
  .vp-layout.sidebar-collapsed .vp-sidebar-item-label,
  .vp-layout.sidebar-collapsed .vp-sidebar-arrow,
  .vp-layout.sidebar-collapsed .vp-sidebar-brand-text,
  .vp-layout.sidebar-collapsed .vp-sidebar-user-info,
  .vp-layout.sidebar-collapsed .vp-sidebar-section-label {
    opacity: 0;
    width: 0;
    pointer-events: none;
    overflow: hidden;
  }
  .vp-layout.sidebar-collapsed .vp-sidebar-item {
    justify-content: center;
    padding: 10px;
    gap: 0;
  }
  .vp-layout.sidebar-collapsed .vp-sidebar-header {
    justify-content: center;
    padding: 0 8px;
  }
  .vp-layout.sidebar-collapsed .vp-sidebar-brand {
    gap: 0;
    justify-content: center;
  }
  .vp-layout.sidebar-collapsed .vp-sidebar-user {
    justify-content: center;
    padding: 8px;
  }
  .vp-layout.sidebar-collapsed .vp-sidebar-submenu {
    display: none !important;
  }
}

/* ── Brand como toggle (desktop) ── */
@media (min-width: 768px) {
  .vp-sidebar-brand {
    cursor: pointer;
  }
  .vp-sidebar-brand:hover i {
    color: var(--vp-primary);
  }
}

/* ── Cabeçalho do sidebar ── */
.vp-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  height: var(--vp-topbar-h);
  border-bottom: 1px solid var(--vp-border);
  flex-shrink: 0;
  gap: 8px;
}

.vp-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--vp-text) !important;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.vp-sidebar-brand i {
  font-size: 1.2rem;
  color: var(--vp-primary);
  flex-shrink: 0;
}

.vp-sidebar-brand-text {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.2s, width 0.25s;
}

.vp-sidebar-brand-text span { color: var(--vp-primary); }

/* ── Navegação ── */
.vp-sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── Item de menu ── */
.vp-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--vp-text) !important;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none !important;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  min-height: 40px;
  position: relative;
}

.vp-sidebar-item:hover {
  background: var(--vp-surface-hover);
  color: var(--vp-primary) !important;
}

.vp-sidebar-item.active {
  background: color-mix(in srgb, var(--vp-primary) 10%, transparent);
  color: var(--vp-primary) !important;
}

.vp-sidebar-item > i:first-child,
.vp-sidebar-item > .vp-sidebar-icon-wrap:first-child {
  font-size: 0.95rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.vp-sidebar-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s, width 0.25s;
}

.vp-sidebar-arrow {
  font-size: 0.68rem;
  color: var(--vp-text-muted);
  transition: transform 0.2s, opacity 0.2s;
  flex-shrink: 0;
  margin-left: auto;
}

/* Rotaciona seta quando submenu aberto */
.vp-sidebar-group-btn[aria-expanded="true"] .vp-sidebar-arrow {
  transform: rotate(90deg);
  color: var(--vp-primary);
}

/* ── Submenu ── */
.vp-sidebar-submenu {
  padding-left: 12px;
  margin-top: 1px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.vp-sidebar-submenu .vp-sidebar-item {
  font-size: 0.825rem;
  padding: 7px 10px;
  min-height: 34px;
  color: var(--vp-text-muted) !important;
}

.vp-sidebar-submenu .vp-sidebar-item:hover {
  color: var(--vp-primary) !important;
}

.vp-sidebar-submenu .vp-sidebar-item > i:first-child {
  font-size: 0.82rem;
}

/* ── Divider ── */
.vp-sidebar-divider {
  height: 1px;
  background: var(--vp-border);
  margin: 6px 4px;
  flex-shrink: 0;
}

/* ── Rodapé ── */
.vp-sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--vp-border);
  flex-shrink: 0;
}

.vp-sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  overflow: hidden;
  transition: padding 0.25s, gap 0.25s;
}

.vp-sidebar-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  flex: 1;
  min-width: 0;
  transition: opacity 0.2s, width 0.25s;
}

.vp-sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--vp-text);
}

/* ── Overlay (mobile) ── */
.vp-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1039;
}

.vp-sidebar-overlay.active {
  display: block;
}

/* ── Topbar ── */
.vp-topbar {
  height: var(--vp-topbar-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--vp-border);
  background: var(--vp-surface);
  gap: 10px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ── Hambúrguer mobile ── */
.vp-mobile-toggle {
  display: none;
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  border-radius: 8px;
  padding: 7px;
  flex-shrink: 0;
}

.vp-mobile-toggle .bar {
  display: block;
  height: 2px;
  background: var(--vp-text);
  border-radius: 2px;
  transition: all 0.2s;
}

.vp-mobile-toggle .bar:nth-child(1) { width: 20px; }
.vp-mobile-toggle .bar:nth-child(2) { width: 15px; }
.vp-mobile-toggle .bar:nth-child(3) { width: 10px; }

.vp-mobile-toggle:hover { background: var(--vp-surface-hover); }

/* ── Mobile: sidebar como overlay ── */
@media (max-width: 767.98px) {
  .vp-sidebar {
    width: var(--vp-sidebar-w) !important;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }
  .vp-sidebar.mobile-open {
    transform: translateX(0);
  }
  .vp-main {
    margin-left: 0 !important;
  }
  .vp-mobile-toggle {
    display: flex;
  }
  /* Em mobile, nunca colapsado — sempre mostra labels */
  .vp-layout.sidebar-collapsed .vp-sidebar-item-label,
  .vp-layout.sidebar-collapsed .vp-sidebar-arrow,
  .vp-layout.sidebar-collapsed .vp-sidebar-brand-text,
  .vp-layout.sidebar-collapsed .vp-sidebar-user-info {
    opacity: 1 !important;
    width: auto !important;
    pointer-events: auto !important;
  }
  .vp-layout.sidebar-collapsed .vp-sidebar-item {
    justify-content: flex-start !important;
    padding: 9px 10px !important;
    gap: 10px !important;
  }
  .vp-layout.sidebar-collapsed .vp-sidebar-header {
    justify-content: space-between !important;
    padding: 0 12px !important;
  }
  .vp-layout.sidebar-collapsed .vp-sidebar-brand {
    gap: 10px !important;
    justify-content: flex-start !important;
  }
  .vp-layout.sidebar-collapsed .vp-sidebar-user {
    justify-content: flex-start !important;
    padding: 8px 10px !important;
    gap: 10px !important;
  }
  .vp-layout.sidebar-collapsed .vp-sidebar-submenu {
    display: flex !important;
  }
}

/* ── Dark mode ajustes sidebar ── */
[data-bs-theme="dark"] .vp-sidebar {
  box-shadow: 1px 0 0 var(--vp-border);
}

/* ==========================================================================
   Definição das Fontes Locais
   ========================================================================== */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/roboto-regular.woff2') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  src: url('../fonts/roboto-medium.woff2') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  src: url('../fonts/roboto-bold.woff2') format('woff2');
  font-display: swap;
}

:root {
  --font-primary: 'Roboto', system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --bs-font-sans-serif: var(--font-primary);
  --bs-body-font-family: var(--font-primary);
}

html {
  font-size: 14px;
  height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

body {
  margin: 0;
  font-family: var(--font-primary);
}

/* Layout autenticado: sidebar + main */
.vp-layout {
  min-height: 100vh;
}

/* Layout sem sidebar (não autenticado): flex coluna */
body:not(:has(.vp-layout)) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1 0 auto;
}

/* ==========================================================================
   Brand Logo (topbar mobile e layout não autenticado)
   ========================================================================== */
.brand-logo-modern {
  font-family: var(--vp-font);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--vp-text) !important;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

.brand-logo-modern:hover {
  opacity: 0.85;
}

.brand-logo-modern .brand-accent,
.brand-accent {
  color: var(--vp-primary) !important;
  font-weight: 800;
}

/* ==========================================================================
   Dashboard Highlights & Cards
   ========================================================================== */
.border-left-primary {
    border-left: 0.25rem solid #4e73df !important;
}

.border-left-success {
    border-left: 0.25rem solid #1cc88a !important;
}

.border-left-info {
    border-left: 0.25rem solid #36b9cc !important;
}

.border-left-warning {
    border-left: 0.25rem solid #f6c23e !important;
}

.border-left-danger {
    border-left: 0.25rem solid #e74a3b !important;
}

.text-gray-800 {
    color: #5a5c69 !important;
}

.text-gray-300 {
    color: #dddfeb !important;
}
