/* ========================================
   SITE MAP BUILDER - COMPONENTES
   ======================================== */

/* Animações para feedback de navegação por teclado */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.animate-fade-in {
    animation: fade-in 0.3s ease-out;
}

.animate-fade-out {
    animation: fade-out 0.3s ease-out;
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.25rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    outline: none;
}

.btn:hover {
    opacity: 0.8;
}

.btn:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}

.btn-secondary {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

/* Seletor de Cores */
.color-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-picker-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
}

.color-picker-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.color-indicator {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 2px solid;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.color-palette {
    display: flex;
    gap: 0.25rem;
}

.color-palette-button {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.25rem;
    border: 1px solid;
    cursor: pointer;
    transition: opacity 0.2s ease;
    position: relative;
}

.color-palette-button:hover {
    opacity: 0.8;
}

.color-picker-input {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.25rem;
    cursor: pointer;
    opacity: 0;
    position: absolute;
    inset: 0;
}

.color-picker-button {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border-primary);
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.color-picker-icon {
    font-size: 0.75rem;
    color: var(--accent-primary);
}

/* Seletor de Ícones */
.icon-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-picker-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
}

.icon-picker-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.icon-indicator {
    width: 2rem;
    height: 2rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border-primary);
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.icon-quick-buttons {
    display: flex;
    gap: 0.25rem;
}

.icon-quick-button {
    width: 2rem;
    height: 2rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border-primary);
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.icon-quick-button:hover {
    opacity: 0.8;
}

/* Modais */
.modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 56rem;
    width: 100%;
    margin: 1rem;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
    background: none;
    border: none;
    font-size: 1.25rem;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-primary);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Modal de Ajuda */
.help-modal .modal-content {
    max-height: 90vh;
}

.help-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.help-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.help-modal-icon {
    color: #3b82f6;
}

.help-modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.help-section {
    margin-bottom: 2rem;
}

.help-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-section-icon {
    font-size: 1.25rem;
}

.help-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.help-step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.help-step-number {
    background-color: #dbeafe;
    color: #1e40af;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    flex-shrink: 0;
}

.help-step-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.help-grid-item {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.help-grid-title {
    font-weight: 500;
    color: var(--text-primary);
}

.help-grid-list {
    font-size: 0.875rem;
    color: var(--text-secondary);
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.help-grid-list li {
    position: relative;
    padding-left: 1rem;
}

.help-grid-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--text-secondary);
}

.help-tips {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
    padding: 1rem;
}

.help-tips-list {
    font-size: 0.875rem;
    color: var(--text-secondary);
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.help-tips-list li {
    position: relative;
    padding-left: 1rem;
}

.help-tips-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--text-secondary);
}

/* Grid de Ícones */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
}

.icon-category {
    grid-column: span 6;
    margin-bottom: 1rem;
}

.icon-category-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: 0.25rem;
}

.icon-category-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
}

.icon-button {
    width: 3rem;
    height: 3rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border-primary);
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.icon-button:hover {
    opacity: 0.8;
}

/* Busca de Ícones */
.icon-search {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-primary);
    border-radius: 0.25rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
}

