/* ========================================
   EVOLUIRMD - ESTILOS CUSTOMIZADOS
   ======================================== */

/* Configurações globais do corpo da página */
body {
    font-family: 'Inter', sans-serif;
    background-color: #1A1A1A;
    color: #E5E7EB; /* cinza claro */
}

/* ========================================
   ESTILOS PARA A NOVA SIDEBAR REDESENHADA
   ======================================== */

/* Dropdown para Novo Documento */
#new-document-dropdown {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

#new-document-dropdown a {
    border-radius: 0;
}

#new-document-dropdown a:first-child {
    border-radius: 0.5rem 0.5rem 0 0;
}

#new-document-dropdown a:last-child {
    border-radius: 0 0 0.5rem 0.5rem;
}

#quick-templates-list .template-quick-item {
    display: block;
    padding: 6px 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #9CA3AF;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

#quick-templates-list .template-quick-item:hover {
    background-color: rgba(55, 65, 81, 0.5);
    color: #E5E7EB;
}

/* Header melhorado */
.mode-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.mode-indicator-dot.dashboard { background-color: #10B981; }
.mode-indicator-dot.template { background-color: #3B82F6; }
.mode-indicator-dot.blank-editor { background-color: #8B5CF6; }
.mode-indicator-dot.snippets { background-color: #F59E0B; }



#header-search:focus + svg {
    color: #3B82F6;
}

/* Remove outline padrão do editor */
#editor-content:focus {
    outline: none;
}

/* Remove any default borders from contenteditable elements */
#editor-content {
    border: none !important;
    outline: none !important;
}

/* ========================================
   TEMPLATE PLACEHOLDER STYLING
   ======================================== */

/* Estilo para o placeholder no editor */
.placeholder {
    background-color: rgba(59, 130, 246, 0.2);
    color: #93C5FD;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: text;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

.placeholder-filled {
    background-color: transparent;
    color: inherit;
    padding: 2px 0;
}

.placeholder.active {
    background-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
    outline: none;
    color: #93C5FD;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
    }
    50% {
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.8);
    }
}

.placeholder.initial-focus {
    animation: pulse 2s infinite;
}

/* ========================================
   ESTILOS PARA CATEGORIAS DE TEMPLATES
   ======================================== */

/* Estilo para categoria do template card */
.template-card-category {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
}

/* Hover effect para categoria */
.template-card-category:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}


/* ========================================
   ESTILOS PARA SCROLLBARS
   ======================================== */

/* Customização da scrollbar principal */
#main-content-area::-webkit-scrollbar {
    width: 8px;
}

#main-content-area::-webkit-scrollbar-track {
    background: #1A1A1A;
}

#main-content-area::-webkit-scrollbar-thumb {
    background-color: #374151;
    border-radius: 20px;
    border: 3px solid #1A1A1A;
}

/* ========================================
   ESTILOS PARA TOOLTIP DE SNIPPETS
   ======================================== */

/* Largura mínima do tooltip */
#snippet-tooltip {
    min-width: 250px;
}

