/**
 * Alkalois Custom — Gallery stylesheet (alois_gallery shortcode)
 * =====================================
 * 1. Layout (wrap, filters, grid)
 * 2. Items (photo, video, thumbnails)
 * 3. Lightbox
 * 4. Admin drawer (filters/folders management)
 * 5. Admin popup (upload, edit media)
 * 6. Bulk upload
 * 7. Responsive
 */


/* =============================================
   1. Layout (wrap, filters, grid)
   ============================================= */

:root {
    --alois-black: #0d0d0d;
    --alois-grey: #888;
    --alois-border: #2a2a2a;
    --alois-white: #f5f5f5;
    --alois-gap: 10px;
    --alois-ease: cubic-bezier(.4, 0, .2, 1);
}

.alois-gallery-wrap {
    position: relative;
    width: 100%;
}

.alois-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 36px;
    justify-content: center;
}

.alois-filter {
    padding: 8px 22px;
    border: 1px solid white;
    border-radius: 100px;
    background: transparent;
    color: white;
    cursor: pointer;
    font-family: 'Sora', Helvetica, Arial, Lucida, sans-serif;
    text-transform: uppercase;
    color: #ffffff !important;
    font-size: 16px !important;
    font-weight: 600;
    transition: background .2s, color .2s, border-color .2s;
}

.alois-filter:hover {
    background: var(--alois-white);
    color: #111013 !important;
}

.alois-filter.active {
    background: var(--alois-white);
    color: #111013 !important;
}

.alois-gallery-grid {
    columns: var(--alois-columns, 3);
    column-gap: var(--alois-gap);
}


/* =============================================
   2. Items (photo, video, thumbnails)
   ============================================= */

.alois-photo-item {
    break-inside: avoid;
    margin-bottom: var(--alois-gap);
    overflow: hidden;
    border-radius: 15px;
}

.alois-photo-item.filtered-out {
    display: none;
}

.alois-photo-item.loading-in {
    animation: aloisFadeIn .4s var(--alois-ease) forwards;
}

@keyframes aloisFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alois-photo-inner {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    display: block;
}

.alois-photo-inner img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform .5s var(--alois-ease);
}

.alois-photo-inner:hover img {
    transform: scale(1.05);
}

.alois-photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .3s;
}

.alois-photo-inner:hover .alois-photo-overlay {
    opacity: 1;
}

.alois-photo-zoom {
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    font-weight: 300;
    transition: transform .25s;
}

.alois-photo-inner:hover .alois-photo-zoom {
    transform: scale(1.1);
    background: rgba(255, 255, 255, .15);
}

.alois-empty {
    color: var(--alois-grey);
    text-align: center;
    padding: 60px 0;
    font-size: 14px;
}

.alois-load-more-wrap {
    text-align: center;
    margin-top: 50px;
}

.alois-load-more {
    padding: 12px 48px;
    border: 1px solid var(--alois-border);
    background: transparent;
    color: var(--alois-grey);
    cursor: pointer;
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: inherit;
    transition: all .2s;
}

.alois-load-more:hover:not(:disabled) {
    background: var(--alois-white);
    color: var(--alois-black);
    border-color: var(--alois-white);
}

.alois-load-more:disabled {
    opacity: .4;
    cursor: not-allowed;
}

/* Grille miniatures (drawer manager) */
.alois-thumb-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.alois-thumbs-loading {
    color: #555;
    font-size: 13px;
    text-align: center;
    padding: 40px 0;
    grid-column: 1/-1;
}

.alois-thumb-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #1a1a1a;
    cursor: pointer;
}

.alois-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}

.alois-thumb-item:hover img {
    transform: scale(1.05);
}

.alois-thumb-actions {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    transition: opacity .2s;
}

.alois-thumb-item:hover .alois-thumb-actions {
    opacity: 1;
}

.alois-thumb-edit,
.alois-thumb-delete {
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .3);
    color: #fff;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s, border-color .2s;
    border-radius: 4px;
}

.alois-thumb-edit:hover {
    background: rgba(255, 255, 255, .25);
    border-color: #fff;
}

.alois-thumb-delete:hover {
    background: rgba(220, 50, 50, .4);
    border-color: rgba(220, 50, 50, .8);
}


