/* ========================================
   VARIÁVEIS CSS - MENU/SIDEBAR
   ======================================== */
:root {
    --color-white: #FFFFFF;
    
    --topbar-height: 70px;
    --sidebar-width: 320px;
    
    --font-family: "Roboto", sans-serif;
    --font-size-base: 10px;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    
    --transition-speed: 0.24s;
    --transition-easing: ease;
}

/* ========================================
   RESET E BASE
   ======================================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    overflow-x: hidden;
}

/* ========================================
   TOP BAR FIXA
   ======================================== */
header.top-bar,
.top-bar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: var(--topbar-height) !important;
    background-color: var(--topbar-bg) !important;
    background: var(--topbar-bg) !important;
    border-bottom: 3px solid var(--topbar-border) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 2rem !important;
    z-index: 1000 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-bar-logo {
    font-size: 2rem;
    line-height: 1;
}

.top-bar-title {
    flex: 1 !important;
    text-align: center !important;
}

header.top-bar .top-bar-title h1,
.top-bar .top-bar-title h1,
.top-bar-title h1 {
    margin: 0 !important;
    font-size: 1.5rem !important;
    font-weight: var(--font-weight-semibold) !important;
    color: var(--color-text) !important;
}
 
header.top-bar .top-bar-title-text,
.top-bar .top-bar-title-text,
.top-bar-title-text,
header.top-bar .top-bar-title h1 span,
.top-bar .top-bar-title h1 span {
    color: var(--color-text) !important;
    font-weight: 500 !important;
}

/* ========================================
   MENU TOGGLE BUTTON (HAMBÚRGUER)
   ======================================== */
.menu-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 32px;
    height: 32px;
    justify-content: center;
    align-items: center;
    transition: transform var(--transition-speed) var(--transition-easing);
    color: var(--color-text) !important;
}
 
.menu-toggle:hover {
    transform: scale(1.1);
    color: var(--sidebar-hover-color) !important;
}
 
.menu-toggle-line {
    width: 24px;
    height: 3px;
    background-color: var(--color-text);
    border-radius: 0;
    transition: all var(--transition-speed) var(--transition-easing);
}

body.menu-open .menu-toggle-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

body.menu-open .menu-toggle-line:nth-child(2) {
    opacity: 0;
}

body.menu-open .menu-toggle-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ========================================
   SIDEBAR (MENU LATERAL)
   ======================================== */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--topbar-height));
    background-color: var(--sidebar-bg);
    transform: translateX(-100%);
    transition: transform var(--transition-speed) var(--transition-easing);
    z-index: 999;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
}

body.menu-open .sidebar {
    transform: translateX(0);
}

/* Scrollbar customizada */
.sidebar::-webkit-scrollbar {
    width: 8px;
}
 
.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
 
.sidebar::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 0;
}
 
.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-hover);
}

/* ========================================
   NAVEGAÇÃO DO MENU
   ======================================== */
.main-nav {
    padding: 1rem 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1.5rem;
    color: var(--sidebar-item-color);
    text-decoration: none;
    font-size: 11px;
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all var(--transition-speed) var(--transition-easing);
    border-left: 3px solid transparent;
}
 
.nav-link:hover {
    background-color: var(--sidebar-hover-bg);
    border-left-color: var(--sidebar-hover-color);
    color: var(--sidebar-hover-color);
}
 
.nav-link.active {
    background-color: var(--sidebar-active-bg);
    border-left-color: var(--sidebar-active-border);
    color: var(--sidebar-hover-color);
    font-weight: var(--font-weight-semibold);
}

.nav-link .icon {
    font-size: 1.2rem;
    line-height: 1;
}

/* ========================================
   DROPDOWN DE NAVEGAÇÃO
   ======================================== */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.dropdown-arrow {
    font-size: 0.7rem;
    transition: transform var(--transition-speed) var(--transition-easing);
    margin-left: auto;
}

.nav-dropdown:hover .dropdown-arrow,
.nav-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-speed) var(--transition-easing);
    background-color: rgba(0, 0, 0, 0.2);
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.active .nav-dropdown-menu {
    max-height: 500px;
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1.5rem 0.5rem 2.5rem;
    color: var(--sidebar-item-color);
    text-decoration: none;
    font-size: 11px;
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all var(--transition-speed) var(--transition-easing);
    border-left: 3px solid transparent;
    opacity: 0.85;
}
 
