/* ============================================================
   Project Board — Monday.com-style Kanban
   ============================================================ */

/* --- Board Layout --- */
.pb-board {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding-bottom: 12px;
}

/* --- Columns --- */
.pb-column {
    flex: 1 1 280px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    background: #F4F5F7;
    border-radius: 12px;
    max-height: 600px;
    min-height: 300px;
    transition: background 0.2s;
}

.pb-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 12px;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
    user-select: none;
}

.pb-column-title {
    font-family: var(--font-headings);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #344054;
}

.pb-column-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 13px;
    background: rgba(0,0,0,0.08);
    font-family: var(--font-primary);
    font-size: 0.75rem;
    font-weight: 700;
    color: #344054;
}

.pb-column-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: #D0D5DD transparent;
    transition: background 0.2s, outline 0.2s;
    border-radius: 0 0 12px 12px;
}

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

.pb-column-body::-webkit-scrollbar-thumb {
    background: #D0D5DD;
    border-radius: 3px;
}

.pb-column-body.drag-over {
    background: rgba(0, 161, 190, 0.06);
    outline: 2px dashed var(--color-primary);
    outline-offset: -4px;
    border-radius: 0 0 12px 12px;
}

.pb-column-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    color: #98A2B3;
    font-size: 0.8rem;
    text-align: center;
    flex: 1;
}

.pb-column-empty i {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    opacity: 0.4;
    color: #98A2B3 !important;
}

/* --- Project Cards --- */
.pb-card {
    background: #FFF;
    border-radius: 10px;
    padding: 14px 16px;
    cursor: grab;
    border: 1px solid #E4E7EC;
    border-left: 4px solid #E4E7EC;
    transition: box-shadow 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
    position: relative;
}

.pb-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

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

