.gallery-grid-wrapper { padding: 5rem 2rem; max-width: 1400px; margin: 0 auto; background: transparent !important; }
.gallery-category-title { grid-column: 1 / -1; margin-top: 4rem; margin-bottom: 2rem; padding-bottom: 1rem; display: flex; flex-direction: column; align-items: center; text-align: center; border: none; }
.gallery-category-title h2 { font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 800; color: var(--text); margin: 0; position: relative; display: inline-block; background: linear-gradient(to right, var(--text), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.gallery-category-title h2::after { content: ''; position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); width: 80px; height: 4px; background: var(--accent); border-radius: 4px; }

/* Grid Layout */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; grid-auto-flow: dense; }

.grid-item { border-radius: var(--radius-md); overflow: hidden; position: relative; box-shadow: var(--shadow-sm); transition: var(--transition-spring); background: var(--surface-glass); border: var(--glass-border); backdrop-filter: blur(15px); cursor: pointer; aspect-ratio: 4/3; }
.grid-item img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    display: block; 
    transition: transform 0.8s cubic-bezier(0.2, 1, 0.3, 1), filter 0.5s ease; 
    opacity: 0.92;
    image-rendering: -webkit-optimize-contrast;
    filter: contrast(1.05) brightness(1.02) saturate(1.02);
}
.grid-item:hover { transform: translateY(-8px) scale(1.02); box-shadow: var(--shadow-xl); z-index: 5; border-color: var(--accent); }
.grid-item:hover img { transform: scale(1.1); opacity: 1; filter: contrast(1.1) brightness(1.05) saturate(1.1); }

/* Image Overlay Styling */
.grid-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(10, 15, 30, 0.95) 0%, rgba(10, 15, 30, 0.4) 40%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
    opacity: 1;
    transition: all 0.4s ease;
}

.overlay-content {
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.grid-item:hover .overlay-content {
    transform: translateY(-5px);
}

.overlay-title {
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0 0 0.4rem 0;
    letter-spacing: -0.01em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.overlay-desc {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 400;
}

/* Edit Mode Styles */
.edit-mode-active .gallery-category-title { cursor: grab !important; position: relative; }
.edit-mode-active .gallery-category-title::before { content: '↕ Drag to reorder category'; position: absolute; left: 0; top: -20px; font-size: 0.75rem; color: var(--accent); font-weight: 600; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.edit-mode-active .gallery-category-title:hover::before { opacity: 1; }
.edit-mode-active .gallery-category-title:active { cursor: grabbing !important; }

.edit-mode-active .grid-item { cursor: grab !important; border: 2px solid transparent; }
.edit-mode-active .grid-item:active { cursor: grabbing !important; transform: scale(1.02); box-shadow: var(--shadow-xl); border-color: var(--accent); }
.edit-mode-active .grid-item::after { content: '↕ Drag to reorder'; position: absolute; bottom: 10px; left: 10px; background: rgba(0,0,0,0.7); color: white; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; pointer-events: none; opacity: 0.8; }

.btn-delete { position: absolute; top: 10px; right: 10px; background: #ef4444; color: white; border: none; padding: 6px; border-radius: 6px; cursor: pointer; display: none; z-index: 10; opacity: 0.9; transition: 0.2s; }
.btn-delete:hover { opacity: 1; background: #dc2626; transform: scale(1.1); }
.edit-mode-active .btn-delete { display: block; }

.upload-zone { border: 2px dashed var(--accent); border-radius: var(--radius-md); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--accent); cursor: pointer; background: rgba(99, 102, 241, 0.05); transition: 0.3s; aspect-ratio: 4/3; display: none; }
.upload-zone:hover, .upload-zone.drag-over { background: rgba(99, 102, 241, 0.15); }
.edit-mode-active .upload-zone { display: flex; }
.upload-zone input { display: none; }

.sortable-ghost { opacity: 0.4; border: 2px dashed var(--accent) !important; transform: scale(0.95); }

#toast { position: fixed; bottom: 2rem; right: 2rem; z-index: 9999; background: #22c55e; color: #fff; padding: 0.85rem 1.5rem; border-radius: 10px; font-weight: 600; font-size: 0.9rem; box-shadow: 0 8px 30px rgba(0,0,0,0.3); transform: translateY(100px); opacity: 0; transition: all 0.3s; pointer-events: none; }
#toast.show { transform: translateY(0); opacity: 1; }
#toast.error { background: #ef4444; }

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 46px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #475569; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(22px); }

.header-upload-btn {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--accent);
    transition: all 0.3s ease;
}

.header-upload-btn:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.1);
}
