/* ---------------------------------------------------
   Kanban Board – VendBase Minimal Compact Version
   Optimized for no vertical scroll between header/search/footer
--------------------------------------------------- */

/* --- Layout & Container --- */
body,
.wrap {
    background: #fafafa;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.kanban-board {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.kanban-board::-webkit-scrollbar {
    height: 6px;
}

.kanban-board::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

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

/* --- Heading Container --- */
.container-fluid.mb-3 {
    margin-bottom: 0.5rem !important;
    /* Reduce spacing below title bar */
}

.wrap h2,
.wrap h1 {
    margin-bottom: 0.25rem !important;
}

/* --- Header (WP-native) --- */
.kbfwc-page-title.wp-heading-inline {
    font-size: 23px;
    font-weight: 400;
    color: #1d2327;
}

.kbfwc-kpi-strip {
    padding-right: 20px;
    border-right: 1px solid #dcdcde;
}

.kbfwc-kpi-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #787c82;
}

.kbfwc-kpi-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.kbfwc-kpi-value {
    font-size: 20px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.2;
}

.kbfwc-kpi-delta {
    font-size: 12px;
    color: #646970;
}

.kbfwc-kpi-delta.kbfwc-kpi-up {
    color: #00a32a;
}

.kbfwc-kpi-delta.kbfwc-kpi-down {
    color: #d63638;
}

.kbfwc-btn-icon.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 3px;
    border: 1px solid #8c8f94;
    background: #f6f7f7;
    color: #50575e;
}

.kbfwc-btn-icon.btn:hover,
.kbfwc-btn-icon.btn:focus {
    background: #f0f0f1;
    border-color: #646970;
    color: #50575e;
}

.kbfwc-btn-icon .dashicons {
    color: #50575e;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* --- Toolbar order-count summary --- */
#kanban-toolbar-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
}

.kbfwc-summary-total {
    font-size: 12px;
    font-weight: 600;
    color: #1d2327;
    white-space: nowrap;
    margin-right: 2px;
}

.kbfwc-summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 400;
    color: #3c434a;
    background: #f0f0f1;
    border-radius: 10px;
    padding: 2px 8px;
    white-space: nowrap;
}

.kbfwc-summary-pill strong {
    font-weight: 600;
}

.kbfwc-summary-pill.kbfwc-summary-zero {
    color: #a7aaad;
    opacity: .7;
}

.kbfwc-summary-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* --- Search Bar --- */
.search-container {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0 0.75rem 0;
    /* Compact spacing */
}

.search-input {
    width: 100%;
    max-width: 300px;
    height: 34px;
    font-size: 0.9rem;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0 0.9rem;
    background: #fff;
    box-shadow: none;
    transition: all 0.2s ease-in-out;
}

.search-input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.2);
    outline: none;
}

/* --- Column Styling --- */
.kanban-column {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 170px);
    /* Compact height for visible footer */
    transition: all 0.2s ease-in-out;
    padding-inline: 0.25rem;
}

.kanban-column:hover {
    background: #f9f9f9;
    border-color: rgba(0, 0, 0, 0.08);
}

/* --- Column Header --- */
.kanban-column-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

/* --- Scrollable Column Body --- */
.column-body {
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.4rem 0.55rem 0.5rem 0.55rem;
    flex-grow: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

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

.column-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

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

/* --- Bottom fade hint: shown only while a column has more cards below the fold --- */
.column-body::after {
    content: '';
    position: absolute;
    left: 0;
    right: 6px;
    bottom: 0;
    height: 28px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.95));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-in-out;
}

.kanban-column.has-more-below .column-body::after {
    opacity: 1;
}

