/* ═══════════════════════════════════════════════════════════
   KANBAN BOARD — FULL STYLESHEET (SCROLL FIXED)
   ───────────────────────────────────────────────────────────
   Layout: replaces the parent theme's horizontally-scrolling
   kanban with a fixed 3-column grid on desktop that stacks
   vertically on mobile. Columns no longer trap scroll; the
   page scrolls normally.

   Colors resolve through the parent theme's --nh-* design
   tokens, which html.nh-dark and body.noteshub-dark-default
   swap automatically, so the board adapts to dark mode.
   ═══════════════════════════════════════════════════════════ */

/* ── Wrapper ── */
.nh-kanban {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 24px 0;
    width: 100%;
    box-sizing: border-box;
}

/* ── Header ── */
.nh-kanban-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: var(--nh-bg, #ffffff);
    border: 1px solid var(--nh-border, #e2e8f0);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    width: 100%;
    box-sizing: border-box;
}

.nh-kanban-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 800;
    color: var(--nh-text, #0f172a);
}

.nh-kanban-title-icon {
    font-size: 22px;
    line-height: 1;
}

.nh-kanban-stats {
    font-size: 12px;
    color: var(--nh-text-muted, #64748b);
    font-weight: 600;
}

.nh-kanban-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--nh-bg-tint, #f1f5f9);
    border: 1px solid var(--nh-border, #e2e8f0);
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    color: var(--nh-text-muted, #475569);
    transition: background .15s var(--nh-ease, cubic-bezier(.4, 0, .2, 1)),
                color .15s var(--nh-ease, cubic-bezier(.4, 0, .2, 1)),
                transform .15s var(--nh-ease, cubic-bezier(.4, 0, .2, 1));
    flex-shrink: 0;
}

.nh-kanban-refresh:hover {
    background: var(--nh-border, #e2e8f0);
    color: var(--nh-primary, #6366f1);
}

.nh-kanban-refresh:active {
    transform: scale(.95);
}

/* ── Board Container ── */
.nh-kanban-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

/* ── Columns ──
   overflow / max-height / height are forced to the "no internal
   scroll" values with !important because the parent theme's own
   kanban rules set max-height: 620px and rely on internal
   scrolling. Removing the internal scroll is the whole point of
   this stylesheet. */
.nh-kanban-col {
    background: var(--nh-bg-soft, #f8fafc);
    border: 1px solid var(--nh-border, #e2e8f0);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    box-sizing: border-box;
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
}

/* ── Column Headers ── */
.nh-kanban-col-head,
.nh-kanban-col > h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--nh-primary, #6366f1);
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 800;
    color: var(--nh-text, #0f172a);
    text-transform: uppercase;
    letter-spacing: .4px;
}

/* ── Cards ── */
.nh-kanban-card {
    display: block;
    background: var(--nh-bg, #ffffff);
    border: 1px solid var(--nh-border, #e2e8f0);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: grab;
    transition: transform .15s var(--nh-ease, cubic-bezier(.4, 0, .2, 1)),
                box-shadow .15s var(--nh-ease, cubic-bezier(.4, 0, .2, 1)),
                border-color .15s var(--nh-ease, cubic-bezier(.4, 0, .2, 1));
    box-shadow: 0 2px 6px rgba(0, 0, 0, .03);
    text-decoration: none;
    color: inherit;
    box-sizing: border-box;
    min-width: 0;
}

.nh-kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .08);
    border-color: var(--nh-primary, #6366f1);
}

.nh-kanban-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--nh-text, #0f172a);
    margin: 0 0 6px 0;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/* ── Loading ── */
.nh-kanban-loading {
    padding: 40px 20px;
    text-align: center;
    color: var(--nh-text-faint, #94a3b8);
    font-size: 14px;
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.nh-kanban-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--nh-border, #e2e8f0);
    border-top-color: var(--nh-primary, #6366f1);
    border-radius: 50%;
    animation: nh-kanban-spin .8s linear infinite;
}

@keyframes nh-kanban-spin {
    to { transform: rotate(360deg); }
}

/* ── Hint Box ── */
.nh-kanban-hint {
    padding: 12px 16px;
    background: var(--nh-primary-softer, rgba(99, 102, 241, .06));
    border: 1px solid var(--nh-primary-soft, rgba(99, 102, 241, .15));
    border-radius: 12px;
    font-size: 13px;
    color: var(--nh-text-muted, #475569);
    line-height: 1.5;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — STACKED LAYOUT
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

    /*
     * NOTE: the previous version forced `overflow-y: auto !important`
     * on html and body. The parent theme already handles viewport
     * scrolling correctly; forcing overflow on both html and body
     * created a nested scroll-container trap that broke position:
     * sticky on the header. Removed — the columns' own scroll
     * containment below is what fixes the mobile scroll issue.
     */

    /* Wrapper — no internal scroll */
    .nh-kanban {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        margin: 16px 0 !important;
        padding: 0 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        max-height: none !important;
        height: auto !important;
    }

    /* Board — stack columns vertically */
    .nh-kanban-board {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        max-height: none !important;
        height: auto !important;
    }

    /*
     * Columns — full width, natural height, no internal scroll.
     * The parent theme's max-height: 620px + overflow: hidden are
     * what trapped the scroll on mobile; these overrides remove
     * that containment. Narrowed the ancestor chain that this rule
     * touches — the previous version mutated #content, main, and
     * other containers that legitimately need overflow: hidden
     * (auth modals, mobile drawer, sticky elements).
     */
    .nh-kanban-col {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        flex: 1 1 auto !important;
        padding: 14px !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        max-height: none !important;
        height: auto !important;
        min-height: 0 !important;
    }

    /* Column header */
    .nh-kanban-col-head,
    .nh-kanban-col > h3 {
        font-size: 15px !important;
        padding-bottom: 10px !important;
        margin-bottom: 10px !important;
    }

    /* Cards — full width, wrap text */
    .nh-kanban-card {
        padding: 14px 16px !important;
        min-height: 60px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        -webkit-user-select: none !important;
        user-select: none !important;
        -webkit-touch-callout: none !important;
    }

    .nh-kanban-card-title {
        font-size: 15px !important;
        line-height: 1.45 !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        max-height: none !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    /* Hint box at the bottom */
    .nh-kanban-hint {
        padding: 10px 14px !important;
        font-size: 12px !important;
        text-align: center !important;
        order: 999 !important;
    }

    /* Header — allow stats to wrap onto their own line */
    .nh-kanban-head {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 12px 14px !important;
        gap: 8px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .nh-kanban-stats {
        font-size: 11px !important;
        order: 3 !important;
        flex-basis: 100% !important;
        text-align: center !important;
        padding-top: 6px !important;
        border-top: 1px dashed var(--nh-border, #e2e8f0) !important;
    }

    .nh-kanban-refresh {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   DARK MODE
   ───────────────────────────────────────────────────────────
   Every color above resolves through --nh-* tokens, which
   html.nh-dark and body.noteshub-dark-default swap at runtime.
   The only explicit override needed is the drop shadow — the
   light-mode alpha was calibrated for white surfaces and looks
   weak on dark.
   ═══════════════════════════════════════════════════════════ */

html.nh-dark .nh-kanban-head,
body.noteshub-dark-default .nh-kanban-head {
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

html.nh-dark .nh-kanban-card,
body.noteshub-dark-default .nh-kanban-card {
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}

html.nh-dark .nh-kanban-card:hover,
body.noteshub-dark-default .nh-kanban-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, .5);
}

/* ═══════════════════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════════════════ */

@media print {
    .nh-kanban-refresh,
    .nh-kanban-hint {
        display: none !important;
    }
    .nh-kanban,
    .nh-kanban-head,
    .nh-kanban-col,
    .nh-kanban-card {
        box-shadow: none !important;
        border-color: #ccc !important;
    }
    .nh-kanban-board {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .nh-kanban-col,
    .nh-kanban-card {
        break-inside: avoid;
    }
}