/* Sistema de Ajuda - Identidade Visual Monocromática Elegante */

/* Variáveis específicas para o sistema de ajuda */
:root {
    --help-font-primary: 'Inter', sans-serif;
    --help-font-bold: 'Inter', sans-serif;
    
    /* Paleta monocromática elegante */
    --help-black: #000000;
    --help-dark: #1a1a1a;
    --help-gray-dark: #333333;
    --help-gray: #666666;
    --help-gray-light: #999999;
    --help-gray-lighter: #cccccc;
    --help-white-dark: #f5f5f5;
    --help-white: #ffffff;
    
    /* Gradientes elegantes */
    --help-gradient-primary: linear-gradient(135deg, var(--help-black) 0%, var(--help-gray-dark) 100%);
    --help-gradient-secondary: linear-gradient(135deg, var(--help-gray-dark) 0%, var(--help-gray) 100%);
    --help-gradient-light: linear-gradient(135deg, var(--help-white) 0%, var(--help-white-dark) 100%);
    
    /* Sombras modernas */
    --help-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --help-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --help-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --help-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Transições suaves */
    --help-transition-fast: 0.2s ease;
    --help-transition-normal: 0.3s ease;
    --help-transition-slow: 0.5s ease;
}

/* Container do modal de ajuda - usa o modal-container existente */
#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: var(--help-transition-normal);
}

#modal-container.active {
    display: flex;
    pointer-events: auto;
}

/* Modal principal de ajuda */
.help-modal {
    position: relative;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    font-family: var(--help-font-primary);
    pointer-events: none;
    /* GARANTIR ALTURA MÍNIMA */
    min-height: 100vh;
}

.help-modal.active {
    display: flex;
    pointer-events: auto;
    animation: helpModalFadeIn 0.3s ease-out;
}

/* Overlay do modal */
.help-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1;
}

/* Conteúdo do modal */
.help-modal-content {
    position: relative;
    z-index: 2;
    background: var(--help-white);
    border-radius: 16px;
    max-width: 900px;
    width: 95vw;
    max-height: 90vh;
    min-height: 600px; /* ALTURA MÍNIMA PARA GARANTIR QUE APAREÇA */
    display: flex;
    flex-direction: column;
    box-shadow: var(--help-shadow-xl);
    border: 1px solid rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: helpModalSlideIn 0.4s ease-out;
}

/* Header do modal */
.help-modal-header {
    background: var(--help-gradient-primary);
    color: var(--help-white);
    padding: 20px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.help-modal-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.help-tour-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: var(--help-white);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--help-transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--help-font-primary);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.help-tour-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.help-tour-btn i {
    font-size: 0.9rem;
}

.help-modal-header h2 {
    font-family: var(--help-font-bold);
    font-size: 1.75rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--help-white) !important;
}

.help-modal-header h2 i {
    font-size: 1.5rem;
    opacity: 0.9;
    color: var(--help-white) !important;
}

/* Botão de fechar */
.help-modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--help-white);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 8px 12px;
    border-radius: 8px;
    transition: var(--help-transition-fast);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.help-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Corpo do modal */
.help-modal-body {
    display: flex;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    /* FORÇAR ALTURA MÍNIMA */
    height: calc(100% - 80px); /* 80px é aproximadamente a altura do header */
}

/* Navegação lateral */
.help-modal-nav {
    background: var(--help-gradient-light);
    padding: 20px 0;
    border-right: 1px solid var(--help-gray-lighter);
    min-width: 220px;
    max-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    scroll-behavior: smooth;
    min-height: 0;
    max-height: calc(90vh - 80px);
    height: 100%;
}

/* Botões de navegação */
.help-nav-btn {
    background: none;
    border: none;
    text-align: left;
    padding: 12px 20px;
    font-family: var(--help-font-primary);
    font-size: 0.95rem;
    color: var(--help-gray);
    cursor: pointer;
    transition: var(--help-transition-fast);
    border-radius: 0 20px 20px 0;
    margin: 0 6px 0 0;
    font-weight: 500;
    position: relative;
    overflow: visible;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.help-nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: var(--help-gradient-primary);
    transition: var(--help-transition-normal);
    z-index: -1;
}

