/* Container styling for the overall layout */
.container {
    border: 1px solid #d6d6d6;
    padding: 0;
    min-height: 256px;
    text-align: center;
    box-sizing: border-box;
}

/* Styling for the container holding available images */
#left-container {
    background-color: lightgray;
    border-radius: 5px;
    padding: 0;
    overflow-y: auto;
    max-height: 100vh;
    box-sizing: border-box;
}

/* Increase top padding for the left container to ensure space when cards zoom */
#left-container {
    padding-top: 2px;
    padding-left: 2px;
    padding-right: 2px;
    padding-bottom: 2px;
}

/* Styling for the draggable cards */
.card {
    cursor: pointer;
    position: relative;
    border: 1px solid #c7c7c7;
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.3s, z-index 0.3s, opacity 0.3s;
    margin: 2px;
    box-sizing: border-box;
    opacity: 1;
}

.card img.small {
    width: 100%; /* Ensure the small image fits the card size */
    height: 100%;
    object-fit: cover;
}

.card img.large {
    width: 100%; /* Ensure the large image fits the card size */
    height: 100%;
    object-fit: cover;
}

/* Hover effect for cards */
.card:hover {
    transform: scale(1.55);
    border: 2px solid #c1c1c1;
    z-index: 1000; /* Ensure it appears on top */
    opacity: 1; /* Ensure full opacity when hovered */
}

.card.zoom-inward-top-left:hover {
    transform-origin: top left;
}

.card.zoom-inward-top-right:hover {
    transform-origin: top right;
}

.card.zoom-inward-bottom-left:hover {
    transform-origin: bottom left;
}

.card.zoom-inward-bottom-right:hover {
    transform-origin: bottom right;
}

.card.zoom-inward-top:hover {
    transform-origin: top center;
}

.card.zoom-inward-bottom:hover {
    transform-origin: bottom center;
}

.card.zoom-inward-left:hover {
    transform-origin: center left;
}

.card.zoom-inward-right:hover {
    transform-origin: center right;
}

/* Disable zoom for cards in the dropzone */
.dropzone .card:hover {
    transform: none; /* Disable zoom */
    z-index: auto; /* Reset z-index to default */
}

/* Styling for the drop zones */
.dropzone {
    border: 1px dashed #c8c8c8;
    width: 384px;  /* Fixed width for large dropzones */
    height: 384px; /* Fixed height for large dropzones */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 50px;
    font-weight: bold;
    color: #aaa;
    margin: 2px;
    box-sizing: border-box;
    background-color: #e8e8e8;
}

/* Placeholder text for empty drop zones */
.dropzone.empty::before {
    content: attr(data-zone);
}

/* Styling for the remove button */
.remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: red;
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 16px;
}

/* Styling for placeholders in the available images section */
.placeholder {
    width: 128px;  /* Match the width of the small card */
    height: 128px; /* Match the height of the small card */
    border: 1px dashed #c8c8c8;
    margin: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f8f8f8;
    opacity: 1;
    position: relative;
}

.placeholder.empty {
    background: #f8f8f8;
}

.placeholder.selected {
    border-color: #0d6efd;
    background: #f0f6ff;
}

.placeholder.selected::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.9rem;
    color: #0d6efd;
    font-weight: bold;
}

/* Wrapper for the available cards, allowing for scrolling */
.card-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    justify-content: center;
}

/* Wrapper for the dropzones */
.dropzone-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0;
    overflow-x: hidden; /* Prevent horizontal scroll */
    gap: 0.2rem;
}

/* Styling for the heading */
h5 {
    font-size: 2.5em; /* Increased font size for the heading */
    font-weight: bold;
    margin-bottom: 20px; /* Increased bottom margin for more spacing */
    color: #333;
}

/* Button styling */
.btn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

/* Floating right part */
.floating-right {
    position: sticky;
    top: 0;
    background-color: white;
    padding: 0;
    border-radius: 7px;
    max-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

.selection-panel {
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 8px;
}

.selection-header .badge {
    font-size: 0.95rem;
    border: 1px solid #d0d0d0;
}

/* No hover effect for the overview cards */
.no-hover .card:hover {
    transform: none; /* Disable scaling on hover */
    border: 1px solid #ccc; /* Maintain the same border width */
    z-index: auto; /* Reset z-index */
    opacity: 1; /* Keep full opacity */
}

.finalize-btn {
    width: 100%;
}

@media (min-width: 992px) {
    .finalize-btn {
        width: auto;
        min-width: 200px;
    }
}

/* Mobile optimizations */
@media (max-width: 767.98px) {
    .container {
        border: none;
        padding: 0.25rem;
    }

    #left-container {
        max-height: none;
        padding: 0.5rem;
    }

    .floating-right {
        position: static;
        max-height: none;
        padding: 0.5rem;
        border: 1px solid #e5e5e5;
    }

    h5 {
        font-size: 1.35rem;
        margin-bottom: 0.75rem;
    }

    .card-wrapper {
        gap: 0.3rem;
    }

    .placeholder {
        width: 96px;
        height: 96px;
        margin: 1.5px;
    }

    .selection-panel {
        position: sticky;
        top: 0;
        z-index: 1020;
        border: 1px solid #e5e5e5;
        background: #fff;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
    }

    .dropzone {
        width: 86px;
        height: 86px;
        margin: 1.5px;
        font-size: 1rem;
        flex: 0 0 auto;
    }

    .dropzone-wrapper {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.4rem;
        gap: 0.3rem;
    }

    .dropzone-wrapper::-webkit-scrollbar {
        height: 6px;
    }

    .dropzone-wrapper::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 8px;
    }

    .card:hover {
        transform: none;
        border: 1px solid #ccc;
    }

    .mobile-hint {
        font-size: 0.9rem;
    }
}

