/* ==========================
   StudioElf Bookshelf - Module.css
   Cleaned, consolidated and complete (includes color picker)
   ========================== */

/* --------------------------
   Theme variables (easy to tweak)
   -------------------------- */
:root {
    --bookshelf-gap: 1rem;
    --bookshelf-card-radius: 1rem;
    --bookshelf-card-border: #e6e6e6;
    --bookshelf-reading-bg: #ffffff;
    --bookshelf-reading-color: #212529;
    --bookshelf-muted: #575757;
    --bookshelf-shadow: 0 4px 10px rgba(0,0,0,0.08);
    --bookshelf-warning: #fff3cd;
    --bookshelf-primary: #0d6efd;
    --swatch-size: 28px;
    --swatch-gap: .5rem;
}

/* ==========================
   Layout & Panels
   ========================== */
.bookshelf-container {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
}

.bookshelf-sidepanel {
    border-right: 1px solid var(--bookshelf-card-border);
    background-color: #f8f9fa;
    min-height: 80vh;
    overflow-y: auto;
    padding: 1rem;
}

.bookshelf-wrapper {
    background-color: #fff;
    border-radius: 1rem;
    padding: 1.25rem;
}

/* ==========================
   Reading pane
   - Fluid (no explicit scrollbars), rounded corners, sticky header
   ========================== */
.bookshelf-reading-pane {
    /* background-color: var(--bookshelf-reading-bg);
       color: var(--bookshelf-reading-color); */
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* full height of column */
    border-radius: var(--bookshelf-card-radius);
    box-shadow: var(--bookshelf-shadow);
    overflow: hidden; /* avoid secondary scrollbars inside the card */
}

    /* sticky header sits on top of the pane content (module theme may also use sticky) */
    .bookshelf-reading-pane .bookshelf-sticky-header {
        position: sticky;
        top: calc(var(--bs-navbar-height, 56px) + 8px);
        z-index: 1060;
        background-color: inherit;
        padding: .75rem 1rem;
        border-bottom: 1px solid rgba(0,0,0,0.06);
        border-top-left-radius: var(--bookshelf-card-radius);
        border-top-right-radius: var(--bookshelf-card-radius);
    }

    /* content fills remaining space and scrolls internally if too large */
    .bookshelf-reading-pane .bookshelf-content {
        flex: 1 1 auto;
        padding: 1.25rem;
        overflow: auto;
        background-clip: padding-box;
        border-bottom-left-radius: var(--bookshelf-card-radius);
        border-bottom-right-radius: var(--bookshelf-card-radius);
    }

        .bookshelf-reading-pane .bookshelf-content pre,
        .bookshelf-reading-pane .bookshelf-content code {
            display: block;
            padding: .5rem;
            border-radius: .25rem;
            background-color: #f8f9fa;
            overflow-x: auto;
        }

        .bookshelf-reading-pane .bookshelf-content img {
            max-width: 100%;
            height: auto;
            border-radius: .25rem;
            margin: .5rem 0;
        }

.audit-footer {
    margin-top: auto; /* push to bottom */
    padding: .75rem 1rem;
    background-color: inherit;
}

    /* ==========================
   Grid cards (shelves & books)
   ========================== */
    .grid {
    display: grid;
    gap: var(--bookshelf-gap);
}

    .grid.third {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }

/* card */
.grid-card {
    display: flex;
    flex-direction: column;
    /*background: #fff;*/
    border-radius: var(--bookshelf-card-radius);
    border: 1px solid var(--bookshelf-card-border);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    cursor: pointer;
    min-height: 220px;
}

    .grid-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 20px rgba(0,0,0,0.08);
        border-color: var(--bs-warning);
    }

/* featured image area */
.featured-image-container-wrap {
    height: 150px;
    background-color: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* cover image */

.featured-image-container-shelf {
    background-repeat: no-repeat;
    width: 100%;
    height: 100%;
    transition: opacity .24s ease-in-out;
    background-size: contain;
    background-position: right;
}
.featured-image-container-book {
    background-repeat: no-repeat;
    width: 100%;
    height: 100%;
    transition: opacity .24s ease-in-out;
    background-size: contain;
    background-position: center;
}
/* optional overlay icon (SVG) in featured area */
.featured-image-container-wrap .svg-icon {
    position: absolute;
    bottom: 10px;
    left: 8px;
    font-size: 1.6rem;
    color: rgba(255,255,255,0.9);
    pointer-events: none;
}

/* card content & footer */
.grid-card-content {
    padding: 1rem;
    flex: 1 0 auto;
}

.grid-card-footer {
    padding: .75rem 1rem;
    border-top: 1px solid rgba(0,0,0,0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .9rem;
    color: var(--bookshelf-muted);
}

/* Add hover effects and transitions */
.grid-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

    .grid-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }

/* title truncation helper */
.text-limit-lines-2 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

/* ==========================
   Lists (chapters & pages)
   ========================== */
.list-group-item {
    transition: background-color .15s ease;
    cursor: pointer;
}

    /* hover */
    .list-group-item:hover {
/*        background-color: var(--bs-body-color);
        color: var(--bs-body-bg);*/
    }

    /* bootstrap active compatibility */
    /*.list-group-item.active {
        background-color: var(--bookshelf-primary) !important;
        color: #fff !important;
        font-weight: 600;
    }*/

    /* page selection uses warning style (your choice text-bg-warning) */
    /*.list-group-item.text-bg-warning,
    .list-group-item.selected-page {
        background-color: var(--bookshelf-warning) !important;
    }*/

/* muted helper */
.text-muted {
    color: var(--bookshelf-muted) !important;
}

/* svg icon general */
.svg-icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.125em;
    margin-inline-end: .5rem;
    fill: currentColor;
}