.help-nav-btn:hover {
    color: var(--help-black);
    background: rgba(0, 0, 0, 0.05);
}

.help-nav-btn:hover::before {
    width: 100%;
}

.help-nav-btn.active {
    background: var(--help-gradient-primary);
    color: var(--help-white);
    font-weight: 600;
    box-shadow: var(--help-shadow-md);
}

.help-nav-btn.active::before {
    width: 100%;
}

/* Seções de conteúdo - IDÊNTICAS AO SISTEMA DE CONFIGURAÇÕES */
.help-modal-sections {
    flex: 1; /* CORRIGIDO: igual ao sistema de configurações */
    padding: 20px 24px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--help-white);
    /* min-height: 0 é essencial para o scroll funcionar em flex items */
    min-height: 0; /* CORRIGIDO: altura mínima 0 para permitir scroll */
    max-height: calc(90vh - 80px); /* Adicionado: altura máxima para controlar scroll */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Seções individuais */
.help-section {
    display: none;
    animation: helpSectionFadeIn 0.3s ease-out;
}

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

/* Conteúdo de ajuda */
.help-content {
    line-height: 1.6;
    color: var(--help-black);
    padding-bottom: 40px;
}

.help-content h3 {
    font-family: var(--help-font-bold);
    font-size: 1.3rem;
    margin: 0 0 6px 0;
    color: var(--help-black);
    font-weight: 600;
}

.help-content h4 {
    font-family: var(--help-font-bold);
    font-size: 1rem;
    margin: 12px 0 6px 0;
    color: var(--help-gray-dark);
    font-weight: 600;
}

.help-content p {
    margin: 0 0 6px 0;
    font-size: 0.9rem;
    color: var(--help-gray);
    line-height: 1.4;
}

.help-content ul {
    margin: 6px 0;
    padding-left: 18px;
}

.help-content li {
    margin: 3px 0;
    color: var(--help-gray);
    line-height: 1.3;
}

.help-content .help-tip {
    background: var(--help-white-dark);
    border-left: 4px solid var(--help-black);
    padding: 8px 12px;
    margin: 10px 0;
    border-radius: 0 8px 8px 0;
}

.help-content .help-tip strong {
    color: var(--help-black);
    font-weight: 600;
}

/* Botão de ajuda no header */
.help-button {
    background: rgba(255, 255, 255, 0.9);
    color: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    padding: 10px 16px;
    font-family: var(--help-font-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.help-button:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.9);
}

.help-button i {
    font-size: 1rem;
    color: var(--help-black);
}

