/* ═══════════════════════════════════════════════════════
   PHASE 22 — VENDOR CRM (Prestataires)
═══════════════════════════════════════════════════════ */

:root {
    --vd-prospect: #6b7280;
    --vd-contacted: #b8956a;
    --vd-booked: #8fa887;
    --vd-signed: #c4918a;
    --vd-paid: #4a7c59;
}

/* Stats row: reuses .guests-dashboard + .guests-counter from guest tab */

/* ── Filters ── */
.vd-filters {
    margin-bottom: 20px;
}

/* ── View toggle ── */
.vd-view-btn {
    gap: 6px;
}
.vd-view-btn.active {
    background: var(--terra);
    color: #fff;
    border-color: var(--terra);
}

/* ── Kanban board ── */
.vd-kanban-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    height: calc(100vh - 400px);
    min-height: 380px;
    align-items: stretch;
}
.vd-kanban-col {
    background: var(--cream);
    border: 1px solid rgba(44, 32, 22, 0.07);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: background 0.15s;
}
.vd-col-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid rgba(44, 32, 22, 0.07);
}
.vd-col-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.vd-col-count {
    margin-left: auto;
    background: rgba(44, 32, 22, 0.08);
    color: var(--txt-m);
    font-size: 0.64rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}
.vd-col-prospect {
    color: var(--vd-prospect);
}
.vd-col-prospect .vd-col-dot {
    background: var(--vd-prospect);
}
.vd-col-contacted {
    color: var(--vd-contacted);
}
.vd-col-contacted .vd-col-dot {
    background: var(--vd-contacted);
}
.vd-col-booked {
    color: var(--vd-booked);
}
.vd-col-booked .vd-col-dot {
    background: var(--vd-booked);
}
.vd-col-signed {
    color: var(--vd-signed);
}
.vd-col-signed .vd-col-dot {
    background: var(--vd-signed);
}
.vd-col-paid {
    color: var(--vd-paid);
}
.vd-col-paid .vd-col-dot {
    background: var(--vd-paid);
}

.vd-col-cards {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    min-height: 80px;
    scrollbar-width: thin;
    scrollbar-color: var(--cream-dd) transparent;
}
.vd-col-cards::-webkit-scrollbar {
    width: 4px;
}
.vd-col-cards::-webkit-scrollbar-thumb {
    background: var(--cream-dd);
    border-radius: 2px;
}
.vd-col-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: none;
    border: none;
    border-top: 1px solid rgba(44, 32, 22, 0.07);
    color: var(--txt-l);
    font-size: 12px;
    cursor: pointer;
    transition:
        background 0.15s,
        color 0.15s;
    width: 100%;
}
.vd-col-add:hover {
    background: rgba(44, 32, 22, 0.04);
    color: var(--txt);
}

/* ── Vendor card ── */
.vd-card {
    background: #fff;
    border: 1px solid rgba(44, 32, 22, 0.09);
    border-left: 3px solid transparent;
    border-radius: calc(var(--radius) - 2px);
    padding: 12px 14px;
    cursor: pointer;
    transition:
        transform 0.15s,
        box-shadow 0.15s,
        border-left-color 0.15s;
}
.vd-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}
.vd-card[data-status="prospect"]:hover {
    border-left-color: var(--vd-prospect);
}
.vd-card[data-status="contacted"]:hover {
    border-left-color: var(--vd-contacted);
}
.vd-card[data-status="booked"]:hover {
    border-left-color: var(--vd-booked);
}
.vd-card[data-status="signed"]:hover {
    border-left-color: var(--vd-signed);
}
.vd-card[data-status="paid"]:hover {
    border-left-color: var(--vd-paid);
}

