/* ═══════════════════════════════════════════════════════════════════════════════ */
/* CRM SUPREMO v5.0s - Estilos Personalizados                                     */
/* Tailwind via CDN - este arquivo contém apenas customizações                    */
/* ═══════════════════════════════════════════════════════════════════════════════ */

/* CONFIGURAÇÕES GLOBAIS */
body {
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.word-break-line {
    word-break: break-all;
    overflow-wrap: anywhere;
}

/* Ghost element - clone do card que segue o dedo no mobile durante drag */
.touch-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.88;
    transform: scale(1.04) rotate(2deg);
    box-shadow: 0 20px 48px rgba(0,0,0,0.35);
    border-radius: 12px;
    transition: none;
    will-change: left, top;
    background: white;
}

/* Card original enquanto ghost está ativo */
.touch-dragging-source {
    opacity: 0.25;
    pointer-events: none;
}

/* Durante drag ativo: impede seleção de texto na página */
body.touch-drag-active {
    user-select: none;
    -webkit-user-select: none;
}

.kanban-card.dragging {
    touch-action: none;
}

.touch-drop-target {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border: 2px dashed #3b82f6;
}

/* SCROLLBARS */
.kanban-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

.kanban-container::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 10px;
}

.kanban-container::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

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

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

.kanban-cards::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.kanban-cards::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

#kanbanContainer {
    scrollbar-width: thin;
}

/* DRAG & DROP */
.is-dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.ddt-dragging {
    opacity: 0.5;
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal {
    display: none;
}

.over {
    border: 2px dashed #3b82f6;
}

.kanban-cards.bg-blue-50 {
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%) !important;
    border: 2px dashed #3B82F6;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
}

.modal.flex {
    display: flex;
}

/* ANIMAÇÕES */
.spinner {
    animation: spin 1s linear infinite;
}

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

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

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

/* Toast - notificações personalizadas */
.animate-toast-in {
    animation: toastIn 0.3s ease-out;
}

.animate-toast-out {
    animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* SEÇÕES */
.section-hidden {
    display: none;
}

.section-visible {
    display: block;
}

/* CARDS DE MÉTRICAS */
.metric-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.metric-card-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.metric-card-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.metric-card-warning { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.metric-card-danger { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.metric-card-info { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); }
.metric-card-purple { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }

/* GRÁFICOS */
.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
}

/* KANBAN */
.kanban-cards {
    min-height: 400px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
}

/* DOSSIÊ */
.dossie-section {
    background-color: #f8fafc;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

/* CARDS MODERNOS */
.modern-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

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

/* BOTÕES */
.modern-btn {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.modern-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.modern-btn:hover::before {
    left: 100%;
}

/* BOTÕES DE PERÍODO */
.periodo-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.periodo-btn.active {
    transform: translateY(-2px);
}

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

.periodo-btn:hover {
    transform: translateY(-2px);
}

.periodo-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.periodo-btn:active::after {
    width: 300px;
    height: 300px;
}

/* MODAL LEAD - Desktop: compacto, sem scroll */
.lead-modal-card {
    max-height: min(480px, 88vh);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.lead-modal-header {
    padding: 10px 16px;
    flex-shrink: 0;
}

.lead-modal-form {
    padding: 12px 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.lead-modal-grid {
    gap: 10px;
}

.lead-modal-input {
    min-height: 32px;
}

/* RESPONSIVIDADE MODAL MOBILE */
@media (max-width: 768px) {
    .lead-modal-card {
        max-height: 95vh;
        overflow-y: auto;
    }

    .lead-modal-actions {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .lead-modal-actions > div:last-child {
        display: flex;
        flex-direction: column-reverse;
        width: 100%;
        gap: 12px;
    }

    .lead-modal-actions button,
    .lead-modal-actions .modern-btn {
        width: 100% !important;
        padding: 14px 20px;
        font-size: 15px;
        justify-content: center;
    }

    #deleteLeadBtn {
        width: 100% !important;
        justify-content: center;
    }

    #leadModal .lead-modal-card {
        max-width: 100%;
        margin: 8px;
        border-radius: 16px;
    }

    #leadModal .lead-modal-form {
        padding: 20px 16px;
    }

    #leadModal .lead-modal-grid {
        grid-template-columns: 1fr;
    }

    #leadModal .lead-modal-input {
        font-size: 16px; /* evita zoom no iOS */
        min-height: 44px;
        padding: 10px 12px;
    }
}

/* INDICADORES DE STATUS */
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-novo-lead { background-color: #3b82f6; }
.status-contato-feito { background-color: #10b981; }
.status-reunião-agendada { background-color: #f59e0b; }
.status-reunião-realizada { background-color: #8b5cf6; }
.status-agulha { background-color: #ef4444; }
.status-ganhou { background-color: #22c55e; }
.status-geladeira { background-color: #6b7280; }
.status-perdeu { background-color: #dc2626; }

/* TEMPERATURA */
.temp-quente { color: #dc2626; }
.temp-morno { color: #f59e0b; }
.temp-frio { color: #3b82f6; }

/* EFEITOS ESPECIAIS */
.glass {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.micro-interaction {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* KANBAN 3D */
.kanban-column {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.kanban-column:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15), 0 6px 12px rgba(0, 0, 0, 0.1);
}

.kanban-card {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

/* HEADER - consistência entre máquinas/navegadores */
.modern-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 100%;
    min-height: 73px;
    flex-shrink: 0;
}

.header-logo {
    height: 90px;
}

/* Header mobile - layout compacto sem sobreposição */
@media (max-width: 768px) {
    .header-crm {
        min-height: auto;
        padding: 8px 12px;
    }

    .header-inner {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .header-brand {
        flex: 1;
        min-width: 0;
    }

    .header-logo {
        height: 40px;
    }

    .header-actions {
        flex: 1 1 100%;
        justify-content: flex-start;
        gap: 6px;
        order: 2;
    }

    .header-session {
        display: none; /* evita sobreposição no mobile */
    }

    /* Filtros centralizados no mobile */
    .filters-grid {
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
        justify-items: stretch;
    }
}

.advanced-metric {
    position: relative;
    overflow: hidden;
}

.advanced-metric::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    pointer-events: none;
}

.chart-modern {
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* BOTÕES IA */
.ia-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.875rem;
    color: white;
    font-weight: 600;
    border-radius: 0.75rem;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
}

.ia-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
}

/* PULSE */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.5); }
}

.lead-name {
    word-break: break-word;
    white-space: normal;
    hyphens: auto;
    display: inline-block;
    max-width: 100%;
}
