/* =============================================================================
   TIMOLOGISI ERP v3.32 - CRM Module Styles
   Kanban Board, Opportunities, Tasks, Analytics
   ============================================================================= */

/* ===================== Kanban Board ===================== */
.kanban-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 0;
    min-height: 500px;
    align-items: flex-start;
}

.kanban-column {
    min-width: 280px;
    max-width: 320px;
    flex: 1;
    background: #f7f8fa;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 220px);
    transition: box-shadow var(--t-transition-fast, 150ms ease);
}

.kanban-column-drop-active {
    box-shadow: 0 0 0 2px var(--t-primary, #00BCE4), 0 4px 12px rgba(0,188,228,0.15);
}

.kanban-column-header {
    padding: 12px 14px;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.kanban-column-title {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kanban-column-count {
    background: rgba(255,255,255,0.25);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.kanban-column-value {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    margin-top: 2px;
}

.kanban-column-body {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===================== Kanban Cards ===================== */
.kanban-card {
    background: #fff;
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    cursor: grab;
    transition: box-shadow var(--t-transition-fast, 150ms ease), transform var(--t-transition-fast, 150ms ease);
    border-left: 3px solid transparent;
}

.kanban-card:hover {
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card-dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* Priority border colors */
.kanban-card.priority-low { border-left-color: #a0aec0; }
.kanban-card.priority-normal { border-left-color: var(--t-primary, #00BCE4); }
.kanban-card.priority-high { border-left-color: #d97706; }
.kanban-card.priority-urgent { border-left-color: #dc2626; }

.kanban-card-title {
    font-weight: 600;
    font-size: 13px;
    color: #2d3748;
    margin-bottom: 6px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.kanban-card-trader {
    font-size: 12px;
    color: #718096;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #edf2f7;
}

.kanban-card-value {
    font-weight: 700;
    font-size: 14px;
    color: #2d3748;
}

.kanban-card-probability {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.kanban-card-probability.prob-low { background: #fed7e2; color: #c53030; }
.kanban-card-probability.prob-med { background: #fefcbf; color: #975a16; }
.kanban-card-probability.prob-high { background: #c6f6d5; color: #276749; }

.kanban-card-date {
    font-size: 11px;
    color: #a0aec0;
}

.kanban-card-date.overdue { color: #dc2626; font-weight: 600; }

.kanban-card-assignee {
    font-size: 11px;
    color: #718096;
    margin-top: 4px;
}

.kanban-empty {
    text-align: center;
    padding: 20px 10px;
    color: #a0aec0;
    font-size: 12px;
}

/* ===================== CRM Dashboard ===================== */
.crm-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 15px;
}

.crm-tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    color: #718096;
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color var(--t-transition-fast, 150ms ease), border-color var(--t-transition-fast, 150ms ease);
}

.crm-tab:hover {
    color: #4a5568;
}

.crm-tab.active {
    color: var(--t-secondary, #22B2A8);
    border-bottom-color: var(--t-secondary, #22B2A8);
    font-weight: 600;
}

/* ===================== CRM Analytics Cards ===================== */
.crm-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.crm-stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #edf2f7;
}

.crm-stat-card .stat-label {
    font-size: 12px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.crm-stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
}

.crm-stat-card .stat-sub {
    font-size: 12px;
    color: #a0aec0;
    margin-top: 2px;
}

.crm-stat-card.stat-won { border-top: 3px solid #27ae60; }
.crm-stat-card.stat-lost { border-top: 3px solid #e74c3c; }
.crm-stat-card.stat-pipeline { border-top: 3px solid var(--t-primary, #00BCE4); }
.crm-stat-card.stat-tasks { border-top: 3px solid #9b59b6; }

/* ===================== Pipeline Funnel ===================== */
.crm-funnel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.crm-funnel-stage {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #edf2f7;
}

.crm-funnel-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.crm-funnel-name {
    font-weight: 500;
    font-size: 13px;
    color: #2d3748;
    flex: 1;
}

.crm-funnel-count {
    font-size: 13px;
    color: #718096;
    min-width: 30px;
    text-align: center;
}

.crm-funnel-value {
    font-weight: 600;
    font-size: 13px;
    color: #2d3748;
    min-width: 100px;
    text-align: right;
}

.crm-funnel-bar {
    height: 6px;
    border-radius: 3px;
    flex: 1;
    max-width: 200px;
}

/* ===================== CRM Task List ===================== */
.crm-task-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #edf2f7;
}

.crm-task-row:hover {
    background: #f7fafc;
}

.crm-task-check {
    flex-shrink: 0;
}

.crm-task-title {
    flex: 1;
    font-size: 13px;
    color: #2d3748;
}

.crm-task-title.completed {
    text-decoration: line-through;
    color: #a0aec0;
}

.crm-task-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.crm-task-badge.type-call { background: #ebf8ff; color: #2b6cb0; }
.crm-task-badge.type-email { background: #faf5ff; color: #6b46c1; }
.crm-task-badge.type-meeting { background: #f0fff4; color: #276749; }
.crm-task-badge.type-followup { background: #fffaf0; color: #c05621; }
.crm-task-badge.type-other { background: #f7fafc; color: #718096; }

/* Priority badges */
.priority-badge { font-size: 11px; padding: 2px 6px; border-radius: 4px; font-weight: 500; }
.priority-badge.priority-0 { background: #edf2f7; color: #718096; }
.priority-badge.priority-1 { background: #ebf8ff; color: #2b6cb0; }
.priority-badge.priority-2 { background: #fffaf0; color: #c05621; }
.priority-badge.priority-3 { background: #fff5f5; color: #c53030; }

/* Status badges */
.status-badge { font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 500; }
.status-badge.status-open { background: #ebf8ff; color: #2b6cb0; }
.status-badge.status-won { background: #f0fff4; color: #276749; }
.status-badge.status-lost { background: #fff5f5; color: #c53030; }
.status-badge.status-hold { background: #faf5ff; color: #6b46c1; }

/* ===================== Top Deals ===================== */
.crm-top-deals {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #edf2f7;
}

.crm-top-deals-title {
    font-weight: 600;
    font-size: 14px;
    color: #2d3748;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #edf2f7;
}

.crm-deal-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f7fafc;
}

.crm-deal-row:last-child {
    border-bottom: none;
}

.crm-deal-title {
    flex: 1;
    font-size: 13px;
    color: #2d3748;
    font-weight: 500;
}

.crm-deal-trader {
    font-size: 12px;
    color: #718096;
    min-width: 120px;
}

.crm-deal-value {
    font-weight: 700;
    font-size: 14px;
    color: var(--t-secondary, #22B2A8);
    min-width: 100px;
    text-align: right;
}

/* ===================== Kanban Add Button ===================== */
.kanban-add-btn {
    width: 100%;
    padding: 8px;
    border: 2px dashed #cbd5e0;
    border-radius: 6px;
    background: transparent;
    color: #a0aec0;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--t-transition-fast, 150ms ease);
    margin-top: 4px;
}

.kanban-add-btn:hover {
    border-color: var(--t-primary, #00BCE4);
    color: var(--t-primary, #00BCE4);
    background: rgba(0,188,228,0.03);
}

/* ===================== Responsive ===================== */
@media (max-width: 768px) {
    .kanban-board {
        flex-direction: column;
    }

    .kanban-column {
        min-width: 100%;
        max-width: 100%;
        max-height: none;
    }

    .crm-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