.vd-card-name {
    font-size: 0.79rem;
    font-weight: 500;
    color: var(--txt);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vd-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.vd-cat-pill {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 20px;
    background: rgba(44, 32, 22, 0.06);
    color: var(--txt-m);
    text-transform: capitalize;
}
.vd-card-price {
    font-size: 11px;
    color: var(--terra);
    font-weight: 600;
    margin-left: auto;
}
.vd-card-contact {
    font-size: 11px;
    color: var(--txt-l);
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── List view ── */
.vd-list-view {
    background: #fff;
    border: 1px solid rgba(44, 32, 22, 0.09);
    border-radius: var(--radius);
    overflow: hidden;
}
.vd-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}
.vd-status-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.vd-status-pill.prospect {
    color: var(--vd-prospect);
    background: rgba(107, 114, 128, 0.12);
}
.vd-status-pill.contacted {
    color: var(--vd-contacted);
    background: rgba(184, 149, 106, 0.12);
}
.vd-status-pill.booked {
    color: var(--vd-booked);
    background: rgba(143, 168, 135, 0.12);
}
.vd-status-pill.signed {
    color: var(--vd-signed);
    background: rgba(196, 145, 138, 0.12);
}
.vd-status-pill.paid {
    color: var(--vd-paid);
    background: rgba(74, 124, 89, 0.12);
}

/* ── Slide-over detail panel ── */
.vd-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 60;
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.vd-detail-overlay.open {
    opacity: 1;
    pointer-events: all;
}
.vd-detail-panel {
    width: 420px;
    max-width: 95vw;
    height: 100%;
    background: #fff;
    border-left: 1px solid var(--cream-dd);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    box-sizing: border-box;
    word-break: break-word;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
}
.vd-detail-overlay.open .vd-detail-panel {
    transform: translateX(0);
}
/* All children stay within panel width */
.vd-detail-panel * {
    max-width: 100%;
    box-sizing: border-box;
}
.vd-detail-panel img {
    max-width: 100%;
}
.vd-detail-panel pre,
.vd-detail-panel code {
    white-space: pre-wrap;
    word-break: break-word;
}

.vd-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}
.vd-detail-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
    flex: 1;
}
.vd-detail-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.vd-detail-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--txt-l);
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s;
}
.vd-detail-close:hover {
    background: var(--cream);
    color: var(--txt);
}
.vd-detail-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--txt);
    margin: 0 0 20px;
    line-height: 1.2;
    word-break: break-word;
    overflow-wrap: break-word;
}
.vd-detail-cat-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(44, 32, 22, 0.06);
    color: var(--txt-m);
    text-transform: capitalize;
    border: 1px solid var(--cream-dd);
}
.vd-detail-section {
    border-top: 1px solid var(--cream-d);
    padding: 16px 0;
}
.vd-detail-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--txt-l);
    font-weight: 600;
    margin-bottom: 10px;
}
.vd-contact-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.vd-contact-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--txt);
    min-width: 0;
    overflow: hidden;
}
.vd-contact-row span,
.vd-contact-row a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.vd-contact-row svg {
    flex-shrink: 0;
    color: var(--txt-l);
}
.vd-contact-row a {
    color: var(--terra);
    text-decoration: none;
}
.vd-contact-row a:hover {
    text-decoration: underline;
}
.vd-budget-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--terra);
    margin-bottom: 4px;
}
.vd-budget-link-info {
    font-size: 12px;
    color: var(--txt-l);
    display: flex;
    align-items: center;
    gap: 5px;
}
.vd-contract-upload-zone {
    border: 1.5px dashed var(--cream-dd);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--txt-l);
    font-size: 13px;
    cursor: pointer;
    transition:
        border-color 0.2s,
        background 0.2s;
}
.vd-contract-upload-zone:hover {
    border-color: var(--terra);
    background: rgba(196, 145, 138, 0.04);
    color: var(--txt);
}
.vd-contract-uploaded {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(74, 124, 89, 0.08);
    border: 1px solid rgba(74, 124, 89, 0.25);
    border-radius: 8px;
    font-size: 13px;
    color: var(--txt);
}
.vd-contract-uploaded svg {
    color: var(--vd-paid);
}
.vd-contract-del {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--txt-l);
}
.vd-contract-del:hover {
    color: #e74c3c;
}
.vd-detail-notes-text {
    font-size: 13px;
    color: var(--txt-m);
    line-height: 1.6;
    white-space: pre-wrap;
}
.vd-notes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}
.vd-notes-empty {
    font-size: 12px;
    color: var(--txt-l);
    font-style: italic;
}
.vd-note-item {
    background: var(--cream);
    border: 1px solid var(--cream-d);
    border-radius: 8px;
    padding: 10px 14px;
}
.vd-note-date {
    font-size: 10px;
    color: var(--txt-l);
    margin-bottom: 4px;
}
.vd-note-text {
    font-size: 13px;
    color: var(--txt);
    line-height: 1.5;
    white-space: pre-wrap;
}
.vd-note-del {
    float: right;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--txt-l);
    font-size: 12px;
}
.vd-note-del:hover {
    color: #e74c3c;
}
.vd-action-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.vd-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--cream-dd);
    background: var(--cream);
    color: var(--txt-m);
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
}
.vd-action-btn:hover {
    background: var(--cream-d);
    border-color: var(--terra);
    color: var(--terra);
}
.input-with-addon {
    display: flex;
}
.vd-currency-sel {
    width: 80px !important;
    border-radius: 0 6px 6px 0 !important;
    border-left: none !important;
}
#vd-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 60px 20px;
    gap: 12px;
    background: var(--cream);
    border: 1px solid var(--cream-d);
    border-radius: var(--radius);
}
#vd-empty p {
    font-size: 16px;
    font-weight: 600;
    color: var(--txt);
    margin: 0;
}
#vd-empty span {
    font-size: 13px;
    color: var(--txt-l);
    max-width: 380px;
    line-height: 1.5;
}

