/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    background: #ffffff;
    padding: 32px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.loading-spinner i {
    font-size: 1.5rem;
    color: #2563eb;
    margin-bottom: 12px;
}

.loading-spinner p {
    margin: 0;
    color: #6b7280;
    font-weight: 400;
    font-size: 0.875rem;
}

/* Footer */
.footer {
    margin-top: 48px;
    padding: 24px 0;
    text-align: center;
    color: #9ca3af;
    border-top: 1px solid #f3f4f6;
}

.footer p {
    margin: 4px 0;
    font-size: 0.875rem;
}

.footer small {
    opacity: 0.8;
    font-size: 0.8125rem;
}

/* Destacar resultados da busca */
.highlight {
    background: #fef3c7;
    padding: 1px 3px;
    border-radius: 2px;
    font-weight: 500;
}

/* Estados de busca */
.tree-group.hidden,
.tree-subgroup.hidden,
.tree-item.hidden {
    display: none;
}

.tree-group.search-match {
    border-left-color: #f59e0b;
}

.tree-subgroup.search-match .subgroup-header {
    background: #fffbeb;
}

.tree-item.search-match .item-header {
    background: #fffbeb;
}

/* Responsividade */
@media (max-width: 768px) {
    .container {
        padding: 20px 16px; /* Padding menor no mobile */
    }
    
    .header {
        flex-direction: column;
        text-align: center;
        padding: 32px 0;
    }
    
    .header-content h1 {
        font-size: 1.75rem;
    }
    
    .header-actions {
        justify-content: center;
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .group-header {
        padding: 20px 24px;
    }
    
    .subgroup-header {
        padding: 16px 24px 16px 48px;
    }
    
    .item-header {
        padding: 16px 24px 16px 72px;
    }
    
    .item-content {
        padding: 0 24px 20px 72px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .header-actions {
        width: 100%;
        gap: 8px;
    }
    
    .btn {
        flex: 1;
        justify-content: center;
        padding: 10px 16px;
        font-size: 0.8125rem;
    }
    
    .group-header {
        padding: 16px 20px;
    }
    
    .subgroup-header {
        padding: 14px 20px 14px 40px;
    }
    
    .item-header {
        padding: 14px 20px 14px 60px;
    }
    
    .item-content {
        padding: 0 20px 16px 60px;
    }
    
    .group-title,
    .subgroup-title,
    .item-title {
        font-size: 0.875rem;
    }
    
    .group-count,
    .subgroup-count {
        font-size: 0.6875rem;
        padding: 2px 8px;
    }
}

/* Animações suaves */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tree-group,
.stat-card {
    animation: fadeIn 0.3s ease forwards;
}

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* Estilo personalizado para scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f9fafb;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Estados adicionais para melhor UX */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn:focus {
    outline: 2px solid transparent;
    box-shadow: 0 0 0 2px #2563eb40;
}

/* Melhorar acessibilidade */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .header-actions,
    .search-section,
    .btn {
        display: none;
    }
    
    .tree-group,
    .tree-subgroup,
    .tree-item {
        break-inside: avoid;
    }
    
    .group-content,
    .subgroup-content,
    .item-content {
        display: block !important;
    }
}/* Reset e configurações básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.7;
    color: #374151;
    background-color: #ffffff;
    font-weight: 400;
}

/* Container principal */
.container {
    max-width: 100%; /* Largura máxima total */
    margin: 0 auto;
    padding: 40px 40px; /* Padding maior nas laterais */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: #ffffff;
    color: #1f2937;
    padding: 40px 0;
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.header-content h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #111827;
}

.header-content .subtitle {
    font-size: 1rem;
    color: #6b7280;
    font-weight: 400;
}

.header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Botões */
.btn {
    padding: 12px 20px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    background: #ffffff;
    color: #374151;
}

.btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    background-color: #f8fafc;
}

.btn-primary {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: white;
}

.btn-secondary {
    background: #f9fafb;
    color: #6b7280;
    border-color: #d1d5db;
}

.btn-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.8rem;
}

/* Seção de busca */
.search-section {
    margin-bottom: 32px;
}

.search-box {
    position: relative;
    max-width: 480px;
    margin: 0 auto;
}

.search-box i.fa-search {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.875rem;
}

#searchInput {
    width: 100%;
    padding: 14px 48px 14px 44px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    background: #ffffff;
    transition: all 0.2s ease;
    font-weight: 400;
}

#searchInput:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: #f3f4f6;
    color: #6b7280;
}

