/* ==========================================================================
   Global Filament Layout Overrides
   Applied on all admin pages via render hook
   ========================================================================== */

/* Reduce gap between topbar and page content (Filament's py-8 → 1rem) */
.fi-page > section.py-8,
.fi-main section.py-8 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

/* Reduce content area padding */
.fi-layout .fi-main-ctn .md\:px-6 {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
}
.fi-layout .fi-main-ctn .lg\:px-8 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

/* Tighten the left sidebar */
.fi-layout .fi-sidebar {
    width: 13rem !important;
}
.fi-layout .fi-sidebar .fi-sidebar-nav {
    padding-left: 1.5rem !important;
    padding-right: 0 !important;
}

/* Reduce vertical spacing between sidebar nav groups */
.fi-layout .fi-sidebar .fi-sidebar-group {
    gap: 0 !important;
}
.fi-layout .fi-sidebar .fi-sidebar-group + .fi-sidebar-group {
    margin-top: 0.5rem !important;
}
.fi-layout .fi-sidebar .fi-sidebar-nav > ul {
    gap: 0.5rem !important;
}

/* ---------------------------------------------------------------------------
   Chat Image Preview & Lightbox (used in entity chat + messenger)
   --------------------------------------------------------------------------- */
.chat-img-wrap {
    position: relative;
    display: inline-block;
    max-width: 400px;
}
.chat-img-preview {
    display: block;
    max-width: 400px;
    max-height: 300px;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    object-fit: cover;
    transition: opacity 0.15s;
}
.chat-img-preview:hover {
    opacity: 0.85;
}
.dark .chat-img-preview {
    border-color: #374151;
}
.chat-img-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.25rem;
    font-size: 0.6875rem;
    color: #9ca3af;
}
.chat-img-dl {
    color: #9ca3af;
    transition: color 0.15s;
}
.chat-img-dl:hover {
    color: #6b7280;
}

/* Lightbox */
.chat-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}
.chat-lightbox__img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 0.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    cursor: default;
}
.chat-lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}
.chat-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.3);
}