.icon-search:focus {
    outline: 1px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Botão de Tema */
.theme-toggle {
    padding: 0.5rem;
    border-radius: 0.25rem;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    opacity: 0.8;
}

/* Botão de Ajuda */
.help-toggle {
    padding: 0.5rem;
    border-radius: 0.25rem;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.help-toggle:hover {
    opacity: 0.8;
}

/* Estados de Loading */
.loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    animation: spin 1s linear infinite;
}

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

/* Tooltips */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Lista de Nós Compacta */
.node-item {
    cursor: pointer;
    padding: 2px 4px;
    margin-bottom: 1px;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.node-item:hover {
    opacity: 0.8;
}

.node-item-selected {
    background-color: var(--accent-primary);
    color: white;
}

.node-item-content {
    display: flex;
    align-items: center;
    gap: 4px;
}

.node-level {
    font-size: 10px;
    font-weight: 600;
    color: #6b7280; /* gray-500 - cor mais suave */
    background-color: #f3f4f6; /* gray-100 - fundo mais suave */
    padding: 2px 6px;
    border-radius: 10px;
    flex-shrink: 0;
    min-width: 16px;
    text-align: center;
}

/* Tema escuro para os níveis */
.dark .node-level {
    color: #9ca3af; /* gray-400 - texto mais claro no escuro */
    background-color: #374151; /* gray-700 - fundo mais escuro */
}

.node-name {
    font-size: 11px;
    font-weight: 500;
    flex: 1;
    cursor: pointer;
    padding: 1px 2px;
    border-radius: 2px;
    transition: background-color 0.2s ease;
    color: #111827; /* gray-900 - cor padrão */
}

.dark .node-name {
    color: #f3f4f6; /* gray-100 - cor clara no tema escuro */
}

.node-name:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.dark .node-name:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.node-name-input {
    font-size: 11px;
    font-weight: 500;
    flex: 1;
    padding: 1px 2px;
    border: 1px solid #d1d5db; /* gray-300 */
    border-radius: 2px;
    background-color: #ffffff; /* white */
    color: #111827; /* gray-900 */
}

.dark .node-name-input {
    border-color: #4b5563; /* gray-600 */
    background-color: #1f2937; /* gray-800 */
    color: #f3f4f6; /* gray-100 */
}

.node-children-count {
    font-size: 10px;
    opacity: 0.6;
    margin-left: 4px;
    color: #6b7280; /* gray-500 */
}

.dark .node-children-count {
    color: #9ca3af; /* gray-400 */
}

.empty-state {
    text-align: center;
    padding: 16px 8px;
    color: #6b7280; /* gray-500 */
}

.dark .empty-state {
    color: #9ca3af; /* gray-400 */
}

.empty-state-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.empty-state-text {
    font-size: 10px;
}

/* ========================================
   SIDEBAR ADMINLTE
   ======================================== */

/* Sidebar Principal */
.sidebar-adminlte {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-right: 1px solid #374151;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-adminlte.dark {
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
    border-right: 1px solid #1e293b;
}

/* Header do Sidebar */
.sidebar-header {
    background: rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

/* Botões do Sidebar */
.sidebar-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-control-btn {
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    color: #d1d5db;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateY(-1px);
}

.sidebar-control-btn:active {
    transform: translateY(0);
}

.sidebar-control-btn i {
    font-size: 0.875rem;
}

/* Seção Estrutura */
.structure-section {
    background: rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Footer do Sidebar */
.sidebar-footer {
    background: rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

/* Lista de Nós no Sidebar */
.sidebar-node-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.sidebar-node-list::-webkit-scrollbar {
    width: 6px;
}

.sidebar-node-list::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-node-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar-node-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Nós no Sidebar */
.sidebar-node {
    margin: 2px 0;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

/* Emoji de bandeira para nós selecionados */
.sidebar-node-flag {
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

.sidebar-node.selected .sidebar-node-flag {
    opacity: 1;
    animation: flagWave 0.5s ease-out;
}

@keyframes flagWave {
    0% {
        transform: translateY(-50%) scale(0.5) rotate(-10deg);
        opacity: 0;
    }
    50% {
        transform: translateY(-50%) scale(1.2) rotate(5deg);
        opacity: 0.8;
    }
    100% {
        transform: translateY(-50%) scale(1) rotate(0deg);
        opacity: 1;
    }
}

.sidebar-node:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(2px);
}

.sidebar-node.selected {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.sidebar-node.selected:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    transform: translateX(2px);
}

/* Indicador de Nível */
.sidebar-node-level {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
    margin-right: 8px;
    transition: all 0.2s ease;
}

.sidebar-node.selected .sidebar-node-level {
    background: white;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

/* Nome do Nó */
.sidebar-node-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #e5e7eb;
    transition: color 0.2s ease;
}

.sidebar-node.selected .sidebar-node-name {
    color: white;
    font-weight: 600;
}

/* Input de Edição do Nome */
.sidebar-node-name-input {
    font-size: 0.875rem;
    font-weight: 500;
    color: #e5e7eb;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 4px 8px;
    outline: none;
    transition: all 0.2s ease;
}

.sidebar-node-name-input:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.sidebar-node.selected .sidebar-node-name-input {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Contador de Filhos */
.sidebar-node-children-count {
    font-size: 0.75rem;
    color: #9ca3af;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

.sidebar-node.selected .sidebar-node-children-count {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.2);
}

/* Estado Vazio */
.sidebar-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #6b7280;
}

.sidebar-empty-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.6;
}

.sidebar-empty-state p {
    font-size: 0.875rem;
    margin: 0;
}

/* Grid de Ícones Font Awesome */
.icon-category {
    margin-bottom: 1.5rem;
}

.icon-category-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-primary);
}

.icon-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
}

.icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border: 1px solid var(--border-primary);
    border-radius: 0.75rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.icon-button:hover {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.icon-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.icon-button i {
    font-size: 2rem;
    transition: transform 0.2s ease;
}

.icon-button:hover i {
    transform: scale(1.1);
}

/* Responsividade */
@media (max-width: 768px) {
    .icon-category-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .icon-button {
        width: 60px;
        height: 60px;
    }
    
    .icon-button i {
        font-size: 1.5rem;
    }
    
    .icon-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .icon-category-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .help-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 0.5rem;
        max-height: 95vh;
    }
    
    /* Sidebar responsivo */
    .sidebar-adminlte {
        width: 100%;
        height: auto;
        position: relative;
    }
}

/* ========================================
   EDITOR RICO SPA - ESTILOS
   ======================================== */

/* Estilos do Editor Rico SPA */
.toolbar-btn {
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    color: #374151;
}

.toolbar-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.toolbar-btn:active {
    background: #e5e7eb;
}

.toolbar-select {
    padding: 0.5rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    cursor: pointer;
    color: #374151;
}

.toolbar-color {
    width: 50px;
    height: 38px;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    cursor: pointer;
}

#spaNodeDescription h1 {
    font-size: 2em;
    font-weight: bold;
    margin: 0.67em 0;
}

#spaNodeDescription h2 {
    font-size: 1.5em;
    font-weight: bold;
    margin: 0.75em 0;
}

#spaNodeDescription h3 {
    font-size: 1.17em;
    font-weight: bold;
    margin: 0.83em 0;
}

#spaNodeDescription ul, #spaNodeDescription ol {
    margin-left: 2em;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

#spaNodeDescription a {
    color: #2563eb;
    text-decoration: underline;
}

