/**
 * Frontend Kanban board — matches admin board colors and Trello-style layout.
 */

/* Reset legacy public-board styles when Kanban is active */
.tmp-public-board-view.tmp-kanban-board {
    box-sizing: border-box;
    padding: 0;
    border: none;
    margin: 1.5rem 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: #172b4d;
    background-color: #374866;
    background-image:
        linear-gradient(145deg, rgba(80, 95, 121, 0.96) 0%, rgba(23, 43, 77, 0.98) 100%),
        var(--tmp-board-bg, none);
    background-size: cover, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    border-radius: 12px;
    overflow: hidden;
    min-height: var(--tmp-board-height, 620px);
    max-width: 100%;
    box-shadow:
        0 1px 2px rgba(9, 30, 66, 0.15),
        0 8px 24px rgba(9, 30, 66, 0.22);
    isolation: isolate;
}

.tmp-public-board-view.tmp-kanban-board *,
.tmp-public-board-view.tmp-kanban-board *::before,
.tmp-public-board-view.tmp-kanban-board *::after {
    box-sizing: border-box;
}

/* Header — aligned with admin tmp-view-header on board page */
.tmp-kanban-board .tmp-kb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.04) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.tmp-kb-header__lead {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.tmp-kb-header__icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45);
    flex-shrink: 0;
}

.tmp-kb-header__icon .dashicons {
    color: #fff;
    font-size: 20px;
    width: 20px;
    height: 20px;
    line-height: 1;
}

.tmp-kb-header__title {
    margin: 0;
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.tmp-kb-header__subtitle {
    margin: 3px 0 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.8125rem;
    line-height: 1.45;
    max-width: 56ch;
}

.tmp-kb-header__stats {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    white-space: nowrap;
}

/* Board canvas */
.tmp-kb-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 16px 20px 24px;
    scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.tmp-kb-columns {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: calc(var(--tmp-board-height, 620px) - 108px);
}

/* Columns — admin .top_list */
.tmp-kb-column {
    flex: 0 0 272px;
    width: 272px;
    max-height: calc(var(--tmp-board-height, 620px) - 120px);
    background: #ebecf0;
    border-radius: 12px;
    padding: 10px 10px 8px;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 0 1px rgba(9, 30, 66, 0.06);
}

.tmp-kb-column--unassigned {
    background: #fdf6e3;
    box-shadow: inset 0 0 0 1px rgba(180, 130, 0, 0.15);
}

.tmp-kb-column-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 4px 8px;
    flex-shrink: 0;
}

.tmp-kb-column-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: #172b4d;
    line-height: 1.3;
    padding: 4px 6px;
}

.tmp-kb-column-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.22);
    color: #4338ca;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
}

.tmp-kb-drag-area,
.tmp-kanban-board .dragArea {
    flex: 1;
    min-height: 12px;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 2px 1px;
    scrollbar-color: rgba(9, 30, 66, 0.22) transparent;
}

.tmp-kb-empty-placeholder {
    min-height: 4px;
}

/* Task cards — admin .t__box */
.tmp-kb-card,
.tmp-kanban-board .t__box {
    background: #ffffff;
    border-radius: 8px;
    box-shadow:
        0 1px 1px rgba(9, 30, 66, 0.25),
        0 0 1px rgba(9, 30, 66, 0.31);
    cursor: grab;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
    border: none;
}

.tmp-kanban-board.is-readonly .tmp-kb-card,
.tmp-kanban-board.is-readonly .t__box {
    cursor: pointer;
}

.tmp-kb-card:hover,
.tmp-kanban-board .t__box:hover {
    box-shadow:
        0 2px 6px rgba(9, 30, 66, 0.18),
        0 8px 16px rgba(9, 30, 66, 0.12);
    transform: translateY(-1px);
}

.tmp-kb-card:focus-visible,
.tmp-kanban-board .t__box:focus-visible {
    outline: 2px solid #388bff;
    outline-offset: 2px;
}

.tmp-kb-card-body,
.tmp-kanban-board .t__details {
    padding: 8px 10px 8px;
}

.tmp-kb-card-title,
.tmp-kanban-board .t__title {
    margin: 0 0 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #172b4d;
    line-height: 1.35;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    word-break: break-word;
}

.tmp-kb-card-title .is-completed,
.tmp-kanban-board .t__title .is-completed {
    text-decoration: line-through;
    color: #626f86;
}

.tmp-kb-done-icon {
    color: #1f845a !important;
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0;
    margin-top: 1px;
}

.tmp-kb-card-footer,
.tmp-kanban-board .card__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
}

.tmp-kb-meta,
.tmp-kanban-board .__item {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 24px;
    padding: 0 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #44546f;
    line-height: 1;
}

.tmp-kb-meta .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
    color: inherit;
}

.tmp-kb-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.tmp-kb-meta.due.over_due,
.tmp-kanban-board .__item.due.over_due {
    background: #c9372c;
    color: #ffffff;
    border-radius: 3px;
    padding: 2px 6px;
}