.order-card-head {
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.order-card-title {
    min-width: 0;
    flex: 1 1 auto;
}

/* --- Column Accent Colors (Top Borders) --- */
.kanban-column[data-status="pending"] {
    border-top: 7px solid #fbbf24;
}

.kanban-column[data-status="processing"] {
    border-top: 7px solid #818cf8;
}

.kanban-column[data-status="on-hold"] {
    border-top: 7px solid #ff4500;
}

.kanban-column[data-status="completed"] {
    border-top: 7px solid #4ade80;
}

.kanban-column[data-status="cancelled"] {
    border-top: 7px solid #a1a1aa;
}

.kanban-column[data-status="refunded"] {
    border-top: 7px solid #6366f1;
}

.kanban-column[data-status="failed"] {
    border-top: 7px solid #b22222;
}

/* --- Order Cards --- */
.order-card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-left: 1px solid transparent;
    border-radius: 8px;
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.45rem;
    transition: all 0.2s ease-in-out;
    font-size: 0.85rem;
    cursor: grab;
    overflow: hidden;
}

/* WP core's wp-admin/css/forms.css defines a generic ".card" rule (min-width:
   255px, max-width: 520px, padding: 16px 24px) for its own admin UI component.
   It shares our .order-card's Bootstrap-derived "card" class, ties on
   specificity, and loads after this stylesheet, so it wins and forces every
   order card to 255px wide with bulky padding, overflowing narrow kanban
   columns. Override with equal specificity via the compound selector; all
   visual padding is delegated to .card-body via the density rules below. */
.order-card.card {
    min-width: 0;
    max-width: none;
    padding: 0;
}

.order-card:hover {
    background: #f9fafb;
    transform: translateY(-1px);
    border-color: rgba(0, 0, 0, 0.08);
}

.order-card.dragging {
    opacity: 0.7;
    transform: scale(0.98);
}

.column-body {
    transition: all 0.2s ease-in-out;
}

.order-card {
    transition: transform 0.2s ease-in-out;
}

.order-card.dragging {
    cursor: grabbing;
    opacity: 0.95;
    transform: scale(1.03);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.order-card-placeholder {
    background: rgba(129, 140, 248, 0.1);
    border: 2px dashed rgba(129, 140, 248, 0.4);
    border-radius: 8px;
    height: 60px;
    margin-bottom: 0.6rem;
    transition: all 0.25s ease-in-out;
}

.kanban-column .column-body.sortable-placeholder-active {
    background: rgba(99, 102, 241, 0.03);
}

.kanban-column.drag-hover {
    background: rgba(99, 102, 241, 0.05);
    border: 2px dashed rgba(107, 114, 128, 0.35);
    transition: background 0.15s ease-in-out;
}

.order-card.dragging {
    cursor: grabbing !important;
    opacity: 0.95 !important;
}

.order-card.drop-anim {
    will-change: transform;
}

.order-count {
    font-size: 0.85em;
    font-weight: 500;
}

/* --- Order Card Accents by Status --- */
.kanban-column[data-status="pending"] .order-card {
    border-left-color: #fbbf24;
}

.kanban-column[data-status="processing"] .order-card {
    border-left-color: #818cf8;
}

.kanban-column[data-status="on-hold"] .order-card {
    border-left-color: #ff4500;
}

.kanban-column[data-status="completed"] .order-card {
    border-left-color: #4ade80;
}

.kanban-column[data-status="cancelled"] .order-card {
    border-left-color: #a1a1aa;
}

.kanban-column[data-status="refunded"] .order-card {
    border-left-color: #6366f1;
}

.kanban-column[data-status="failed"] .order-card {
    border-left-color: #b22222;
}

/* --- Card Content Layout --- */
.order-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.2rem;
}

.order-number {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-info {
    font-size: 0.74rem;
    color: #6b7280;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-name {
    display: block;
    font-size: 0.74rem;
    color: #71717a;
    margin-bottom: 0.2rem;
    font-style: italic;
}

/* .order-card .card-body is a column flex container (density rules below),
   so these become flex items and need min-width: 0 or their nowrap/ellipsis
   content refuses to shrink and overflows the card instead of truncating. */
.order-card .card-body,
.order-card-head,
.product-list,
.order-meta {
    min-width: 0;
}

.order-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.25rem 0.5rem;
}