/* ── Vendor kebab menu (portal, same pattern as budget/checklist) ── */
#vd-kebab-menu {
    display: none;
    position: fixed;
    z-index: 9999;
    background: #fff;
    border: 1px solid var(--cream-d);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    min-width: 170px;
    overflow: hidden;
    animation: menuIn 0.12s ease;
}
#vd-kebab-menu button,
#vd-kebab-menu a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--txt-m);
    background: none;
    border: none;
    border-bottom: 1px solid rgba(44, 32, 22, 0.06);
    cursor: pointer;
    width: 100%;
    text-align: left;
    text-decoration: none;
    appearance: none;
    -webkit-appearance: none;
}
#vd-kebab-menu button:last-child,
#vd-kebab-menu a:last-child {
    border-bottom: none;
}
#vd-kebab-menu button:hover,
#vd-kebab-menu a:hover {
    background: var(--cream);
    color: var(--txt);
}
#vd-kebab-menu button.delete {
    color: #c0392b;
}
#vd-kebab-menu button.delete:hover {
    background: rgba(192, 57, 43, 0.06);
}

/* ── Drag-and-drop states ── */
.vd-card[draggable="true"] {
    cursor: grab;
}
.vd-card[draggable="true"]:active {
    cursor: grabbing;
}
.vd-card.vd-dragging {
    opacity: 0.35;
    transform: scale(0.97);
}
.vd-kanban-col.vd-drag-over {
    background: var(--cream-d) !important;
    border-color: var(--terra) !important;
    box-shadow: inset 0 0 0 2px var(--terra);
}
.vd-kanban-col.vd-drag-over .vd-col-header {
    background: var(--cream-d);
}

/* ── Quick status pipeline chips in detail panel ── */
.vd-status-pipeline-section {
    padding: 12px 0;
}
.vd-status-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.vd-status-chip {
    flex: 1 1 auto;
    padding: 6px 10px;
    border-radius: 20px;
    border: 1.5px solid var(--cream-dd);
    background: var(--cream);
    color: var(--txt-m);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
    white-space: nowrap;
    text-align: center;
}
.vd-status-chip:hover:not(:disabled) {
    border-color: var(--terra);
    color: var(--terra);
    background: rgba(196, 145, 138, 0.08);
}
.vd-status-chip.active {
    background: var(--terra);
    border-color: var(--terra);
    color: #fff;
    cursor: default;
}
.vd-status-chip.prospect.active {
    background: var(--vd-prospect);
    border-color: var(--vd-prospect);
}
.vd-status-chip.contacted.active {
    background: var(--vd-contacted);
    border-color: var(--vd-contacted);
}
.vd-status-chip.booked.active {
    background: var(--vd-booked);
    border-color: var(--vd-booked);
}
.vd-status-chip.signed.active {
    background: var(--vd-signed);
    border-color: var(--vd-signed);
}
.vd-status-chip.paid.active {
    background: var(--vd-paid);
    border-color: var(--vd-paid);
}

/* ── Mobile tab bar (Trello-style — hidden on desktop) ── */
.vd-kanban-tab-bar {
    display: none;
}