.pb-card.dragging {
    opacity: 0.4;
    transform: rotate(1.5deg) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.pb-card-locked {
    cursor: not-allowed;
    opacity: 0.6;
}

.pb-card-locked:hover {
    transform: none;
    box-shadow: none;
}

/* Priority left borders */
.pb-card.priority-border-critical {
    border-left-color: #FF4A11;
}

.pb-card.priority-border-high {
    border-left-color: #D8237C;
}

.pb-card.priority-border-normal {
    border-left-color: #00A1BE;
}

.pb-card.priority-border-low {
    border-left-color: #00CC78;
}

/* Overdue cards — red border all around */
.pb-card.pb-card-overdue {
    border: 2px solid #CC3333;
    border-left-width: 4px;
}

/* --- Card Inner --- */
.pb-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.pb-card-id {
    font-size: 0.7rem;
    font-weight: 600;
    color: #98A2B3;
    font-family: var(--font-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.pb-card-id i {
    color: #D8237C !important;
}

.pb-card-title {
    font-family: var(--font-primary);
    font-size: 0.875rem;
    font-weight: 600;
    color: #1D2939;
    line-height: 1.35;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pb-card-due {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 500;
    color: #667085;
    margin-bottom: 8px;
    padding: 3px 8px;
    background: #F2F4F7;
    border-radius: 6px;
}

.pb-card-due i {
    color: #98A2B3 !important;
    font-size: 0.65rem;
}

.pb-card-due.due-soon {
    background: transparent;
    color: #E65100;
}

.pb-card-due.due-soon i {
    color: #E65100 !important;
}

.pb-card-due.due-today {
    background: transparent;
    color: #CC3333;
}

.pb-card-due.due-today i {
    color: #CC3333 !important;
}

.pb-card-due.due-overdue {
    background: transparent;
    color: #CC3333;
    font-weight: 700;
}

.pb-card-due.due-overdue i {
    color: #CC3333 !important;
}

.pb-card-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: #667085;
    margin-bottom: 4px;
}

.pb-card-meta i {
    color: #98A2B3 !important;
    font-size: 0.65rem;
    width: 12px;
    text-align: center;
}

/* Progress bar */
.pb-card-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #F2F4F7;
}

.pb-progress-bar {
    flex: 1;
    height: 5px;
    background: #F2F4F7;
    border-radius: 3px;
    overflow: hidden;
}

.pb-progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.pb-progress-text {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--color-primary);
    min-width: 28px;
    text-align: right;
}

/* --- Priority Badges --- */
.pb-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pb-badge.priority-critical {
    background: #FF4A11;
    color: #FFF;
}

.pb-badge.priority-high {
    background: #D8237C;
    color: #FFF;
}

.pb-badge.priority-normal {
    background: #00A1BE;
    color: #FFF;
}

.pb-badge.priority-low {
    background: #00CC78;
    color: #FFF;
}

/* --- Summary Cards --- */
.pb-summary-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.pb-summary-card {
    flex: 1;
    min-width: 130px;
    background: #FFF;
    border: 1px solid #E4E7EC;
    border-radius: 10px;
    padding: 14px 16px;
    text-align: center;
    transition: box-shadow 0.15s;
}

.pb-summary-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.pb-summary-value {
    font-family: var(--font-headings);
    font-size: 1.6rem;
    font-weight: 700;
    color: #1D2939;
    line-height: 1.2;
}

.pb-summary-label {
    font-family: var(--font-primary);
    font-size: 0.7rem;
    font-weight: 600;
    color: #98A2B3;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

.pb-summary-overdue .pb-summary-value {
    color: #CC3333;
}

.pb-summary-overdue {
    border-color: #CC3333;
}

.pb-summary-due .pb-summary-value {
    color: #E65100;
}

.pb-summary-new .pb-summary-value {
    color: var(--color-primary);
}

.pb-summary-done .pb-summary-value {
    color: var(--color-secondary);
}

/* --- Toolbar (combined filter + actions) --- */
.pb-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px 16px;
    background: #FFF;
    border: 1px solid #E4E7EC;
    border-radius: 10px;
}

.pb-toolbar-sep {
    width: 1px;
    height: 24px;
    background: #E4E7EC;
    flex-shrink: 0;
}

.pb-search-wrap {
    position: relative;
    flex: 1;
    min-width: 180px;
    max-width: 300px;
}

.pb-search-wrap input {
    width: 100%;
    padding: 6px 12px 6px 34px;
    border: 1px solid #E4E7EC;
    border-radius: 8px;
    font-size: 0.82rem;
    font-family: var(--font-primary);
    color: #344054;
    background: #F9FAFB;
    transition: border-color 0.15s, background 0.15s;
    outline: none;
}

.pb-search-wrap input:focus {
    border-color: var(--color-primary);
    background: #FFF;
    box-shadow: 0 0 0 3px rgba(0, 161, 190, 0.1);
}

.pb-search-wrap input::placeholder {
    color: #98A2B3;
}

.pb-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.78rem;
    color: #98A2B3 !important;
    pointer-events: none;
}

.pb-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #98A2B3;
    font-size: 0.75rem;
    padding: 2px;
    line-height: 1;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
}

.pb-search-clear:hover {
    color: #D8237C;
    background: #FEF3F2;
}

/* --- Filter pills --- */
.pb-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: #F2F4F7;
    border: 1px solid #E4E7EC;
    border-radius: 8px;
    font-size: 0.78rem;
    font-family: var(--font-primary);
    font-weight: 500;
    color: #344054;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
    position: relative;
}

.pb-filter-pill:hover {
    background: #E8F8FB;
    border-color: var(--color-primary);
}

.pb-filter-pill.active {
    background: #E8F8FB;
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 600;
}

.pb-filter-pill i {
    font-size: 0.7rem;
    color: #98A2B3 !important;
}

.pb-filter-pill.active i {
    color: var(--color-primary) !important;
}

.pb-filter-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 280px;
    max-height: 320px;
    overflow-y: auto;
    background: #FFF;
    border: 1px solid #E4E7EC;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 100;
    padding: 4px;
    white-space: nowrap;
}

.pb-filter-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 0.82rem;
    color: #344054;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
}

.pb-filter-dropdown-item:hover {
    background: #F2F4F7;
}