.nav-dropdown-item:hover {
    background-color: var(--sidebar-hover-bg);
    border-left-color: var(--sidebar-hover-color);
    color: var(--sidebar-hover-color);
    opacity: 1;
}
 
.nav-dropdown-item.active {
    background-color: var(--sidebar-active-bg);
    border-left-color: var(--sidebar-active-border);
    color: var(--sidebar-hover-color);
    font-weight: var(--font-weight-semibold);
    opacity: 1;
}

/* ========================================
   BACKDROP (OVERLAY)
   ======================================== */
.sidebar-backdrop {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed) var(--transition-easing),
                visibility var(--transition-speed) var(--transition-easing);
    z-index: 998;
    border: none;
    cursor: pointer;
}

body.menu-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   BOTÃO DE BORDA (EDGE TOGGLE)
   ======================================== */
.sidebar-edge-toggle {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 24px;
    height: 80px;
    background-color: var(--color-primary);
    border: none;
    border-radius: 0;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 997;
    transition: all var(--transition-speed) var(--transition-easing);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
    /* ESCONDIDA por padrão */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
 
.sidebar-edge-toggle:hover {
    width: 32px;
    background-color: var(--color-primary-hover);
}

/* Mostrar seta SOMENTE quando menu estiver aberto */
body.menu-open .sidebar-edge-toggle {
    left: var(--sidebar-width);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body.menu-open .sidebar-edge-toggle span {
    transform: rotate(180deg);
}

/* ========================================
   CONTEÚDO PRINCIPAL
   ======================================== */
.app-content {
    margin-top: var(--topbar-height);
    padding: 2rem;
    transition: margin-left var(--transition-speed) var(--transition-easing);
    min-height: calc(100vh - var(--topbar-height));
}

/* ========================================
   SECTIONS DE CONTEÚDO
   ======================================== */
.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   RESPONSIVIDADE
   ======================================== */

/* Desktop: Menu empurra o conteúdo */
@media (min-width: 1025px) {
    body.menu-open .app-content {
        margin-left: var(--sidebar-width);
    }
    
    .sidebar-backdrop {
        display: none;
    }
}

/* Tablet e Mobile: Menu sobrepõe o conteúdo */
@media (max-width: 1024px) {
    .top-bar {
        padding: 0 1rem;
    }
    
    .top-bar-title h1 {
        font-size: 1.2rem;
    }
    
    .sidebar {
        width: 280px;
    }
    
    body.menu-open .sidebar-edge-toggle {
        left: 280px;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    
    .app-content {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .top-bar-title h1 {
        font-size: 1rem;
    }
    
    .sidebar {
        width: 260px;
    }
    
    body.menu-open .sidebar-edge-toggle {
        left: 260px;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    
    .app-content {
        padding: 1rem;
    }
    
    .nav-link {
        padding: 0.875rem 1.5rem;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 0 0.75rem;
    }
    
    .top-bar-title h1 {
        font-size: 0.875rem;
    }
    
    .sidebar {
        width: 240px;
    }
    
    body.menu-open .sidebar-edge-toggle {
        left: 240px;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    
    /* Esconder seta em telas muito pequenas */
    .sidebar-edge-toggle {
        display: none !important;
    }
}

/* ========================================
   AJUSTES PARA COMPATIBILIDADE
   ======================================== */

/* Esconder elementos antigos que conflitam */
.inmetrics-topbar {
    display: none !important;
}

.docs-sidebar {
    display: none !important;
}

.docs-toggle-btn,
.docs-close-floating-btn {
    display: none !important;
}

/* Ajustar container principal */
.container {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.container > header {
    margin-top: 0 !important;
    padding-top: 1rem !important;
}

/* ========================================
   ESTILOS PARA SEÇÃO DE DOCUMENTAÇÃO
   ======================================== */
#readme-container {
    background-color: var(--bg-secondary);
    padding: 2rem;
    border-radius: 0;
    max-width: 100%;
    overflow-x: auto;
}
 
#readme-container pre {
    background-color: var(--code-bg);
    color: var(--code-text);
    padding: 1.5rem;
    border-radius: 0;
    border-left: 4px solid var(--color-primary);
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ========================================
   ACESSIBILIDADE
   ======================================== */
.menu-toggle:focus,
.nav-link:focus,
.sidebar-backdrop:focus,
.sidebar-edge-toggle:focus {
    outline: 2px solid var(--color-cyan-inmetrics);
    outline-offset: 2px;
}

/* Reduzir movimento para usuários com preferência */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   ESTILOS DA DOCUMENTAÇÃO
   ======================================== */
.documentation-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Introdução da API */
.api-intro {
    background: var(--bg-surface);
    color: var(--color-text);
    padding: 2rem;
    border-radius: 0;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}
 
.api-intro h2 {
    margin-top: 0;
    color: var(--section-title-color);
    font-size: 2rem;
    margin-bottom: 1rem;
}
 
.api-intro p {
    margin: 0.75rem 0;
    line-height: 1.8;
    font-size: 1rem;
}
 
.api-intro code {
    background: var(--code-bg);
    color: var(--color-primary);
    padding: 0.3rem 0.6rem;
    border-radius: 0;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
}
 
.api-intro a {
    color: var(--color-link);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}
 
.api-intro a:hover {
    color: var(--color-primary-hover);
}
 
/* Categorias de API */
.api-category {
    margin-bottom: 3rem;
}
 
.api-category h3 {
    color: var(--section-title-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    border-bottom: 3px solid var(--section-title-border);
    padding-bottom: 0.5rem;
}
 
/* Cards de Endpoint */
.endpoint-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}
 
.endpoint-card:hover {
    box-shadow: var(--shadow-md);
}
 
/* Header do Card */
.endpoint-header {
    padding: 1rem 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-tertiary);
    transition: background 0.2s;
    user-select: none;
}
 
.endpoint-header:hover {
    background: var(--bg-hover);
}
 
.endpoint-header.expanded {
    background: var(--color-info-bg);
}

/* Métodos HTTP */
.http-method {
    padding: 0.4rem 0.9rem;
    border-radius: 0;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 70px;
    text-align: center;
}

.http-method.get {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.4);
}
 
.http-method.post {
    background: rgba(0, 153, 204, 0.2);
    color: #0099cc;
    border: 1px solid rgba(0, 153, 204, 0.4);
}
 
.http-method.put {
    background: rgba(197, 139, 45, 0.2);
    color: #c58b2d;
    border: 1px solid rgba(197, 139, 45, 0.4);
}
 
.http-method.delete {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.4);
}
 
/* Path do Endpoint */
.endpoint-path {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text);
}
 
/* Ícone de Expansão */
.expand-icon {
    transition: transform 0.3s ease;
    font-size: 1.2rem;
    color: var(--color-text-muted);
}
 
.endpoint-header.expanded .expand-icon {
    transform: rotate(180deg);
}
 
/* Detalhes do Endpoint */
.endpoint-details {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    border-top: 1px solid var(--border-color);
}
 
.endpoint-details[style*="display: block"] {
    padding: 1.5rem;
    max-height: 2000px;
}
 
/* Descrição do Endpoint */
.endpoint-description {
    margin-bottom: 1.5rem;
    color: var(--color-text-muted);
    font-size: 1rem;
    line-height: 1.6;
    font-weight: 500;
}
 
/* Títulos dentro dos detalhes */
.endpoint-details h4 {
    color: var(--color-text);
    font-size: 1rem;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--section-title-border);
    padding-left: 0.75rem;
}
 
.endpoint-details h4:first-of-type {
    margin-top: 0;
}
 
/* Lista de Parâmetros */
.params-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
 
.params-list li {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 0;
    border-left: 3px solid var(--color-secondary);
}
 
.params-list strong {
    color: var(--color-text);
    font-size: 0.95rem;
    font-weight: 700;
}
 
.params-list p {
    margin: 0.5rem 0 0 0;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}
 
/* Tags de Status */
.required {
    color: var(--color-danger);
    font-weight: 700;
    font-size: 0.85rem;
}
 
.optional {
    color: var(--color-text-muted);
    font-style: italic;
    font-size: 0.85rem;
}
 
/* Nome da Tabela */
.table-name {
    font-family: 'Courier New', monospace;
    background: var(--code-bg);
    color: var(--color-primary);
    padding: 0.6rem 1.2rem;
    border-radius: 0;
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.5rem;
    box-shadow: var(--shadow-sm);
}

/* Responsividade */
@media (max-width: 768px) {
    .documentation-container {
        padding: 1rem;
    }
    
    .api-intro {
        padding: 1.5rem;
    }
    
    .api-intro h2 {
        font-size: 1.5rem;
    }
    
    .endpoint-header {
        padding: 0.875rem 1rem;
        flex-wrap: wrap;
    }
    
    .http-method {
        min-width: 60px;
        font-size: 0.75rem;
        padding: 0.3rem 0.7rem;
    }
    
    .endpoint-path {
        font-size: 0.85rem;
        flex-basis: 100%;
        margin-top: 0.5rem;
    }
    
    .endpoint-details[style*="display: block"] {
        padding: 1rem;
    }
    
    .params-list li {
        padding: 0.75rem;
    }
}

/* ========================================
   CORREÇÃO DO CABEÇALHO - TEMA DINÂMICO
   ======================================== */
header.top-bar,
header.top-bar * {
    background-color: transparent !important;
    background: transparent !important;
}

header.top-bar {
    background-color: var(--topbar-bg) !important;
    background: var(--topbar-bg) !important;
    border-bottom: 3px solid var(--topbar-border) !important;
}

header.top-bar h1,
header.top-bar h1 *,
header.top-bar .top-bar-title,
header.top-bar .top-bar-title *,
header.top-bar .top-bar-title-text {
    color: var(--color-text) !important;
    background: transparent !important;
    background-color: transparent !important;
}

/* ========================================
   BOTÃO HAMBÚRGUER - TEMA DINÂMICO
   ======================================== */
.menu-toggle,
button.menu-toggle,
.top-bar .menu-toggle,
header.top-bar .menu-toggle,
.top-bar-left .menu-toggle,
header.top-bar .top-bar-left .menu-toggle,
#menu-toggle {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    font-size: 1.8rem !important;
    cursor: pointer !important;
    padding: 0.5rem !important;
    color: var(--color-text) !important;
    transition: color 0.2s !important;
}