@media (max-width: 1200px) {
    .vd-kanban-board {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    /* ── Page header ── */
    #tab-vendors .page-header {
        flex-wrap: wrap;
        gap: 12px;
    }
    #tab-vendors .header-actions {
        gap: 6px;
        flex-wrap: wrap;
    }

    /* ── Stats: 2-column grid ── */
    #tab-vendors .guests-dashboard {
        grid-template-columns: repeat(2, 1fr);
    }

    /* ── Filters: pills scrollable, no wrap ── */
    .vd-filters {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    #vd-cat-pills {
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }
    #vd-cat-pills .filter-pill {
        flex-shrink: 0;
    }

    /* ── gm-row stacks ── */
    #modal-vendor .gm-row {
        flex-direction: column;
        gap: 10px;
    }

    /* ── Kanban: mobile tab bar + horizontal scroll-snap ── */
    .vd-kanban-tab-bar {
        display: flex;
        border-bottom: 2px solid var(--cream-d);
        margin-bottom: 0;
        background: #fff;
        border-radius: var(--radius) var(--radius) 0 0;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .vd-kanban-tab-bar::-webkit-scrollbar {
        display: none;
    }
    .vd-kanban-tab {
        flex: 0 0 auto;
        padding: 11px 12px;
        border: none;
        background: transparent;
        font-family: "Jost", sans-serif;
        font-size: 0.68rem;
        font-weight: 700;
        color: var(--txt-l);
        letter-spacing: 0.4px;
        cursor: pointer;
        border-bottom: 2px solid transparent;
        margin-bottom: -2px;
        transition:
            color 0.15s,
            border-color 0.15s;
        display: flex;
        align-items: center;
        gap: 5px;
        white-space: nowrap;
        text-transform: uppercase;
    }
    .vd-kanban-tab.active {
        color: var(--txt);
        border-bottom-color: var(--terra);
    }
    .vd-kanban-tab-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        flex-shrink: 0;
    }
    .vd-kanban-tab-count {
        background: rgba(44, 32, 22, 0.08);
        padding: 1px 6px;
        border-radius: 10px;
        font-size: 0.6rem;
    }
    .vd-kanban-tab.active .vd-kanban-tab-count {
        background: var(--terra);
        color: #fff;
    }

    .vd-kanban-board[style*="display: none"] {
        display: none !important;
    }
    .vd-kanban-board {
        display: flex !important;
        flex-direction: row !important;
        width: 100% !important;
        overflow-x: scroll;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
        overscroll-behavior-x: contain;
        height: auto !important;
        min-height: 0 !important;
        gap: 0 !important;
        border-radius: 0 !important;
        scrollbar-width: none;
    }
    .vd-kanban-board::-webkit-scrollbar {
        display: none;
    }
    .vd-kanban-col {
        flex: 0 0 100% !important;
        min-width: 100% !important;
        scroll-snap-align: start;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        border-top: none !important;
        height: auto !important;
    }
    .vd-col-header {
        position: sticky;
        top: 0;
        z-index: 2;
        background: var(--cream);
    }
    .vd-col-cards {
        max-height: 65vh !important;
        overflow-y: auto;
        flex: unset !important;
    }

    /* ── Detail panel: full screen ── */
    .vd-detail-panel {
        width: 100vw;
    }

    /* ── List view: table → cards ── */
    .vd-list-view {
        background: transparent;
        border: none;
        border-radius: 0;
        overflow: visible;
    }
    #vd-list .table-wrapper {
        overflow: visible;
        background: transparent;
        box-shadow: none;
    }
    #vd-list table thead {
        display: none;
    }
    #vd-list-tbody {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    #vd-list-tbody tr {
        position: relative;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 10px;
        background: #fff;
        border-radius: var(--radius);
        box-shadow: var(--shadow-sm);
        padding: 12px 44px 12px 12px;
        border-left: 3px solid var(--terra);
        cursor: pointer;
    }
    #vd-list-tbody tr:hover td {
        background: transparent;
    }
    #vd-list-tbody td {
        padding: 0;
        border: none;
        vertical-align: middle;
        font-size: 0.78rem;
    }
    /* col 1: checkbox — small, stays left */
    #vd-list-tbody td:nth-child(1) {
        width: auto;
        padding: 0;
    }
    /* col 2: name — full row width */
    #vd-list-tbody td:nth-child(2) {
        flex: 1 1 100%;
        min-width: 0;
        font-size: 0.85rem;
        color: var(--txt);
    }
    /* col 3: category pill */
    #vd-list-tbody td:nth-child(3) {
        order: 3;
    }
    /* col 4: status pill */
    #vd-list-tbody td:nth-child(4) {
        order: 4;
    }
    /* col 5: contact — hide on mobile (visible in detail) */
    #vd-list-tbody td:nth-child(5) {
        display: none;
    }
    /* col 6: price */
    #vd-list-tbody td:nth-child(6) {
        order: 5;
        font-weight: 600;
        color: var(--terra);
    }
    /* col 7: contract badge — hide to save space */
    #vd-list-tbody td:nth-child(7) {
        display: none;
    }
    /* col 8: kebab — absolutely pinned right */
    #vd-list-tbody td:nth-child(8) {
        position: absolute;
        top: 50%;
        right: 10px;
        transform: translateY(-50%);
        padding: 0;
        border: none;
    }

    /* ── Bulk bar ── */
    #vd-bulk-bar {
        flex-wrap: wrap;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    /* Stats: single column */
    #tab-vendors .guests-dashboard {
        grid-template-columns: 1fr;
    }
    .vd-col-cards {
        max-height: 58vh !important;
    }

    /* Modal: full screen */
    #modal-vendor .modal-content {
        max-width: 100vw !important;
        margin: 0;
        border-radius: 0;
        overflow-y: auto;
    }
}

