/* ==========================================================================
   CATÁLOGO INTERNO / GALLERY MODAL - COMPACT & DARK PREMIUM THEME
   Hanuthai Fight Official Design System
   ========================================================================== */

/* OVERLAY */
#gallery-modal.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    animation: galleryFadeIn 0.2s ease-out;
}

@keyframes galleryFadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* MODAL CONTENT CONTAINER */
#gallery-modal .modal-content {
    background: #141419 !important;
    border: 1px solid rgba(212, 175, 55, 0.45) !important;
    border-radius: 14px !important;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.85), 0 0 25px rgba(212, 175, 55, 0.15) !important;
    width: min(920px, 94vw) !important;
    max-width: 95vw !important;
    max-height: 88vh !important;
    padding: 18px 22px !important;
    box-sizing: border-box !important;
    color: #e2e8f0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    transition: width 0.3s ease, max-height 0.3s ease !important;
}

/* HEADER */
#gallery-modal .modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 10px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

#gallery-modal .modal-header h3 {
    margin: 0 !important;
    color: #D4AF37 !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-family: 'Outfit', sans-serif !important;
}

#gallery-modal .modal-header h3::before {
    content: "📁";
    font-size: 1.1rem;
}

#gallery-modal .modal-header button {
    background: #1f1f28 !important;
    color: #9ca3af !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 6px !important;
    width: 28px !important;
    height: 28px !important;
    font-size: 0.85rem !important;
    font-weight: bold !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
    line-height: 1 !important;
}

#gallery-modal .modal-header button:hover {
    background: #e11d48 !important;
    border-color: #f43f5e !important;
    color: #ffffff !important;
    transform: scale(1.05);
}

/* SEARCH BAR CONTAINER & INPUT */
#gallery-modal .gallery-search-container {
    padding: 0 0 10px 0 !important;
}

.gallery-search-bar {
    width: 100% !important;
    padding: 8px 12px !important;
    font-size: 0.85rem !important;
    color: #f8fafc !important;
    background: #0d0d12 !important;
    border: 1px solid rgba(212, 175, 55, 0.3) !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
    outline: none !important;
    transition: all 0.2s ease !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4) !important;
    font-family: inherit !important;
}

.gallery-search-bar::placeholder {
    color: #64748b !important;
}

.gallery-search-bar:focus {
    border-color: #D4AF37 !important;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.4) !important;
}

/* GRID CONTAINER */
.gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)) !important;
    gap: 12px !important;
    max-height: 60vh !important;
    overflow-y: auto !important;
    padding: 6px 4px 6px 0 !important;
}

.gallery-grid.customizing-mode {
    display: block !important;
    max-height: none !important;
    overflow-y: visible !important;
    padding: 0 !important;
}

#gallery-modal .modal-content:has(.gallery-customizer-wrap) {
    max-height: 94vh !important;
    overflow-y: auto !important;
}

/* CUSTOM SCROLLBAR FOR GALLERY */
.gallery-grid::-webkit-scrollbar {
    width: 6px;
}
.gallery-grid::-webkit-scrollbar-track {
    background: #0f0f14;
    border-radius: 4px;
}
.gallery-grid::-webkit-scrollbar-thumb {
    background: #2a2a38;
    border-radius: 4px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}
.gallery-grid::-webkit-scrollbar-thumb:hover {
    background: #D4AF37;
}

/* CONDENSED FOLDERS */
.gallery-folder {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 8px !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    background: #191922 !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
    user-select: none !important;
    min-height: 125px !important;
}

.gallery-folder:hover {
    background: #232330 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4), 0 0 10px rgba(212, 175, 55, 0.2) !important;
    border-color: #D4AF37 !important;
}

.folder-icon-wrapper {
    width: 72px !important;
    height: 72px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.07) !important;
    border-radius: 8px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    margin-bottom: 8px !important;
    overflow: hidden !important;
    padding: 4px !important;
    box-sizing: border-box !important;
}

.folder-image-icon {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    border-radius: 4px !important;
}

.folder-fallback-icon {
    font-size: 2.2rem !important;
    line-height: 1 !important;
}

.folder-label {
    font-size: 0.80rem !important;
    font-weight: 700 !important;
    color: #e2e8f0 !important;
    text-align: center !important;
    line-height: 1.25 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    font-family: inherit !important;
}