/* =============================================
   3. Lightbox
   ============================================= */

.alois-add-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: var(--alois-white);
    color: var(--alois-black);
    border: none;
    padding: 14px 24px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    z-index: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .35);
    transition: transform .2s, box-shadow .2s;
}

.alois-add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
}

.alois-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    align-items: center;
    justify-content: center;
}

.alois-popup.open {
    display: flex;
}

.alois-popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .92);
    cursor: pointer;
    backdrop-filter: blur(4px);
}

.alois-popup-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 92vw;
    max-height: 66vh;
    animation: popupIn .3s var(--alois-ease);
}

@keyframes popupIn {
    from {
        opacity: 0;
        transform: scale(.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.alois-popup-close {
    position: absolute;
    top: -44px;
    right: 0;
    background: none;
    border: none;
    color: rgba(255, 255, 255, .6);
    font-size: 36px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color .2s;
}

.alois-popup-close:hover {
    color: #fff;
}

.alois-popup-img-wrap img {
    max-width: 82vw;
    max-height: 72vh;
    object-fit: contain;
    display: block;
}

.alois-popup-info {
    color: #fff;
    text-align: center;
    padding: 18px 0 0;
    max-width: 640px;
    width: 100%;
}

.alois-popup-info h3 {
    font-size: 15px;
    margin: 0 0 8px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 400;
}

.alois-popup-info p {
    font-size: 13px;
    color: rgba(255, 255, 255, .6);
    margin: 0;
    line-height: 1.6;
}


/* =============================================
   4. Admin drawer (filters/folders management)
   ============================================= */

.alois-drawer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 8000;
}

.alois-drawer.open {
    display: block;
}

.alois-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(2px);
}

.alois-drawer-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 440px;
    max-width: 100vw;
    background: #fff;
    z-index: 1;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .38s var(--alois-ease);
    box-shadow: -8px 0 40px rgba(0, 0, 0, .2);
}

.alois-drawer.open .alois-drawer-panel {
    transform: translateX(0);
}

.alois-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 18px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.alois-drawer-header h3 {
    margin: 0;
    font-size: 14px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 500;
    color: var(--alois-black);
}

.alois-drawer-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0 4px;
    transition: color .2s;
}

.alois-drawer-close:hover {
    color: var(--alois-black);
}

.alois-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scrollbar-width: thin;
}

/* Bouton gérer */
.alois-manage-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    padding: 8px 22px;
    border: 1px solid white;
    border-radius: 100px;
    background: transparent;
    color: white;
    cursor: pointer;
    font-family: 'Sora', Helvetica, Arial, Lucida, sans-serif;
    text-transform: uppercase;
    color: #ffffff !important;
    font-size: 16px !important;
    font-weight: 600;
    transition: background .2s, color .2s, border-color .2s;
}

.alois-manage-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
}

/* Drawer manager */
.alois-mgr-drawer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 8000;
}

.alois-mgr-drawer.open {
    display: block;
}

.alois-mgr-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(2px);
}

.alois-mgr-panel {
    position: absolute;
    right: 0;
    top: 120px;
    bottom: 4px;
    width: 520px;
    max-width: 100vw;
    background: #111;
    z-index: 1;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .38s cubic-bezier(.4, 0, .2, 1);
    box-shadow: -8px 0 40px rgba(0, 0, 0, .4);
}

.alois-mgr-drawer.open .alois-mgr-panel {
    transform: translateX(0);
}

.alois-mgr-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.alois-mgr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 18px;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
}

.alois-mgr-title {
    font-size: 13px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 500;
    color: #f5f5f5;
    flex: 1;
    text-align: center;
}

.alois-mgr-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0 4px;
    transition: color .2s;
    line-height: 1;
}

.alois-mgr-close:hover {
    color: #fff;
}

.alois-mgr-back {
    background: none;
    border: none;
    font-size: 13px;
    cursor: pointer;
    color: #888;
    padding: 0;
    letter-spacing: 1px;
    transition: color .2s;
    white-space: nowrap;
}

.alois-mgr-back:hover {
    color: #fff;
}

.alois-mgr-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

/* Footer bouton ajout */
.alois-mgr-footer {
    padding: 16px 20px;
    border-top: 1px solid #2a2a2a;
    flex-shrink: 0;
    text-align: center;
}