/* Animações */
@keyframes helpModalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes helpModalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes helpSectionFadeIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsividade */
@media (max-width: 768px) {
    .help-modal-content {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        min-height: 100vh;
        border-radius: 0;
    }
    
    .help-modal-header {
        padding: 16px 20px;
        border-radius: 0;
        flex-shrink: 0;
    }
    
    .help-modal-header h2 {
        font-size: 1.4rem;
    }
    
    .help-modal-body {
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
        height: calc(100vh - 80px);
    }
    
    .help-modal-nav {
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--help-gray-lighter);
        min-width: 0;
        max-width: none;
        padding: 10px 0;
        gap: 0;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: thin;
        -ms-overflow-style: auto;
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    .help-nav-btn {
        display: inline-block;
        border-radius: 20px;
        margin: 0 5px;
        padding: 8px 15px;
        font-size: 0.85rem;
        white-space: nowrap;
        flex-shrink: 0;
        min-width: auto;
        width: auto;
        border-left: none;
        border-bottom: 2px solid transparent;
    }
    
    .help-nav-btn:hover {
        transform: translateY(-2px);
    }
    
    .help-nav-btn.active {
        border-bottom-color: var(--help-black);
        transform: translateY(-2px);
    }
    
    .help-modal-sections {
        padding: 20px;
        flex: 1; /* CORRIGIDO: igual ao sistema de configurações */
        min-height: 0; /* CORRIGIDO: essencial para scroll em mobile */
        max-height: calc(100vh - 120px); /* CORRIGIDO: considera header e navegação em mobile */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    .help-button {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .help-modal-header {
        padding: 14px 16px;
        flex-shrink: 0;
    }
    
    .help-modal-header h2 {
        font-size: 1.2rem;
    }
    
    .help-modal-body {
        min-height: 0;
        overflow: hidden;
        height: calc(100vh - 70px);
    }
    
    .help-modal-nav {
        padding: 8px 0;
        gap: 0;
        flex-shrink: 0;
    }
    
    .help-nav-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
        min-width: auto;
        margin: 0 3px;
    }
    
    .help-modal-sections {
        padding: 16px;
        flex: 1; /* CORRIGIDO: igual ao sistema de configurações */
        min-height: 0; /* CORRIGIDO: essencial para scroll */
        max-height: calc(100vh - 110px); /* CORRIGIDO: altura máxima adequada */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    .help-content h3 {
        font-size: 1.3rem;
    }
    
    .help-content h4 {
        font-size: 1.1rem;
    }
    
    .help-button {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
}

/* Media query adicional para telas muito pequenas */
@media (max-width: 360px) {
    .help-modal-header {
        padding: 12px 14px;
    }
    
    .help-modal-header h2 {
        font-size: 1.1rem;
    }
    
    .help-modal-body {
        height: calc(100vh - 60px);
    }
    
    .help-nav-btn {
        padding: 5px 10px;
        font-size: 0.75rem;
        margin: 0 2px;
    }
    
    .help-modal-sections {
        padding: 12px;
        flex: 1; /* CORRIGIDO: igual ao sistema de configurações */
        min-height: 0; /* CORRIGIDO: essencial para scroll */
        max-height: calc(100vh - 100px); /* CORRIGIDO: altura máxima adequada */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    .help-content h3 {
        font-size: 1.2rem;
    }
    
    .help-content h4 {
        font-size: 1rem;
    }
}

/* Estados especiais */
body.help-modal-open {
    overflow: hidden;
}

/* Garantir que o modal seja visível quando ativo */
#modal-container.active .help-modal.active {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Forçar exibição do modal de ajuda quando ativo */
.help-modal.active {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Garantir que o conteúdo do modal seja sempre visível */
.help-modal.active .help-modal-content {
    min-height: 600px !important;
    height: auto !important;
}

.help-modal.active .help-modal-body {
    display: flex !important;
    visibility: visible !important;
    height: calc(100% - 80px) !important;
    min-height: 500px !important;
    overflow: hidden !important;
}

/* Garantir que o menu de navegação tenha scroll adequado */
.help-modal.active .help-modal-nav {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    max-height: calc(90vh - 80px) !important;
    min-height: 0 !important;
    height: 100% !important;
}

.help-modal.active .help-modal-sections {
    display: block !important;
    visibility: visible !important;
    height: auto !important; /* CORRIGIDO: altura automática */
    min-height: 0 !important; /* CORRIGIDO: permite scroll */
    max-height: calc(90vh - 80px) !important; /* CORRIGIDO: altura máxima adequada */
    flex: 1 !important; /* CORRIGIDO: igual ao sistema de configurações */
}

.help-modal.active .help-section.active {
    display: block !important;
    visibility: visible !important;
}

/* CORREÇÃO CRÍTICA: Garantir que apenas UMA seção seja exibida por vez */
.help-modal.active .help-section:not(.active) {
    display: none !important;
    visibility: hidden !important;
}

/* Garantir que o título seja sempre branco */
.help-modal-header h2,
.help-modal-header h2 * {
    color: var(--help-white) !important;
}

/* Garantir que o ícone seja sempre branco */
.help-modal-header h2 i {
    color: var(--help-white) !important;
}

/* Scrollbar personalizada para seções - IDÊNTICA AOS OUTROS MODAIS */
.help-modal-sections::-webkit-scrollbar {
    width: 6px; /* CORRIGIDO: largura igual aos outros modais */
}

.help-modal-sections::-webkit-scrollbar-track {
    background: var(--help-white-dark);
    border-radius: 3px; /* CORRIGIDO: raio igual aos outros modais */
}

.help-modal-sections::-webkit-scrollbar-thumb {
    background: var(--help-gray-light);
    border-radius: 3px; /* CORRIGIDO: raio igual aos outros modais */
    transition: var(--help-transition-fast);
}

.help-modal-sections::-webkit-scrollbar-thumb:hover {
    background: var(--help-gray);
}

/* Scrollbar personalizada para navegação */
.help-modal-nav::-webkit-scrollbar {
    width: 8px;
}

.help-modal-nav::-webkit-scrollbar-track {
    background: var(--help-white-dark);
    border-radius: 4px;
}

.help-modal-nav::-webkit-scrollbar-thumb {
    background: var(--help-gray-light);
    border-radius: 4px;
    transition: var(--help-transition-fast);
}

.help-modal-nav::-webkit-scrollbar-thumb:hover {
    background: var(--help-gray);
}

/* Garantir scrollbar visível quando necessário */
.help-modal-nav {
    scrollbar-width: thin;
    scrollbar-color: var(--help-gray-light) var(--help-white-dark);
}

/* Melhorias de acessibilidade */
.help-modal:focus {
    outline: none;
}

.help-nav-btn:focus-visible {
    outline: 2px solid var(--help-black);
    outline-offset: 2px;
}

.help-button:focus-visible {
    outline: 2px solid var(--help-black);
    outline-offset: 2px;
}

/* CORREÇÃO CRÍTICA PARA CONFLITOS COM GLOBAL-MODAL-FIX.CSS */
#modal-container.active .help-modal-sections {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth !important;
    min-height: 0 !important;
    max-height: calc(90vh - 80px) !important;
    flex: 1 !important; /* CORRIGIDO: igual ao sistema de configurações */
    height: auto !important; /* CORRIGIDO: altura automática */
}

/* CORREÇÃO CRÍTICA: Garantir que apenas UMA seção seja exibida por vez */
#modal-container.active .help-section.active {
    display: block !important;
    visibility: visible !important;
}

#modal-container.active .help-section:not(.active) {
    display: none !important;
    visibility: hidden !important;
}

/* Melhorias específicas para mobile - IDÊNTICAS AO SISTEMA DE CONFIGURAÇÕES */
@media (max-width: 768px) {
    .help-modal-sections {
        /* Garantir scroll suave em mobile */
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
        /* Forçar scrollbar visível em mobile */
        scrollbar-width: thin !important;
        -ms-overflow-style: auto !important;
        /* CORREÇÃO CRÍTICA: Forçar scrollbar sempre visível em mobile */
        overflow-y: scroll !important; /* Força scrollbar sempre visível */
        overflow-x: hidden !important;
        scrollbar-width: thin !important; /* Firefox */
        -ms-overflow-style: scrollbar !important; /* IE/Edge */
        min-height: 0 !important;
        max-height: calc(100vh - 120px) !important; /* CORRIGIDO: considera header e navegação */
        flex: 1 !important; /* CORRIGIDO: igual ao sistema de configurações */
        height: auto !important; /* CORRIGIDO: altura automática */
    }
    
    /* Melhorar navegação em mobile */
    .help-modal-nav {
        /* Garantir scroll horizontal suave */
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
        scrollbar-width: thin !important;
        -ms-overflow-style: auto !important;
    }
    
    /* Garantir que o conteúdo seja scrollável */
    .help-content {
        min-height: auto !important;
        padding-bottom: 20px !important; /* Espaço extra para scroll */
    }
    
    /* CORREÇÃO CRÍTICA: Forçar scrollbar sempre visível em mobile */
    .help-modal-sections {
        /* Forçar scrollbar sempre visível */
        scrollbar-width: thin !important; /* Firefox */
        -ms-overflow-style: scrollbar !important; /* IE/Edge */
        overflow-y: scroll !important; /* Força scrollbar sempre visível */
    }
    
    .help-modal-sections::-webkit-scrollbar {
        width: 8px !important; /* Largura maior em mobile para melhor visibilidade */
        display: block !important; /* Força exibição */
    }
    
    .help-modal-sections::-webkit-scrollbar-track {
        background: var(--help-white-dark) !important;
        border-radius: 4px !important;
        display: block !important; /* Força exibição */
    }
    
    .help-modal-sections::-webkit-scrollbar-thumb {
        background: var(--help-gray) !important; /* Cor mais escura em mobile */
        border-radius: 4px !important;
        display: block !important; /* Força exibição */
    }
    
    .help-modal-sections::-webkit-scrollbar-thumb:hover {
        background: var(--help-black) !important;
    }
} 