/* ============================================================
   KANBAN BOARD COMPONENT
   Horizontal scrolling columns (stages), draggable card items,
   stage headers with deal counts, and drag-ghost styling.
   ============================================================ */

.kanban-board {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.75rem;
    min-height: 500px;
    align-items: flex-start;
}

/* Individual column / stage */
.kanban-column {
    min-width: 260px;
    max-width: 300px;
    flex: 0 0 260px;
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
}

/* Stage header */
.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius) var(--radius) 0 0;
    position: sticky;
    top: 0;
}

.kanban-column-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-800);
    text-transform: uppercase;
}

.kanban-column-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    font-size: 0.6875rem;
    font-weight: 700;
    background: var(--gray-200);
    color: var(--gray-600);
    border-radius: 999px;
}

/* Stage total (monetary value) */
.kanban-column-total {
    font-size: 0.6875rem;
    color: var(--text-muted);
    padding: 0.375rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

/* Card list */
.kanban-card-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.375rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

/* Individual card */
.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.625rem;
    cursor: grab;
    transition: box-shadow 0.15s, transform 0.15s;
    position: relative;
    box-shadow: var(--shadow-xs);
}

.kanban-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

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

.kanban-card-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.kanban-card-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

.kanban-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.kanban-card-value {
    font-weight: 700;
    color: var(--gray-700);
}

.kanban-card-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Priority indicator */
.kanban-card-priority {
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    border-radius: var(--radius) 0 0 var(--radius);
}

.kanban-card-priority--high    { background: var(--danger); }
.kanban-card-priority--medium  { background: var(--warning); }
.kanban-card-priority--low     { background: var(--success); }

/* ----- Drag Ghost ----- */
.kanban-card--dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    box-shadow: var(--shadow-md);
}

/* Drop zone highlight */
.kanban-card-list--drag-over {
    background: var(--primary-light);
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
}

/* Empty column */
.kanban-column-empty {
    padding: 1.5rem 0.75rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Add card button */
.kanban-add-btn {
    width: 100%;
    padding: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: transparent;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    margin-top: 0.25rem;
}

.kanban-add-btn:hover {
    background: var(--bg-card);
    color: var(--primary);
    border-color: var(--primary);
}

/* ============================================================
   KANBAN COLUMN BODY (Pipeline variant)
   Used by deals/pipeline.js with .kanban-column-body instead
   of .kanban-card-list. Same layout semantics.
   ============================================================ */
.kanban-column-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.375rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.kanban-column-body--drag-over {
    background: var(--primary-light);
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
}

/* ----- Extra card fields used by pipeline ----- */
.kanban-column-value {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.kanban-card-customer {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kanban-card-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.375rem;
    margin-top: 0.2rem;
}

.kanban-card-probability {
    font-size: 0.65rem;
}

.kanban-card-date {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.kanban-empty {
    padding: 1.25rem 0.75rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ============================================================
   PIPELINE SUMMARY BAR
   Inline stats above the kanban board.
   ============================================================ */
.pipeline-summary {
    margin-bottom: 0.75rem;
}

.pipeline-summary-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: center;
}

.pipeline-summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.pipeline-summary-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.pipeline-summary-value {
    font-size: var(--font-size-md, 0.8125rem);
    font-weight: 700;
    color: var(--text);
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
    .kanban-board {
        /* Smooth touch scrolling */
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        padding-bottom: 1rem;
    }

    .kanban-column {
        min-width: 260px;
        flex: 0 0 80vw;
        max-width: 85vw;
        scroll-snap-align: start;
    }
}

@media (max-width: 480px) {
    .kanban-column {
        flex: 0 0 85vw;
    }

    .pipeline-summary-bar {
        gap: 0.75rem;
    }

    .pipeline-summary-label {
        font-size: 0.6rem;
    }

    .pipeline-summary-value {
        font-size: 0.75rem;
    }
}