.alois-mgr-add-btn {
    text-align: center;
    padding: 8px 22px;
    border: 1px solid white;
    border-radius: 100px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font-family: 'Sora', Helvetica, Arial, Lucida, sans-serif;
    text-transform: uppercase;
    font-size: 16px !important;
    font-weight: 600;
    transition: background .2s, color .2s, border-color .2s;
}

.alois-mgr-add-btn:hover {
    background: #fff;
    color: #000;
}

/* Bouton catégories dans le footer
   Override: le footer devient flex quand on affiche le bouton catégories. */
.alois-mgr-footer {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.alois-mgr-folders-btn {
    padding: 8px 18px;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 100px;
    background: transparent;
    color: rgba(255, 255, 255, .6);
    cursor: pointer;
    font-family: 'Sora', Helvetica, Arial, Lucida, sans-serif;
    text-transform: uppercase;
    font-size: 13px;
    font-weight: 500;
    transition: all .2s;
}

.alois-mgr-folders-btn:hover {
    border-color: #fff;
    color: #fff;
}

/* Liste dossiers */
.alois-folder-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.alois-folder-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    transition: border-color .2s;
}

.alois-folder-row:hover {
    border-color: #444;
}

.alois-folder-row.editing {
    border-color: #fff;
}

.alois-folder-name {
    font-size: 13px;
    color: #f5f5f5;
    letter-spacing: .5px;
    flex: 1;
}

.alois-folder-name-input {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid #fff;
    color: #fff;
    font-size: 13px;
    padding: 2px 4px;
    outline: none;
    font-family: inherit;
}

.alois-folder-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.alois-folder-edit,
.alois-folder-delete,
.alois-folder-save,
.alois-folder-cancel {
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    padding: 4px;
    transition: color .2s;
    line-height: 1;
}

.alois-folder-edit:hover,
.alois-folder-save:hover {
    color: #fff;
}

.alois-folder-delete:hover,
.alois-folder-cancel:hover {
    color: rgba(220, 80, 80, .9);
}

/* Zone ajout dossier */
.alois-folder-add-wrap {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.alois-folder-add-wrap input {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #fff;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color .2s;
    border-radius: 0;
}

.alois-folder-add-wrap input:focus {
    border-color: #fff;
}


/* =============================================
   5. Admin popup (upload, edit media)
   ============================================= */

/* Zone upload (version popup Divi light) */
.alois-upload-zone {
    border: 2px dashed #d0d0d0;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .2s, background .2s;
    position: relative;
    flex-shrink: 0;
}

.alois-upload-zone:hover,
.alois-upload-zone:focus {
    border-color: var(--alois-black);
    background: #fafafa;
    outline: none;
}

.alois-upload-zone.has-image {
    border-color: var(--alois-black);
    min-height: unset;
}

.alois-upload-zone.drag-over {
    border-color: var(--alois-black);
    background: #f0f0f0;
}

.alois-upload-placeholder {
    text-align: center;
    color: #aaa;
    pointer-events: none;
    padding: 20px;
}

.alois-upload-placeholder span {
    font-size: 42px;
    display: block;
    margin-bottom: 10px;
}

.alois-upload-placeholder p {
    font-size: 13px;
    margin: 0 0 4px;
    color: #888;
}

.alois-upload-placeholder small {
    font-size: 11px;
    color: #bbb;
}

#alois-preview {
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    display: block;
}

.alois-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.alois-form-field label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #666;
    font-weight: 500;
}

.alois-form-field textarea,
.alois-form-field select {
    width: 100%;
    border: 1px solid #ddd;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
    font-family: inherit;
    color: var(--alois-black);
    background: #fff;
    box-sizing: border-box;
    -webkit-appearance: none;
    border-radius: 0;
}

.alois-form-field textarea:focus,
.alois-form-field select:focus {
    border-color: var(--alois-black);
}

.alois-form-field textarea {
    resize: vertical;
    min-height: 72px;
}

.alois-form-msg {
    font-size: 13px;
    padding: 10px 14px;
    display: none;
    line-height: 1.5;
}

.alois-form-msg.success {
    background: #e9f5ec;
    color: #2e7d3e;
    display: block;
}