/* ==========================
   Buttons & btn groups
   ========================== */
.btn-bookshelf-group.gap-1 {
    gap: .25rem;
}

.btn-bookshelf.rounded-pill,
.btn-bookshelf-group .btn {
    border-radius: 50rem !important;
}

/* small visual vertical rule */
.vr {
    width: 1px;
    background-color: rgba(0,0,0,0.06);
    margin: 0 .5rem;
    align-self: stretch;
}

/* card header style used by editor/cards */
.card-header {
    font-size: 1.05rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    padding: .75rem 1rem;
}

/* tidy hover for any .card */
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

/* ==========================
   Color picker (complete, accessible)
   - .color-dropdown (container)
   - .color-grid (inner grid)
   - .color-cell (swatch)
   ========================== */

.color-dropdown {
    width: 100%;
    max-width: 320px;
    max-height: 320px;
    overflow-y: auto;
    border-radius: .5rem;
    background: #fff;
    padding: .5rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    z-index: 1050;
}

    /* grid of swatches */
    .color-dropdown .color-grid {
        display: grid;
        grid-template-columns: repeat(8, var(--swatch-size));
        gap: var(--swatch-gap);
        justify-content: start;
        align-items: center;
        padding: .5rem;
    }

/* each swatch */
.color-cell {
    width: var(--swatch-size);
    height: var(--swatch-size);
    border-radius: 6px;
    border: 2px solid #dee2e6;
    box-sizing: border-box;
    cursor: pointer;
    transition: transform .08s ease, box-shadow .12s ease, border-color .12s ease;
    outline: none;
}

    /* hover/focus */
    .color-cell:hover,
    .color-cell:focus {
        transform: scale(1.08);
        box-shadow: 0 6px 14px rgba(0,0,0,0.12);
        border-color: rgba(0,0,0,0.14);
    }

    /* selected swatch (applies when you set .selected on the element) */
    .color-cell.selected {
        box-shadow: 0 0 0 4px rgba(13,110,253,0.12), inset 0 0 0 1px rgba(0,0,0,0.08);
        border-color: rgba(13,110,253,0.6);
    }

    /* provide keyboard operability states (if you attach key handlers) */
    .color-cell:focus-visible {
        box-shadow: 0 0 0 4px rgba(13,110,253,0.12);
        border-color: rgba(13,110,253,0.6);
    }

/* label under swatches (optional) */
.color-dropdown .color-label {
    font-size: .8rem;
    color: var(--bookshelf-muted);
    margin-top: .5rem;
    text-align: left;
}

.breadcrumb {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breadcrumb-item a,
.breadcrumb-item {
    max-width: 200px; /* limit for all but last */
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    white-space: nowrap;
}

    .breadcrumb-item:last-child a,
    .breadcrumb-item:last-child {
        max-width: none; /* last crumb shows full text */
        overflow: visible;
        text-overflow: clip;
    }

/* ==========================
   Small helpers & responsive
   ========================== */

@media (max-width: 768px) {
    .grid.third {
        grid-template-columns: 1fr;
    }

    .featured-image-container-wrap {
        height: 140px;
    }

    .bookshelf-sidepanel {
        padding: .75rem;
    }

    .bookshelf-reading-pane .bookshelf-sticky-header {
        padding: .5rem;
    }
}

.hidden-visually {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
    border: 0;
    padding: 0;
    margin: -1px;
}

/* DraggableList */
.draggable-list {
    display: flex;
    flex-direction: column;
    min-height: 6.25rem; /* ~100px */
}

/* Default item */
.draggable-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.2rem;
    border-radius: var(--bs-border-radius, 0.375rem);
    border: 2px solid transparent;
    user-select: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

    /* Hover: border only, no background */
    .draggable-item:hover {
        border-color: var(--bs-primary, #0d6efd);
    }

    /* Dragging item */
    .draggable-item.dragging {
        opacity: 0.85;
        border-color: var(--bs-primary, #0d6efd);
    }

    /* Drop target */
    .draggable-item.drop-target {
        border-color: var(--bs-secondary, #6c757d);
    }