.order-total {
    font-size: 0.78rem;
    color: #16a34a;
    font-weight: 500;
    white-space: nowrap;
}

.order-date {
    white-space: nowrap;
    flex-shrink: 0;
}

.payment-method {
    font-size: 0.74rem;
    color: #71717a;
    text-align: right;
    flex-shrink: 0;
    max-width: 50%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.25em 0.55em;
}

/* --- Load More Button --- */
.load-more-container {
    text-align: center;
    margin-top: 0.75rem;
}

.load-more-container button {
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    color: #444;
    font-size: 0.9rem;
    padding: 0.35rem 1rem;
    transition: background 0.2s ease-in-out;
}

.load-more-container button:hover {
    background: #e4e4e7;
}

/* --- Responsiveness --- */
@media (max-width: 768px) {
    .kanban-board {
        flex-direction: column;
        gap: 0.75rem;
    }

    .kanban-column {
        min-width: 100%;
        max-height: none;
    }

    .column-body {
        max-height: none;
        overflow-y: visible;
    }
}


.spin {
    animation: kbfwc-spin 1s linear infinite;
}

@keyframes kbfwc-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ==========================================
   Comfortable Density (Default)
========================================== */

.kanban-board.density-comfortable .column-body {
    padding: 8px;
}

.kanban-board.density-comfortable .kanban-column-header {
    padding: 10px 12px;
}

.kanban-board.density-comfortable .order-card {
    margin-bottom: 8px;
    border-radius: 8px;
}

.kanban-board.density-comfortable .order-card .card-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.kanban-board.density-comfortable .order-header {
    margin-bottom: 2px;
}

.kanban-board.density-comfortable .order-number {
    font-size: 15px;
    line-height: 1.3;
    font-weight: 600;
}

.kanban-board.density-comfortable .customer-info {
    font-size: 12px;
    line-height: 1.35;
    color: #6c757d;
}

