/* ========================================
   CRM v9.0 - Kanban Horizontal Premium
   Inspirado em: Pipedrive + Jetimob
   Foco: Simplicidade e Intuitividade
   ======================================== */

/* ========================================
   LAYOUT PRINCIPAL
   ======================================== */

.crm-container-v9 {
    padding: 24px;
    background: #F9FAFB;
    min-height: calc(100vh - 200px);
}

/* ========================================
   DASHBOARD DE ESTATÍSTICAS
   ======================================== */

#crm-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.kanban-stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.kanban-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.05;
    transition: opacity 0.3s ease;
}

.kanban-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.kanban-stat-card:hover::before {
    opacity: 0.1;
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.stat-blue { border-left: 4px solid #3B82F6; }
.stat-blue .stat-icon { background: linear-gradient(135deg, #3B82F6, #2563EB); }
.stat-blue::before { background: linear-gradient(135deg, #3B82F6, #2563EB); }

.stat-green { border-left: 4px solid #10B981; }
.stat-green .stat-icon { background: linear-gradient(135deg, #10B981, #059669); }
.stat-green::before { background: linear-gradient(135deg, #10B981, #059669); }

.stat-purple { border-left: 4px solid #8B5CF6; }
.stat-purple .stat-icon { background: linear-gradient(135deg, #8B5CF6, #7C3AED); }
.stat-purple::before { background: linear-gradient(135deg, #8B5CF6, #7C3AED); }

.stat-orange { border-left: 4px solid #F59E0B; }
.stat-orange .stat-icon { background: linear-gradient(135deg, #F59E0B, #D97706); }
.stat-orange::before { background: linear-gradient(135deg, #F59E0B, #D97706); }

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 32px;
    font-weight: 800;
    color: #1F2937;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    font-weight: 600;
    color: #6B7280;
}

/* ========================================
   KANBAN CONTAINER (SCROLL HORIZONTAL)
   ======================================== */

#crm-kanban-container {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 20px;
    min-height: 600px;
}

#crm-kanban-container::-webkit-scrollbar {
    height: 10px;
}

#crm-kanban-container::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 10px;
}

#crm-kanban-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    border-radius: 10px;
}

#crm-kanban-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
}

/* ========================================
   COLUNAS DO KANBAN
   ======================================== */

.kanban-column {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    max-height: 800px;
}

.kanban-column-header {
    padding: 20px;
    color: white;
    position: relative;
    overflow: hidden;
}

.kanban-column-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.column-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.column-icone {
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.column-nome {
    font-size: 16px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.column-header-stats {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.column-stat-valor {
    font-size: 22px;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.column-stat-quantidade {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.9;
}

/* ========================================
   CORPO DA COLUNA (ÁREA DE DROP)
   ======================================== */

.kanban-column-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #F9FAFB;
    transition: background 0.3s ease;
}

.kanban-column-body::-webkit-scrollbar {
    width: 6px;
}

.kanban-column-body::-webkit-scrollbar-track {
    background: transparent;
}

.kanban-column-body::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 10px;
}

.kanban-column-body::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

.kanban-column-body.drag-over {
    background: #DBEAFE;
    border: 2px dashed #3B82F6;
    border-radius: 8px;
}

/* ========================================
   ESTADO VAZIO
   ======================================== */

.kanban-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #9CA3AF;
}

.kanban-empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.kanban-empty-state p {
    font-size: 14px;
    font-weight: 600;
}

/* ========================================
   CARDS DO KANBAN (MINIMALISTAS)
   ======================================== */

.kanban-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    cursor: grab;
    transition: all 0.2s ease;
    position: relative;
    border-left: 3px solid transparent;
}

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

.kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: rotate(3deg);
}

.kanban-card:active {
    cursor: grabbing;
}

/* Header do Card */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.card-temp-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Nome do Contato */
.card-nome {
    font-size: 15px;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Interesse/Imóvel */
.card-interesse {
    font-size: 13px;
    color: #6B7280;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-interesse i {
    color: #9CA3AF;
    font-size: 12px;
}

/* Valor */
.card-valor {
    font-size: 18px;
    font-weight: 800;
    color: #059669;
    margin-bottom: 12px;
}

/* Dados Específicos */
.card-dados-especificos {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6B7280;
    background: #F3F4F6;
    padding: 6px 10px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.card-dados-especificos i {
    color: #9CA3AF;
}

.card-dados-especificos.sucesso {
    background: #D1FAE5;
    color: #059669;
}

.card-dados-especificos.sucesso i {
    color: #10B981;
}

/* Footer do Card */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #F3F4F6;
}

.card-contatos {
    display: flex;
    gap: 8px;
}

.card-action-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F3F4F6;
    color: #6B7280;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 14px;
}

.card-action-icon:hover {
    background: #3B82F6;
    color: white;
    transform: scale(1.1);
}

.card-btn-detalhes {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3B82F6;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-btn-detalhes:hover {
    background: #2563EB;
    transform: scale(1.1);
}

/* Drag Handle */
.card-drag-handle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    color: #D1D5DB;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.kanban-card:hover .card-drag-handle {
    opacity: 1;
}

/* ========================================
   FOOTER DA COLUNA
   ======================================== */

.kanban-column-footer {
    padding: 16px;
    border-top: 1px solid #F3F4F6;
}

.btn-add-contato {
    width: 100%;
    padding: 10px;
    border: 2px dashed #D1D5DB;
    background: transparent;
    color: #6B7280;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-add-contato:hover {
    border-color: #3B82F6;
    color: #3B82F6;
    background: #EFF6FF;
}

/* ========================================
   NOTIFICAÇÕES
   ======================================== */

.kanban-notification {
    position: fixed;
    top: 100px;
    right: 24px;
    background: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.kanban-notification.show {
    transform: translateX(0);
}

.kanban-notification.success {
    border-left: 4px solid #10B981;
}

.kanban-notification.success i {
    color: #10B981;
    font-size: 20px;
}

/* ========================================
   RESPONSIVIDADE
   ======================================== */

@media (max-width: 1200px) {
    .kanban-column {
        flex: 0 0 300px;
    }
}

@media (max-width: 768px) {
    .crm-container-v9 {
        padding: 16px;
    }

    #crm-dashboard-stats {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }

    .kanban-stat-card {
        padding: 16px;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .stat-number {
        font-size: 24px;
    }

    #crm-kanban-container {
        flex-direction: column;
        overflow-x: visible;
    }

    .kanban-column {
        flex: 1 1 auto;
        max-height: 500px;
    }
}

/* ========================================
   ANIMAÇÕES
   ======================================== */

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.kanban-column {
    animation: slideInUp 0.4s ease-out backwards;
}

.kanban-column:nth-child(1) { animation-delay: 0.05s; }
.kanban-column:nth-child(2) { animation-delay: 0.1s; }
.kanban-column:nth-child(3) { animation-delay: 0.15s; }
.kanban-column:nth-child(4) { animation-delay: 0.2s; }
.kanban-column:nth-child(5) { animation-delay: 0.25s; }
.kanban-column:nth-child(6) { animation-delay: 0.3s; }
.kanban-column:nth-child(7) { animation-delay: 0.35s; }

.kanban-card {
    animation: fadeIn 0.3s ease-out backwards;
}

.kanban-stat-card {
    animation: slideInUp 0.5s ease-out backwards;
}

.kanban-stat-card:nth-child(1) { animation-delay: 0.1s; }
.kanban-stat-card:nth-child(2) { animation-delay: 0.15s; }
.kanban-stat-card:nth-child(3) { animation-delay: 0.2s; }
.kanban-stat-card:nth-child(4) { animation-delay: 0.25s; }

/* ========================================
   UTILIDADES
   ======================================== */

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