.tmp-kb-meta.due.due_soon,
.tmp-kanban-board .__item.due.due_soon {
    background: #f5cd47;
    color: #172b4d;
    border-radius: 3px;
    padding: 2px 6px;
}

.tmp-kb-meta.due.done,
.tmp-kanban-board .__item.due.done {
    background: #1f845a;
    color: #ffffff;
    border-radius: 3px;
    padding: 2px 6px;
}

.tmp-kb-meta.status {
    border-radius: 999px;
    padding: 2px 8px;
    color: #ffffff;
    font-size: 0.6875rem;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}

.tmp-kb-meta.status .__d {
    color: inherit;
}

.tmp-kb-priority-icon {
    height: 16px;
    width: auto;
    display: block;
}

.tmp-kb-priority-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.tmp-kb-assignees,
.tmp-kanban-board .pop__assignee {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 6px;
}

.tmp-kb-assignees .__p,
.tmp-kanban-board .pop__assignee .__p {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #506eec;
    color: #ffffff;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 0 0 2px #ffffff;
}

.tmp-kb-assignees .__avatar,
.tmp-kanban-board .pop__assignee .__avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    object-fit: cover;
    box-shadow: 0 0 0 2px #ffffff;
}

/* Empty states on dark board canvas */
.tmp-kanban-board .tmp-kb-empty-state,
.tmp-kanban-board .tmp-empty-state {
    margin: 12px 20px 24px;
    padding: 28px 24px;
    text-align: center;
    color: rgba(255, 255, 255, 0.88);
    background: rgba(255, 255, 255, 0.08);
    border: 1px dashed rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.tmp-kanban-board .tmp-kb-empty-state p,
.tmp-kanban-board .tmp-empty-state p {
    margin: 0;
}

.tmp-kanban-board .tmp-kb-empty-state small,
.tmp-kanban-board .tmp-empty-state small {
    display: block;
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.8125rem;
}

/* Sortable drag states */
html.tmp-kb-grabbing,
html.tmp-kb-grabbing * {
    cursor: grabbing !important;
}

.tmp-kanban-board .sortable-ghost {
    border: 2px dashed rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.06) !important;
    box-shadow: none;
    border-radius: 8px;
}

.tmp-kanban-board .sortable-ghost > * {
    opacity: 0;
}

.tmp-kanban-board .sortable-chosen {
    cursor: grabbing;
}

.tmp-kanban-board .sortable-chosen.tmp-kb-card,
.tmp-kanban-board .sortable-chosen.t__box {
    transform: rotate(2deg);
    box-shadow: 0 12px 28px rgba(9, 30, 66, 0.28);
}

/* Explicit dark theme shortcode option */
.tmp-kanban-board.tmp-theme-dark {
    background-color: #0c1424;
    background-image:
        linear-gradient(145deg, rgba(15, 23, 42, 0.97) 0%, rgba(2, 6, 23, 0.98) 100%),
        var(--tmp-board-bg, none);
}

.tmp-kanban-board.tmp-theme-dark .tmp-kb-column {
    background: #1e293b;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.tmp-kanban-board.tmp-theme-dark .tmp-kb-column-title {
    color: #e2e8f0;
}

.tmp-kanban-board.tmp-theme-dark .tmp-kb-column-count {
    background: rgba(99, 102, 241, 0.28);
    color: #c7d2fe;
}

.tmp-kanban-board.tmp-theme-dark .tmp-kb-card,
.tmp-kanban-board.tmp-theme-dark .t__box {
    background: #0f172a;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.35), 0 0 1px rgba(255, 255, 255, 0.08);
}

.tmp-kanban-board.tmp-theme-dark .tmp-kb-card-title,
.tmp-kanban-board.tmp-theme-dark .t__title {
    color: #f1f5f9;
}

.tmp-kanban-board.tmp-theme-dark .tmp-kb-meta:not(.due):not(.status) {
    color: #94a3b8;
}

/* Responsive */
@media (max-width: 768px) {
    .tmp-kanban-board .tmp-kb-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tmp-kb-header__stats {
        align-self: flex-start;
    }

    .tmp-kb-columns {
        flex-direction: column;
    }

    .tmp-kb-column {
        flex: 1 1 auto;
        width: 100%;
        max-height: none;
    }

    .tmp-kb-scroll {
        overflow-x: hidden;
        overflow-y: auto;
    }
}

/* Scrollbars */
.tmp-kb-scroll::-webkit-scrollbar,
.tmp-kb-drag-area::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.tmp-kb-scroll::-webkit-scrollbar-track,
.tmp-kb-drag-area::-webkit-scrollbar-track {
    background: transparent;
}

.tmp-kb-scroll::-webkit-scrollbar-thumb,
.tmp-kb-drag-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.28);
    border-radius: 999px;
}

.tmp-kb-scroll::-webkit-scrollbar-thumb:hover,
.tmp-kb-drag-area::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.tmp-kb-drag-area::-webkit-scrollbar-thumb {
    background: rgba(9, 30, 66, 0.18);
}

.tmp-kb-drag-area::-webkit-scrollbar-thumb:hover {
    background: rgba(9, 30, 66, 0.28);
}