.menu-toggle:hover,
button.menu-toggle:hover,
.top-bar .menu-toggle:hover,
header.top-bar .menu-toggle:hover,
.top-bar-left .menu-toggle:hover,
header.top-bar .top-bar-left .menu-toggle:hover,
#menu-toggle:hover {
    color: var(--sidebar-hover-color) !important;
    background: none !important;
    background-color: transparent !important;
}

/* Garantir que o ícone dentro do botão herde a cor */
.menu-toggle *,
.menu-toggle::before,
.menu-toggle::after,
button.menu-toggle *,
button.menu-toggle::before,
button.menu-toggle::after,
#menu-toggle *,
#menu-toggle::before,
#menu-toggle::after {
    color: inherit !important;
}

/* Linhas do hambúrguer seguem o tema */
.menu-toggle-line,
.menu-toggle .menu-toggle-line,
button.menu-toggle .menu-toggle-line,
#menu-toggle .menu-toggle-line {
    background-color: var(--color-text) !important;
}

.menu-toggle:hover .menu-toggle-line,
button.menu-toggle:hover .menu-toggle-line,
#menu-toggle:hover .menu-toggle-line {
    background-color: var(--sidebar-hover-color) !important;
}

/* ========================================
   CARD "COMO USAR"
   ======================================== */