.folder-subcount {
    font-size: 0.72rem !important;
    color: #94a3b8 !important;
    font-weight: 600 !important;
    margin-top: 3px !important;
    text-align: center !important;
}

/* BACK BUTTON */
.gallery-back-btn {
    width: 100% !important;
    text-align: left !important;
    margin-bottom: 8px !important;
    padding: 6px 12px !important;
    background: #1e1e28 !important;
    border: 1px solid rgba(212, 175, 55, 0.3) !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    font-size: 0.78rem !important;
    color: #D4AF37 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: all 0.2s ease !important;
}

.gallery-back-btn:hover {
    background: #D4AF37 !important;
    color: #0b0b0f !important;
    border-color: #f59e0b !important;
}

/* COLOR PALETTE TOOLBAR FOR SOLID ARTS (SIMULATOR STYLE) */
.gallery-color-bar {
    grid-column: 1 / -1 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    background: #0f1015 !important;
    border: 1px solid rgba(212, 175, 55, 0.3) !important;
    border-radius: 8px !important;
    padding: 6px 12px !important;
    margin-bottom: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

.gallery-color-info {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.gallery-color-title {
    font-size: 0.70rem !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.gallery-color-active-name {
    font-size: 0.72rem !important;
    font-weight: 800 !important;
    color: #D4AF37 !important;
    letter-spacing: 0.5px !important;
}

.gallery-color-swatches {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    flex-wrap: wrap !important;
}

.gallery-color-dot {
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    border: 2px solid #2a3142 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    outline: none !important;
    padding: 0 !important;
}

.gallery-color-dot:hover {
    transform: scale(1.22) !important;
}

.gallery-color-dot.active {
    border-color: #D4AF37 !important;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.85) !important;
    transform: scale(1.18) !important;
}

/* GALLERY IMAGE ITEMS (CLEAN & UNCLUTTERED) */
.gallery-item {
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 10px 8px !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    text-align: center !important;
    background: #191922 !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    user-select: none !important;
    position: relative !important;
    min-height: 120px !important;
}

.gallery-item:hover {
    border-color: #D4AF37 !important;
    background: #232330 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45), 0 0 10px rgba(212, 175, 55, 0.25) !important;
}

.gallery-item-number {
    position: absolute !important;
    top: 6px !important;
    left: 6px !important;
    background: rgba(0, 0, 0, 0.88) !important;
    color: #D4AF37 !important;
    border: 1px solid rgba(212, 175, 55, 0.4) !important;
    font-size: 9.5px !important;
    font-weight: 800 !important;
    padding: 2px 5px !important;
    border-radius: 4px !important;
    z-index: 2 !important;
    pointer-events: none !important;
    letter-spacing: 0.3px !important;
}

.gallery-item-preview {
    width: 100% !important;
    height: 82px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.24) 0%, rgba(22, 26, 36, 0.95) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 8px !important;
    padding: 6px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

.gallery-item-preview img {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    border-radius: 4px !important;
    background: transparent !important;
    padding: 0 !important;
}

.gallery-tint-mask {
    width: 100% !important;
    height: 100% !important;
    transition: background-color 0.15s ease !important;
}

.gallery-item-label {
    display: block !important;
    font-size: 0.76rem !important;
    margin-top: 6px !important;
    color: #cbd5e1 !important;
    line-height: 1.2 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    padding: 0 2px !important;
    font-weight: 600 !important;
}

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 768px) {
    #gallery-modal .modal-content {
        width: 95vw !important;
        padding: 14px 14px !important;
        max-height: 90vh !important;
    }
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
        gap: 8px !important;
        max-height: 60vh !important;
    }
    .folder-icon-wrapper {
        width: 60px !important;
        height: 60px !important;
    }
    .gallery-item-preview {
        height: 68px !important;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important;
        gap: 6px !important;
    }
    .folder-icon-wrapper {
        width: 50px !important;
        height: 50px !important;
    }
    .gallery-item-preview {
        height: 58px !important;
    }
    .folder-label {
        font-size: 0.72rem !important;
    }
    .gallery-item-label {
        font-size: 0.70rem !important;
    }
}