/* Estatísticas */
.stats-section {
    margin-bottom: 40px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.stat-card {
    background: #ffffff;
    padding: 24px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #2563eb;
    background: #eff6ff;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 400;
}

/* Conteúdo principal */
.main-content {
    flex: 1;
}

.tree-container {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

/* Grupos da árvore */
.tree-group {
    border-bottom: 1px solid #f3f4f6;
}

.tree-group:last-child {
    border-bottom: none;
}

.group-header {
    display: flex;
    align-items: center;
    padding: 24px 32px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.group-header:hover {
    background: #f9fafb;
    border-left-color: #e5e7eb;
}

.group-header.active {
    background: #f9fafb;
    border-left-color: #2563eb;
}

.group-header.active .group-icon {
    transform: rotate(90deg);
}

.group-icon {
    margin-right: 16px;
    transition: transform 0.2s ease;
    color: #9ca3af;
    font-size: 0.75rem;
    width: 12px;
}

.group-folder-icon {
    margin-right: 16px;
    color: #6b7280;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.group-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    letter-spacing: -0.025em;
}

.group-count {
    background: #f3f4f6;
    color: #6b7280;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.group-content {
    display: none;
    background: #ffffff;
}

.group-content.active {
    display: block;
}

/* Sub-grupos */
.tree-subgroup {
    border-bottom: 1px solid #f9fafb;
}

.tree-subgroup:last-child {
    border-bottom: none;
}

.subgroup-header {
    display: flex;
    align-items: center;
    padding: 20px 32px 20px 64px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fefefe;
}

.subgroup-header:hover {
    background: #f9fafb;
}

.subgroup-header.active {
    background: #f9fafb;
}

.subgroup-header.active .subgroup-icon {
    transform: rotate(90deg);
}

.subgroup-icon {
    margin-right: 16px;
    transition: transform 0.2s ease;
    color: #9ca3af;
    font-size: 0.75rem;
    width: 12px;
}

.subgroup-folder-icon {
    margin-right: 16px;
    color: #9ca3af;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.subgroup-title {
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #374151;
}

.subgroup-count {
    background: #f3f4f6;
    color: #9ca3af;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.subgroup-content {
    display: none;
    background: #ffffff;
}

.subgroup-content.active {
    display: block;
}

/* Itens individuais */
.tree-item {
    border-bottom: 1px solid #f9fafb;
}

.tree-item:last-child {
    border-bottom: none;
}

.item-header {
    display: flex;
    align-items: flex-start;
    padding: 20px 32px 20px 96px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
}

.item-header:hover {
    background: #f8fafc;
}

.item-header.active {
    background: #f8fafc;
}

.item-icon {
    margin-right: 12px;
    margin-top: 2px;
    color: #2563eb;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.item-title {
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 400;
    color: #111827;
    line-height: 1.5;
    margin-right: 16px;
}

.item-code {
    background: #eff6ff;
    color: #2563eb;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 12px;
    flex-shrink: 0;
}

.item-info-icon {
    color: #d1d5db;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.item-header:hover .item-info-icon {
    color: #9ca3af;
}

.item-content {
    display: none;
    padding: 0 32px 24px 96px;
    background: #ffffff;
}

.item-content.active {
    display: block;
}

.item-description {
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.6;
}

.item-description strong {
    color: #374151;
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
}

.item-description p {
    margin: 0;
    padding: 16px 20px;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 2px solid #e5e7eb;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Mensagens */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 16px 20px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: space-between;
    font-size: 0.875rem;
}

.error-message i {
    font-size: 1rem;
    color: #dc2626;
    flex-shrink: 0;
}

.no-results {
    text-align: center;
    padding: 80px 20px;
    color: #9ca3af;
}

.no-results i {
    font-size: 2.5rem;
    margin-bottom: 16px;
    opacity: 0.6;
}

.no-results h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: #6b7280;
    font-weight: 500;
}

.no-results p {
    font-size: 0.875rem;
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.loading-spinner i {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 15px;
}

.loading-spinner p {
    margin: 0;
    color: #6b7280;
    font-weight: 500;
}

/* Footer */
.footer {
    margin-top: 40px;
    padding: 25px 0;
    text-align: center;
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
}

.footer p {
    margin: 5px 0;
}

.footer small {
    opacity: 0.8;
}

/* Destacar resultados da busca */
.highlight {
    background: #fef3c7;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
}

/* Estados de busca */
.tree-group.hidden,
.tree-subgroup.hidden,
.tree-item.hidden {
    display: none;
}

.tree-group.search-match {
    border-left: 4px solid #f59e0b;
}

.tree-subgroup.search-match .subgroup-header {
    background: #fffbeb;
    border-left-color: #f59e0b;
}

.tree-item.search-match .item-header {
    background: #fffbeb;
    border-left-color: #f59e0b;
}

/* Responsividade */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .header-content h1 {
        font-size: 1.8rem;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .group-header {
        padding: 15px 20px;
    }
    
    .subgroup-header {
        padding: 12px 40px 12px 30px;
    }
    
    .item-header {
        padding: 12px 50px 12px 40px;
    }
    
    .item-content {
        padding: 15px 40px 20px 40px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .btn {
        flex: 1;
        justify-content: center;
    }
    
    .group-title,
    .subgroup-title,
    .item-title {
        font-size: 0.9rem;
    }
    
    .group-count,
    .subgroup-count {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
}

/* Animações suaves */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tree-group,
.stat-card {
    animation: fadeIn 0.5s ease forwards;
}

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* Estilo personalizado para scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}