.how-to-use-card {
    background: var(--bg-surface);
    border-left: 4px solid var(--color-primary);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 0;
    box-shadow: var(--shadow-md);
}

.how-to-use-card h4 {
    color: var(--color-text);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.how-to-use-card ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.how-to-use-card ol li {
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.how-to-use-card p {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.how-to-use-card strong {
    color: var(--color-primary);
}

/* ============================================================================
   ÍCONE DE AJUDA (?)
   ============================================================================ */

.help-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background-color: var(--color-primary);
    color: var(--color-white);
    border-radius: 0;
    font-size: 16px;
    font-weight: bold;
    margin-left: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    vertical-align: middle;
}

.help-icon:hover {
    background-color: var(--color-primary-hover);
    color: var(--color-white);
    transform: scale(1.1);
}

/* ========================================
   BOTÃO DE TOGGLE DE TEMA
   ======================================== */
.top-bar-right {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.theme-toggle-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    padding: 0.35rem 0.6rem;
    border-radius: 0;
    color: var(--sidebar-item-color);
    transition: transform 0.2s ease, color 0.2s ease;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover {
    transform: scale(1.2);
    color: var(--sidebar-hover-color);
}

.theme-toggle-btn:focus {
    outline: none;
}

.theme-icon {
    display: inline-block;
    line-height: 1;
}