.card-context-menu {
    position: fixed;
    z-index: 2500;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    min-width: 140px;
}

.card-context-menu .context-action {
    width: 100%;
    border: none;
    background: transparent;
    border-radius: 6px;
    text-align: left;
    padding: 6px 8px;
    font-size: 0.9rem;
}

.card-context-menu .context-action:hover {
    background: #f1f5ff;
}

.card-zoom-overlay {
    position: fixed;
    inset: 0;
    z-index: 2400;
    background: rgba(0, 0, 0, 0.68);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.card-zoom-overlay img {
    max-width: min(88vw, 680px);
    max-height: 88vh;
    border: 2px solid #fff;
    border-radius: 10px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.5);
}

/* Landing page */
.landing-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fbff 0%, #eef3ff 100%);
}

.landing-page .container {
    border: none;
    padding: 0;
    min-height: auto;
    text-align: left;
}

.landing-page h2.h5 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
    color: #212529;
}

.landing-page .login-panel .h5 {
    font-size: 1.25rem;
    margin-bottom: 0;
}

.landing-hero,
.login-panel {
    background: #fff;
    border: 1px solid #e6ebf5;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(35, 58, 98, 0.07);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.app-tile {
    aspect-ratio: 1 / 1;
    border: 1px solid #d9e2f5;
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: #fdfefe;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    color: #212529;
}

.app-tile:hover {
    transform: translateY(-3px);
    border-color: #0d6efd;
    box-shadow: 0 12px 18px rgba(13, 110, 253, 0.15);
}

.tile-icon {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    background: #f4f7ff;
    color: #0d6efd;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.85rem;
    border: 1px solid #e1e8f7;
    font-size: 2rem;
}



.app-grid-fixed-four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-tile-tba {
    border-style: dashed;
    color: #5f6b7a;
    background: #f9fbff;
}

.tile-image {
    width: 72px;
    height: 72px;
    margin-bottom: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tile-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

@media (max-width: 574px) {
    .app-grid-fixed-four {
        grid-template-columns: 1fr;
    }
}


.selection-actions {
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, #fff 70%, rgba(255, 255, 255, 0.85));
    padding-top: 0.5rem;
    z-index: 4;
}

.gallery-toolbar {
    display: grid;
    grid-template-columns: 1fr 180px auto;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem;
}

.selected-in-gallery {
    opacity: 0.35;
    visibility: visible !important;
}

.selected-in-gallery::after {
    content: '✓ Selected';
    position: absolute;
    inset: auto 6px 6px auto;
    background: rgba(13, 110, 253, 0.9);
    color: #fff;
    font-size: 0.7rem;
    border-radius: 999px;
    padding: 2px 8px;
}

.placeholder.hidden-by-filter {
    display: none;
}

#left-container::-webkit-scrollbar,
.floating-right::-webkit-scrollbar,
.dropzone-wrapper::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

#left-container::-webkit-scrollbar-thumb,
.floating-right::-webkit-scrollbar-thumb,
.dropzone-wrapper::-webkit-scrollbar-thumb {
    background: #aab3c0;
    border-radius: 999px;
    border: 2px solid #eef1f6;
}

@media (max-width: 767.98px) {
    .gallery-toolbar {
        grid-template-columns: 1fr;
    }

    .selection-actions {
        position: sticky;
        bottom: 0;
        padding-bottom: 0.35rem;
    }
}

.card-labels-table-wrapper {
    overflow: hidden;
}

.label-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 1rem;
}

.label-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.label-checkbox-item .form-check-input {
    margin-top: 0;
    flex: 0 0 auto;
}

.label-checkbox-item .form-check-label {
    font-size: 0.9rem;
    line-height: 1.2;
}

.card-label-preview {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 1px solid #d6d6d6;
    border-radius: 6px;
}