/* Estilo para itens do tooltip */
.snippet-item {
    display: block;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* Estados hover e ativo para itens do tooltip */
.snippet-item:hover,
.snippet-item.active {
    background-color: #3B82F6;
}

/* Estilo para a chave do snippet */
.snippet-key {
    font-weight: 600;
    color: #E5E7EB;
}

/* Estilo para a descrição do snippet */
.snippet-desc {
    font-size: 0.8rem;
    color: #9CA3AF;
}

/* Mudança de cor da descrição no hover/ativo */
.snippet-item:hover .snippet-desc,
.snippet-item.active .snippet-desc {
    color: #E5E7EB;
}

/* ========================================
   ESTILOS PARA MODAIS
   ======================================== */

/* Overlay dos modais */
.modal-overlay {
    background-color: rgba(0, 0, 0, 0.7);
}

/* ========================================
   ESTILOS PARA DASHBOARD E TEMPLATE CARDS
   ======================================== */

/* Template Card - Redesign Intuitivo */
.template-card {
    background: linear-gradient(145deg, #2A2A2A 0%, #242424 100%);
    border: 1px solid #3A3A3A;
    border-radius: 16px;
    padding: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 240px;
    backdrop-filter: blur(10px);
}

.template-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--category-color, #3B82F6);
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.template-card:hover {
    border-color: var(--category-color, #3B82F6);
    transform: translateY(-4px);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 0 0 1px var(--category-color, #3B82F6);
}

.template-card:hover::before {
    opacity: 1;
}

.template-card:hover .template-card-title {
    color: #FFFFFF;
}

/* Template Card Header - Melhorado */
.template-card-header {
    padding: 20px 20px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.template-card-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.template-card-title-section {
    flex: 1;
    min-width: 0;
}

.template-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #E5E7EB;
    margin: 0 0 8px 0;
    line-height: 1.3;
    transition: color 0.3s ease;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
}

.template-card-subtitle {
    font-size: 0.8rem;
    color: #9CA3AF;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Category Badge - Redesign Completo */
.template-card-category-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.template-card-category {
    background: var(--category-color, #3B82F6);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 140px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.template-card-category:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.template-card-category-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.template-card-category-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Template Card Content */
.template-card-content {
    padding: 0 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.template-card-preview {
    font-size: 0.9rem;
    color: #9CA3AF;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-clamp: 3;
    overflow: hidden;
    margin: 0;
    text-align: left;
}

/* Template Card Footer - Redesign */
.template-card-footer {
    padding: 16px 20px 20px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: auto;
}

.template-card-meta {
    display: none;
}

.template-card-actions {
    display: flex;
    gap: 8px;
    opacity: 1;
    transition: all 0.3s ease;
    transform: translateX(0);
}

.template-card-action {
    background: var(--category-color, #3B82F6);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.template-card-action:hover {
    background: var(--category-color-dark, #2563EB);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.template-card-action.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #D1D5DB;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.template-card-action.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
    border-color: rgba(255, 255, 255, 0.3);
}

.template-card-action.favorite {
    background: var(--category-color, #3B82F6);
    color: white;
    border: none;
    min-width: auto;
    padding: 8px 12px;
}

.template-card-action.favorite:hover {
    background: var(--category-color-dark, #2563EB);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.template-card-action.favorite.favorited {
    background: #FBBF24;
    color: white;
}

.template-card-action.favorite.favorited:hover {
    background: #F59E0B;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Loading state para cards */
.template-card.loading {
    pointer-events: none;
    opacity: 0.7;
}

.template-card.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Efeito de foco para acessibilidade */
.template-card:focus-visible {
    outline: 2px solid var(--category-color, #3B82F6);
    outline-offset: 2px;
}

.template-card-action:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Search Results */
.search-active .recent-templates-section {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .template-card {
        min-height: 200px;
    }

    .template-card-header {
        padding: 16px 16px 12px 16px;
    }

    .template-card-content {
        padding: 0 16px;
    }

    .template-card-footer {
        padding: 12px 16px 16px 16px;
    }

    .template-card-title {
        font-size: 1.1rem;
    }

    .template-card-actions {
        opacity: 1;
        transform: translateX(0);
    }

    .template-card-action {
        font-size: 0.7rem;
        padding: 6px 10px;
    }

    .template-card-category {
        max-width: 100px;
        font-size: 0.65rem;
        padding: 4px 10px;
    }
}

@media (max-width: 480px) {
    .template-card {
        min-height: 180px;
    }

    .template-card-top-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .template-card-category {
        max-width: 80px;
    }

    .template-card-actions {
        gap: 6px;
    }

    .template-card-action {
        font-size: 0.65rem;
        padding: 5px 8px;
    }
}

/* Dashboard Search Bar Animations */
#template-search:focus + svg {
    color: #3B82F6;
}