.kanban-board.density-comfortable .product-list {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
    color: #444;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-board.density-comfortable .order-meta {
    margin-top: 3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-board.density-comfortable .order-total {
    font-size: 14px;
    font-weight: 600;
}

.kanban-board.density-comfortable .order-date {
    font-size: 11px;
}

.kanban-board.density-comfortable .payment-method {
    font-size: 11px;
    padding: 3px 7px;
}


/* ==========================================
   Compact Density
========================================== */

.kanban-board.density-compact .column-body {
    padding: 4px;
}

.kanban-board.density-compact .kanban-column-header {
    padding: 6px 8px;
}

.kanban-board.density-compact .order-card {
    margin-bottom: 4px;
    border-radius: 6px;
}

.kanban-board.density-compact .order-card .card-body {
    padding: 5px 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kanban-board.density-compact .order-header {
    margin-bottom: 0;
}

.kanban-board.density-compact .order-number {
    font-size: 13px;
    line-height: 1.15;
    font-weight: 600;
}

.kanban-board.density-compact .customer-info {
    font-size: 11px;
    line-height: 1.15;
}

.kanban-board.density-compact .product-list {
    margin: 0;
    font-size: 11px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-board.density-compact .order-meta {
    margin-top: 1px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-board.density-compact .order-total {
    font-size: 12px;
    font-weight: 600;
}

.kanban-board.density-compact .order-date {
    font-size: 10px;
}

.kanban-board.density-compact .payment-method {
    font-size: 10px;
    padding: 1px 5px;
}

.order-card {
    cursor: pointer;
    transition: .15s;
}

.order-card:hover {
    transform: translateY(-2px);
}

.kanban-empty {
    padding: 30px;
    color: #999;
    text-align: center;
    font-size: 12px;
}

.drag-origin {
    opacity: .35;
}

.kbfwc-dragging .kanban-column {
    transition: .2s;
}

.drop-hover {
    background: #f6f7f7;
    border: 2px dashed var(--wp-admin-theme-color);
}

.ui-draggable-dragging {
    transform: rotate(2deg);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
    border-radius: 8px;
}

.card-updated {
    animation: kbfwcFlash .8s;
}

.card-success {
    animation: flash .8s;
}

.kanban-column-header {
    position: sticky;
    top: 0;
    z-index: 20;
}

.kanban-empty {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #999;
    padding: 40px 10px;
    min-height: 120px;
}

.kanban-empty .dashicons {
    font-size: 30px;
    margin-bottom: 10px;
}

.kanban-column {
    display: flex;
    flex-direction: column;
}

.column-body {
    overflow-y: auto;
    flex: 1;
}

.kanban-column-header {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
    padding-bottom: 8px;
}

#kanban-toolbar-summary {    
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}

/* #kbfwcProCanvas, .kbfwc-offcanvas {
	top: 32px;
	height: calc(100vh - 32px);
}

@media screen and (max-width: 782px) {
	#kbfwcProCanvas, .kbfwc-offcanvas {
		top: 46px;
		height: calc(100vh - 46px);
	}
} */

@keyframes kbfwcFlash {

    0% {
        background: #fff8c5;
    }

    100% {
        background: #fff;
    }

}

/* --- Upgrade CTA --- */
.kbfwc-btn-upgrade {
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    border: none;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
    font-weight: 600;
    transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.kbfwc-btn-upgrade:hover,
.kbfwc-btn-upgrade:focus {
    background: linear-gradient(135deg, #6d28d9, #4f46e5);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5);
}

/* --- Locked Filter Selects --- */
[data-kbfwc-locked="1"] {
    cursor: pointer;
    background-color: #f4f4f5;
    color: #999;
}

.kbfwc-lock-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 12px;
    width: 16px;
    height: 16px;
    line-height: 16px;
    color: #fff;
    background: #a855f7;
    border-radius: 50%;
    text-align: center;
    pointer-events: none;
}

/* --- KPI Strip --- */
#kbfwc-kpi-strip {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
}

#kbfwc-kpi-strip:empty {
    display: none;
}

/* --- Quick Order Search Overlay (Ctrl/Cmd+K) --- */
.kbfwc-quick-search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 20, 0.5);
    z-index: 100000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
}

.kbfwc-quick-search-box {
    background: #fff;
    width: 100%;
    max-width: 560px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
}

.kbfwc-quick-search-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.kbfwc-quick-search-input-wrap input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
}

.kbfwc-quick-search-input-wrap kbd {
    font-size: 11px;
    color: #999;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1px 5px;
}

.kbfwc-quick-search-results {
    overflow-y: auto;
}

.kbfwc-quick-search-result {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.kbfwc-quick-search-result:hover {
    background: #f4f4f5;
}

.kbfwc-quick-search-empty {
    padding: 1rem;
    color: #999;
    text-align: center;
}

/* --- New Order Card Highlight --- */
.kbfwc-card-new {
    animation: kbfwc-new-card-flash 1.8s ease-out;
}

@keyframes kbfwc-new-card-flash {
    0% {
        box-shadow: 0 0 0 2px #4ade80;
    }

    100% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
    }
}

/* --- Confetti --- */
.kbfwc-confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100001;
    overflow: hidden;
}

.kbfwc-confetti-piece {
    position: absolute;
    top: -10px;
    width: 8px;
    height: 14px;
    opacity: 0.9;
    animation-name: kbfwc-confetti-fall;
    animation-timing-function: ease-in;
    animation-fill-mode: forwards;
}

@keyframes kbfwc-confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(90vh) rotate(360deg);
        opacity: 0;
    }
}

/* --- Order Details: Billing/Shipping Address --- */
.kbfwc-address-block {
    background: #f9fafb;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    line-height: 1.5;
}