.alois-form-msg.error {
    background: #fdecea;
    color: #b71c1c;
    display: block;
}

/* Bouton submit (shared: popup admin + drawer) */
.alois-submit-btn {
    padding: 8px 22px;
    border: 1px solid white;
    border-radius: 100px;
    background: transparent;
    color: white;
    cursor: pointer;
    font-family: 'Sora', Helvetica, Arial, Lucida, sans-serif;
    text-transform: uppercase;
    color: #ffffff !important;
    font-size: 16px !important;
    font-weight: 600;
    transition: background .2s, color .2s, border-color .2s;
}

.alois-submit-btn:hover:not(:disabled) {
    background: #333;
}

.alois-submit-btn:disabled {
    background: #aaa;
    cursor: not-allowed;
}

/* Zone upload (override dark — dans drawer manager)
   Note: redéclarée volontairement pour écraser la version light. */
.alois-upload-zone {
    border: 2px dashed #333;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .2s, background .2s;
    position: relative;
    flex-shrink: 0;
    margin-bottom: 4px;
}

.alois-upload-zone:hover,
.alois-upload-zone:focus {
    border-color: #fff;
    background: #1a1a1a;
    outline: none;
}

.alois-upload-zone.has-image {
    border-color: #555;
    min-height: unset;
}

.alois-upload-zone.drag-over {
    border-color: #fff;
    background: #1a1a1a;
}

.alois-upload-placeholder {
    text-align: center;
    color: #555;
    pointer-events: none;
    padding: 20px;
}

.alois-upload-placeholder span {
    font-size: 38px;
    display: block;
    margin-bottom: 8px;
}

.alois-upload-placeholder p {
    font-size: 13px;
    margin: 0 0 4px;
    color: #666;
}

.alois-upload-placeholder small {
    font-size: 11px;
    color: #444;
}

#alois-preview {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    display: block;
}

.alois-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 4px;
}

.alois-form-field label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #666;
    font-weight: 500;
}

.alois-form-field textarea,
.alois-form-field select {
    width: 100%;
    border: 1px solid #2a2a2a;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
    font-family: inherit;
    color: #f5f5f5;
    background: #1a1a1a;
    box-sizing: border-box;
    -webkit-appearance: none;
    border-radius: 0;
}

.alois-form-field textarea:focus,
.alois-form-field select:focus {
    border-color: #fff;
}

.alois-form-field textarea {
    resize: vertical;
    min-height: 72px;
}

.alois-form-msg {
    font-size: 13px;
    padding: 10px 14px;
    display: none;
    line-height: 1.5;
    margin-bottom: 4px;
}

.alois-form-msg.success {
    background: rgba(46, 125, 62, .25);
    color: #81c784;
    display: block;
}

.alois-form-msg.error {
    background: rgba(183, 28, 28, .25);
    color: #ef9a9a;
    display: block;
}

/* Ancienne version du bouton submit — conservée commentée pour référence */
/* .alois-submit-btn {
    background: #f5f5f5;
    color: #0d0d0d;
    border: none;
    padding: 15px;
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    letter-spacing: 2px;
    text-transform: uppercase;
    width: 100%;
    transition: background .2s;
    flex-shrink: 0
}

.alois-submit-btn:hover:not(:disabled) {
    background: #ccc
}

.alois-submit-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed
} */


/* =============================================
   6. Bulk upload
   ============================================= */

/* Les règles .alois-bulk-* partagées sont définies dans global.css
   (section 8 — Admin drawer helpers). */


/* =============================================
   7. Responsive
   ============================================= */

@media (max-width: 1024px) {
    .alois-gallery-grid {
        columns: 2;
    }
}

@media (max-width: 767px) {
    .fix-lord-icon-mobile lord-icon {
        width: 70px !important;
        height: 70px !important;
    }
}

@media (max-width: 540px) {
    .alois-gallery-grid {
        columns: 1;
    }
}

@media (max-width: 480px) {
    .alois-mgr-panel {
        width: 100vw;
    }

    .alois-manage-btn {
        bottom: 20px;
        right: 20px;
    }

    .alois-drawer-panel {
        width: 100vw;
    }

    .alois-add-btn {
        bottom: 20px;
        right: 20px;
        padding: 12px 18px;
    }
}
