/* Layout Principal com Sidebar e Header Fixos */
html.app-html,
body.app-body,
html:has(.app-layout),
body:has(.app-layout) {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  max-width: 100vw;
  width: 100%;
}

.app-layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  position: relative;
  background: var(--bg-base);
  overflow: hidden;
}

/* Área Principal (Header fixo no topo + Conteúdo rolável) */
.app-main-wrapper {
  flex: 1;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.sidebar-open {
  overflow: hidden;
}

/* Área de Conteúdo Principal - O scroll inicia exatamente na parte inferior do header e fica no canto da tela */
.main-content {
  flex: 1;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Scrollbar posicionada no canto direito da tela, tocando a base do header */
.main-content::-webkit-scrollbar {
  width: 7px;
}

.main-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15);
}

.main-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-full);
}

.main-content::-webkit-scrollbar-thumb:hover {
  background: rgba(197, 168, 128, 0.45);
}

.main-content-inner {
  width: 100%;
  min-height: 100%;
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
}

/* Quando a tela for pequena ao ponto de esconder o sidebar (<= 900px), oculta a scrollbar do main */
@media (max-width: 900px) {
  .main-content {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .main-content::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }
}

/* Layout Container */
.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* Views Management */
.view-section {
  display: none;
  padding: 2.5rem 0 4rem;
  animation: fadeIn 0.3s ease;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--gold-light, #fbbf24);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

/* Section Header */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* Card Styles */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.card-hover:hover {
  border-color: var(--gold-border);
  transform: translateY(-2px);
}

.card-gold-border {
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-md);
}

/* Empty State Modern Component */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-card);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  width: 100%;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.empty-state-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  max-width: 460px;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* Error State Modern Component */
.error-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: rgba(239, 68, 68, 0.04);
  border: 1px solid var(--ruby-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  width: 100%;
}

.error-state-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--ruby-subtle);
  border: 1px solid var(--ruby-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ruby);
  margin-bottom: 1rem;
}

.error-state-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.4rem;
}

.error-state-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 440px;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}


/* Responsive adjustments globais */
@media (max-width: 640px) {
  .container {
    padding: 0 1rem;
  }
  .section-title {
    font-size: 1.5rem;
  }
  .section-header {
    margin-bottom: 1.25rem;
  }
  .view-section {
    padding: 1.5rem 0 3rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 0.75rem;
  }
  .section-title {
    font-size: 1.35rem;
  }
}