.pb-filter-dropdown-item.selected {
    background: #E8F8FB;
    color: var(--color-primary);
    font-weight: 600;
}

.pb-filter-dropdown-item .check-mark {
    width: 16px;
    text-align: center;
    color: var(--color-primary);
    font-weight: 700;
}

/* --- Preview Panel --- */
.pb-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.5);
    z-index: 1040;
    animation: pbFadeIn 0.2s ease;
    backdrop-filter: blur(2px);
}

.pb-preview-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 520px;
    max-width: 100%;
    background: #FFF;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    animation: pbSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -8px 0 32px rgba(16, 24, 40, 0.14);
}

@keyframes pbFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pbSlideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.pb-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #E4E7EC;
    flex-shrink: 0;
}

.pb-preview-title {
    font-family: var(--font-headings);
    font-size: 0.85rem;
    font-weight: 700;
    color: #667085;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pb-preview-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    background: #F2F4F7;
    color: #667085;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-size: 0.9rem;
}

.pb-preview-close:hover {
    background: #FEF3F2;
    color: #CC3333;
}

.pb-preview-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.pb-preview-name {
    font-family: var(--font-headings);
    font-size: 1.2rem;
    font-weight: 700;
    color: #1D2939;
    line-height: 1.35;
    margin-bottom: 20px;
}

.pb-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.pb-preview-field {
    margin-bottom: 16px;
}

.pb-preview-label {
    font-family: var(--font-primary);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #98A2B3;
    margin-bottom: 4px;
}

.pb-preview-val {
    font-family: var(--font-primary);
    font-size: 0.88rem;
    color: #1D2939;
    font-weight: 500;
}

.pb-preview-desc {
    padding: 14px 16px;
    background: #F9FAFB;
    border: 1px solid #E4E7EC;
    border-radius: 10px;
    font-family: var(--font-primary);
    font-size: 0.85rem;
    color: #475467;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
}

.pb-preview-desc:empty {
    display: none;
}

.pb-preview-footer {
    padding: 16px 24px;
    border-top: 1px solid #E4E7EC;
    flex-shrink: 0;
}

.pb-preview-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #E8F8FB;
    color: var(--color-primary);
}

.pb-preview-pct {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pb-preview-pct-bar {
    flex: 1;
    height: 8px;
    background: #F2F4F7;
    border-radius: 4px;
    overflow: hidden;
}

.pb-preview-pct-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--color-primary);
    transition: width 0.4s ease;
}

.pb-preview-pct-text {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-primary);
    min-width: 36px;
    text-align: right;
}

/* --- View Switcher (in toolbar) --- */
.pb-view-switcher {
    display: inline-flex;
    border: 1px solid #E4E7EC;
    border-radius: 8px;
    overflow: hidden;
}

.pb-view-btn {
    padding: 6px 14px;
    font-size: 0.78rem;
    font-family: var(--font-primary);
    font-weight: 600;
    color: #667085;
    background: #FFF;
    border: none;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    border-right: 1px solid #E4E7EC;
}

.pb-view-btn:last-child {
    border-right: none;
}

.pb-view-btn:hover {
    background: #F2F4F7;
}

.pb-view-btn.active {
    background: var(--color-primary);
    color: #FFF;
}

/* --- Loading shimmer --- */
.pb-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.pb-loading i {
    color: var(--color-primary) !important;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .pb-column {
        flex: 1 1 100%;
        min-width: 100%;
        max-height: 400px;
        min-height: 250px;
    }

    .pb-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .pb-toolbar-sep {
        display: none;
    }

    .pb-search-wrap {
        max-width: 100%;
    }

    .pb-summary-row {
        gap: 8px;
    }

    .pb-summary-card {
        min-width: calc(50% - 4px);
        padding: 10px 12px;
    }

    .pb-summary-value {
        font-size: 1.25rem;
    }

    .pb-preview-panel {
        width: 100%;
    }

    .pb-preview-grid {
        grid-template-columns: 1fr;
    }
}
