/* Layout (header, sidebar, footer) comes from AdminLTE; this file only adds page-specific styles. */

/* Bootstrap's display utilities (d-flex etc.) are !important and come after its [hidden] rule,
   so <div class="d-flex" hidden> would still show. Scripts toggle visibility with el.hidden. */
[hidden] {
    display: none !important;
}

/* ── Cards & tables ──────────────────────────────────────────────── */
.stat-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bs-secondary-color);
}

.thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: .375rem;
}

.text-truncate-300 {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.placeholder-row td {
    color: var(--bs-secondary-color);
    text-align: center;
    padding: 2rem .5rem;
}

/* Loading / empty / error messages aren't data rows: no stripe or hover highlight. */
.table > tbody > tr.placeholder-row > * {
    --bs-table-bg-type: transparent;
    --bs-table-bg-state: transparent;
}

/* ── Chat ────────────────────────────────────────────────────────── */
/* Fills the window below the header and above the footer, minus the page title. */
.chat-shell {
    height: calc(100vh - 220px);
    min-height: 420px;
}

.chat-list {
    width: 300px;
    min-width: 260px;
    flex-shrink: 0;
}

.chat-conv {
    cursor: pointer;
    padding: .75rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.chat-conv:hover {
    background: var(--bs-tertiary-bg);
}

.chat-conv.active {
    background: var(--bs-primary-bg-subtle);
}

.chat-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    background: var(--bs-primary);
}

.chat-avatar.sm {
    width: 28px;
    height: 28px;
    font-size: .8rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.chat-bubble {
    max-width: 65%;
    padding: .5rem .75rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
    border-radius: 2px 12px 12px 12px;
}

.chat-bubble.mine {
    background: var(--bs-primary-bg-subtle);
    border-radius: 12px 2px 12px 12px;
}

.chat-bubble .text {
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-bubble img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    display: block;
    margin-top: 4px;
}

@media (max-width: 767.98px) {
    .chat-list {
        width: 100%;
        min-width: 0;
    }
}

/* ── Product form: variant image picker ─────────────────────────── */
.vi-label {
    width: 7rem;
    font-weight: 500;
}

.vi-thumb {
    width: 3rem;
    height: 3rem;
    padding: 0;
    border: 2px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    background: var(--bs-light);
    color: var(--bs-secondary-color);
    font-size: .75rem;
    overflow: hidden;
}

.vi-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vi-thumb.selected {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .25);
}

.sku-thumb {
    width: 2.25rem;
    height: 2.25rem;
    object-fit: cover;
    border-radius: var(--bs-border-radius-sm);
}

/* ── Page blocker (block-ui.js) ──────────────────────────────────── */
/* Blocks clicks at once; the dimming and spinner fade in after a moment so quick saves don't flash. */
.page-blocker {
    position: fixed;
    inset: 0;
    z-index: 2000; /* above modals (1055), so a modal's own buttons are blocked too */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: progress;
    background: rgba(var(--bs-body-bg-rgb), .55);
    animation: page-blocker-in .2s ease-out .25s both;
}

.page-blocker-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1.75rem;
    border-radius: var(--bs-border-radius-lg);
    background: var(--bs-body-bg);
    box-shadow: var(--bs-box-shadow);
}

.page-blocker-text {
    color: var(--bs-secondary-color);
    font-size: .875rem;
}

@keyframes page-blocker-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .page-blocker { animation-duration: 0s; }
}

/* ── Categories: image picker ───────────────────────────────────── */
.category-image-preview {
    width: 6rem;
    height: 6rem;
    flex-shrink: 0;
    overflow: hidden;
}

.category-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
