/* Animações para Atualizações Incrementais do Kanban */

/* Animação para cards atualizados */
.kanban-task.card-updated {
    animation: cardPulse 1s ease-in-out;
    border-left: 3px solid #28a745;
}

@keyframes cardPulse {
    0% { 
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    50% { 
        transform: scale(1.02);
        box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
}

/* Animação para cards novos */
.kanban-task.card-added {
    animation: cardSlideIn 0.5s ease-out;
    border-left: 3px solid #007bff;
}

@keyframes cardSlideIn {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Animação para cards removidos */
.kanban-task.card-removed {
    animation: cardSlideOut 0.5s ease-in;
    border-left: 3px solid #dc3545;
}

@keyframes cardSlideOut {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(20px);
        opacity: 0;
    }
}

/* Animação para cards movidos */
.kanban-task.card-moving {
    animation: cardMove 0.5s ease-in-out;
    border-left: 3px solid #ffc107;
    z-index: 1000;
}

@keyframes cardMove {
    0% {
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 8px 16px rgba(255, 193, 7, 0.4);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
}

/* Indicador de carregamento para cache - CENTRALIZADO NO RODAPÉ */
.kanban-cache-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 9999;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 500;
    text-align: center;
    min-width: 200px;
    transition: all 0.3s ease;
}

.kanban-cache-indicator.cache {
    background: rgba(74, 144, 226, 0.9);
    border-color: rgba(74, 144, 226, 0.3);
}

.kanban-cache-indicator.loading {
    background: rgba(0, 123, 255, 0.9);
    border-color: rgba(0, 123, 255, 0.3);
}

.kanban-cache-indicator.success {
    background: rgba(40, 167, 69, 0.9);
    border-color: rgba(40, 167, 69, 0.3);
}

.kanban-cache-indicator.error {
    background: rgba(220, 53, 69, 0.9);
    border-color: rgba(220, 53, 69, 0.3);
}

.kanban-cache-indicator.show {
    display: block;
    animation: slideUpIn 0.3s ease-out;
}

.kanban-cache-indicator.hide {
    animation: slideUpOut 0.3s ease-in;
}

@keyframes slideUpIn {
    0% {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes slideUpOut {
    0% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
}

/* Spinner para indicar carregamento incremental */
.kanban-incremental-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Estilo para cards com status especiais */
.kanban-task.overdue {
    border-left-color: #dc3545 !important;
    background: linear-gradient(135deg, #fff 0%, #ffe6e6 100%);
}

.kanban-task.near-deadline {
    border-left-color: #ffc107 !important;
    background: linear-gradient(135deg, #fff 0%, #fff8e1 100%);
}

/* Badges para comentários e anexos */
.kanban-task .badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    background: #6c757d;
    color: white;
    border-radius: 10px;
    margin-right: 5px;
}

.kanban-task .comments-badge {
    background: #17a2b8;
}

.kanban-task .attachments-badge {
    background: #28a745;
}

/* Transições suaves para todos os cards */
.kanban-task {
    transition: all 0.3s ease;
}

.kanban-task:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Indicador de sincronização */
.kanban-sync-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #28a745;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kanban-sync-indicator.syncing {
    background: #ffc107;
    opacity: 1;
    animation: syncPulse 1s infinite;
}

@keyframes syncPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Responsive - ajustes para mobile */
@media (max-width: 768px) {
    .kanban-cache-indicator {
        top: 10px;
        right: 10px;
        font-size: 11px;
        padding: 6px 10px;
    }
    
    @keyframes cardPulse {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.01); }
    }
}

/* Estado de loading para colunas */
.kanban-column.updating {
    position: relative;
    overflow: hidden;
}

.kanban-column.updating::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.5),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Epic Badge no Kanban Card */
.epic-badge-container {
    margin: 0 8px;
}

.epic-badge-container .badge {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.7rem;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.epic-badge-container .badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    max-width: none;
    white-space: normal;
    z-index: 10;
    position: relative;
}

.epic-badge-container .badge i {
    font-size: 0.6rem;
}

/* Responsivo para epic badge */
@media (max-width: 768px) {
    .epic-badge-container .badge {
        max-width: 80px;
        font-size: 0.65rem;
    }
}

/* Card do Kanban: cabeçalho (tipo + ID | avatar), título, épico, projeto, métricas */
.task-card .task-id-title,
.task-card .task-header-end {
    flex-shrink: 0;
}

.task-card .responsible-image {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
}

.task-card .responsible-image img,
.task-card .responsible-image .avatar-placeholder {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: var(--gous-font-size-body);
    object-fit: cover;
}

.task-card .avatar-unassigned {
    background: transparent;
    border: 1px dashed #adb5bd;
    color: #6c757d;
}

.task-card .task-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: var(--gous-font-size-body);
    font-weight: 600;
    line-height: 1.35;
}

/* Épico: texto discreto abaixo do projeto */
.task-card .task-epic {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.task-card .task-epic i {
    flex: 0 0 auto;
    font-size: 0.6rem;
}

.task-card .task-epic .epic-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Projeto em uma linha */
.task-card .task-project-line {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.task-card .task-project-line .project-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Métricas separadas do conteúdo */
.task-card .task-metrics {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* Estado de prazo: borda lateral (os ícones já são renderizados pelo template) */
.task-card:has(.task-metrics .bi-exclamation-circle-fill.text-danger) {
    border-left: 3px solid #dc3545;
}

.task-card:has(.task-metrics .bi-alarm-fill.text-warning) {
    border-left: 3px solid #ffc107;
}
