/* Custom Image Modal */
.img-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    /* Less dark */
    backdrop-filter: blur(4px);
    /* Faded effect */
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.img-modal-details {
    flex-shrink: 0;
    margin-top: 15px;
    text-align: left;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.img-modal-details p {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #333;
    overflow-wrap: break-word;
    word-break: break-word;
}

.img-modal-details strong {
    color: #0F44B6;
}

.img-modal-content {
    position: relative;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
}

.img-modal-content img {
    max-width: 100%;
    max-height: 65vh;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
}

.img-modal-close {
    position: absolute;
    top: -15px;
    right: -15px;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 0;
    padding-bottom: 3px;
}

/* Category Badges */
.category-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-weight: 700 !important;
    letter-spacing: 0.5px;
    padding: 10px 18px !important;
    border-radius: 6px !important;
    text-transform: uppercase;
    font-size: 13px !important;
    margin: 0 6px 12px 6px;
    border: none !important;
    transition: transform 0.2s;
    max-width: 100%;
    /* Ensure button doesn't exceed screen width */
    overflow: hidden;
    /* Contains any overflow */
}

.category-btn:hover {
    transform: translateY(-2px);
}

.category-badge {
    background-color: #fff !important;
    color: #333 !important;
    margin-left: 10px;
    padding: 2px 8px !important;
    border-radius: 4px !important;
    font-size: 12px;
    flex-shrink: 0;
    /* Prevents badge from shrinking */
    display: inline-block;
}

/* Mobile specific adjustments to prevent overflow */
@media (max-width: 767px) {
    .category-btn {
        font-size: 11px !important;
        padding: 8px 12px !important;
        margin: 0 4px 10px 4px;
    }

    .category-badge {
        margin-left: 6px;
        padding: 2px 6px !important;
        font-size: 10px;
        line-height: 1;
    }
}

.btn-dark .category-badge {
    background-color: #6c757d !important;
    /* Grey background for badge in dark button */
    color: #fff !important;
}

.category-btn.inactive {
    opacity: 0.25;
    filter: grayscale(0.6);
}

.category-btn.active {
    transform: scale(1.08);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
    z-index: 2;
}

/* Fix for dark button becoming white when active */
.btn-dark.category-btn.active {
    background-color: #111 !important;
    color: #fff !important;
}

/* Modal optimizations for small/short screens */
@media (max-width: 500px),
(max-height: 600px) {
    .img-modal-content {
        padding: 10px;
    }

    .img-modal-content img {
        max-height: 45vh;
    }

    .img-modal-details {
        margin-top: 10px;
        padding-top: 5px;
    }

    .img-modal-details p {
        font-size: 12px;
        margin-bottom: 3px;
    }

    .img-modal-close {
        width: 25px;
        height: 25px;
        font-size: 16px;
        top: -10px;
        right: -10px;
    }
}

/* Product Table Optimization */
#dtBasicExample th:first-child,
#dtBasicExample td:first-child {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 50px !important;
    text-align: center;
}

#dtBasicExample th {
    white-space: normal !important;
    text-align: center;
    vertical-align: middle !important;
}

#dtBasicExample td {
    vertical-align: middle !important;
}

/* UX: Enhanced Row Hover Effect */
#dtBasicExample tbody tr:hover td {
    background-color: #e2efff !important; /* Deeper blue highlight for visibility */
    color: #000 !important; /* Darker text on hover */
    cursor: pointer !important; /* Change cursor to pointer */
    transition: all 0.15s ease;
}

/* Enable clean horizontal scrolling on smaller viewports */
@media (max-width: 991px) {
    #dtBasicExample {
        min-width: 1000px !important;
    }
}