/*
 * A&T – Galerie Use-your-Drive
 * Couche visuelle volontairement limitée aux modules Gallery de WP Cloud Plugins.
 */

.at-uyd-toolbar {
    --at-night: var(--theme-palette-color-1, #061526);
    --at-cream: var(--theme-palette-color-2, #f7f2e9);
    --at-gold: var(--theme-palette-color-3, #bfa340);
    --at-white: var(--theme-palette-color-5, #ffffff);
    --at-text: var(--theme-palette-color-6, #151f2a);
    --at-muted: var(--theme-palette-color-7, #515e6b);
    --at-sand: var(--theme-palette-color-8, #e6d9c9);

    position: sticky;
    top: calc(12px + env(safe-area-inset-top, 0px));
    z-index: 50;
    display: flex;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 24px;
    padding: 14px 16px;
    color: var(--at-text);
    background: rgba(247, 242, 233, 0.96);
    background: color-mix(in srgb, var(--at-cream) 94%, transparent);
    border: 1px solid rgba(191, 163, 64, 0.42);
    border: 1px solid color-mix(in srgb, var(--at-gold) 42%, transparent);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(6, 21, 38, 0.10);
    font-family: Jost, var(--theme-font-family, sans-serif);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

body.admin-bar .at-uyd-toolbar {
    top: calc(44px + env(safe-area-inset-top, 0px));
}

.at-uyd-toolbar.is-loading {
    display: none;
}

.at-uyd-toolbar *,
.at-uyd-toolbar *::before,
.at-uyd-toolbar *::after {
    box-sizing: border-box;
}

.at-uyd-toolbar__intro,
.at-uyd-toolbar__selection {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.at-uyd-toolbar__selection {
    display: none;
    justify-content: space-between;
}

.at-uyd-toolbar.is-selecting .at-uyd-toolbar__intro {
    display: none;
}

.at-uyd-toolbar.is-selecting .at-uyd-toolbar__selection {
    display: flex;
}

.at-uyd-toolbar__emblem {
    display: grid;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    place-items: center;
    color: var(--at-night);
    background: #f5eddc;
    background: color-mix(in srgb, var(--at-gold) 18%, var(--at-white));
    border: 1px solid rgba(191, 163, 64, 0.48);
    border: 1px solid color-mix(in srgb, var(--at-gold) 48%, transparent);
    border-radius: 50%;
}

.at-uyd-toolbar__copy {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
    line-height: 1.25;
}

.at-uyd-toolbar__copy strong {
    color: var(--at-night);
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(17px, 1.7vw, 21px);
    font-weight: 600;
}

.at-uyd-toolbar__copy small {
    margin-top: 3px;
    color: var(--at-muted);
    font-size: 14px;
    font-weight: 400;
}

.at-uyd-icon {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.at-uyd-button {
    appearance: none;
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 10px 16px;
    color: var(--at-night);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    box-shadow: none;
    font-family: Jost, var(--theme-font-family, sans-serif);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.at-uyd-button:hover {
    transform: translateY(-1px);
}

.at-uyd-button:focus-visible {
    outline: 3px solid rgba(191, 163, 64, 0.72);
    outline: 3px solid color-mix(in srgb, var(--at-gold) 72%, transparent);
    outline-offset: 3px;
}

.at-uyd-button--primary {
    color: var(--at-white);
    background: var(--at-night);
    border-color: var(--at-night);
    box-shadow: 0 6px 16px rgba(6, 21, 38, 0.18);
}

.at-uyd-button--primary:hover {
    color: var(--at-white);
    background: #192434;
    background: color-mix(in srgb, var(--at-night) 90%, var(--at-gold));
}

.at-uyd-button--secondary {
    color: var(--at-night);
    background: var(--at-white);
    border-color: #d8cdbc;
    border-color: color-mix(in srgb, var(--at-sand) 90%, var(--at-night));
}

.at-uyd-button--ghost {
    color: var(--at-muted);
    background: transparent;
}

.at-uyd-button:disabled,
.at-uyd-button[aria-disabled="true"] {
    opacity: 0.46;
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}

.at-uyd-count {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    padding: 9px 14px;
    color: var(--at-night);
    background: #f5eddc;
    background: color-mix(in srgb, var(--at-gold) 16%, var(--at-white));
    border: 1px solid rgba(191, 163, 64, 0.44);
    border: 1px solid color-mix(in srgb, var(--at-gold) 44%, transparent);
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}

.at-uyd-toolbar__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.at-uyd-status {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/*
 * Le véritable en-tête du plugin reste activé dans la configuration et dans le
 * DOM. Il est masqué seulement après détection des actions ZIP, afin que la
 * barre personnalisée puisse déclencher les fonctions natives en toute sécurité.
 */
.wpcp-module.wpcp-gallery.at-uyd-native-ready
    > .wpcp-browser-container
    > .wpcp-browser-container-content
    > .nav-header.nav-header-has-breadcrumb {
    display: none !important;
}

/* Mode sélection : seul le contrôle de sélection reste visible sur les médias. */
.wpcp-module.wpcp-gallery.at-uyd-selection-mode .entry:not(.image-folder) {
    cursor: pointer;
}

.wpcp-module.wpcp-gallery.at-uyd-selection-mode .entry:not(.image-folder).is-selected {
    outline: 4px solid var(--theme-palette-color-3, #bfa340);
    outline-offset: -4px;
}

.wpcp-module.wpcp-gallery.at-uyd-selection-mode .entry:not(.image-folder) .entry-info .entry_checkbox {
    display: none !important;
}

.wpcp-module.wpcp-gallery.at-uyd-selection-mode .entry:not(.image-folder) .entry-top-actions {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    left: auto !important;
    display: flex !important;
    width: 40px !important;
    height: 40px !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    pointer-events: auto !important;
    z-index: 8 !important;
}

.wpcp-module.wpcp-gallery.at-uyd-selection-mode .entry:not(.image-folder) .entry-top-actions > * {
    display: none !important;
}

.wpcp-module.wpcp-gallery.at-uyd-selection-mode .entry:not(.image-folder) .entry-top-actions > .entry_checkbox {
    position: static !important;
    display: block !important;
    width: 40px !important;
    height: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.wpcp-module.wpcp-gallery.at-uyd-selection-mode input.selected-files {
    position: absolute !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.wpcp-module.wpcp-gallery.at-uyd-selection-mode .entry_checkbox label {
    display: grid !important;
    width: 38px !important;
    height: 38px !important;
    margin: 0 !important;
    padding: 0 !important;
    place-items: center !important;
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.94) !important;
    border: 2px solid #061526 !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 14px rgba(6, 21, 38, 0.24) !important;
    cursor: pointer !important;
    opacity: 1 !important;
    visibility: visible !important;
    transition: transform 150ms ease, background-color 150ms ease !important;
}

.wpcp-module.wpcp-gallery.at-uyd-selection-mode .entry_checkbox label:hover {
    transform: scale(1.06);
}

.wpcp-module.wpcp-gallery.at-uyd-selection-mode .entry.is-selected .entry_checkbox label {
    background: var(--theme-palette-color-3, #bfa340) !important;
    border-color: #ffffff !important;
}

.wpcp-module.wpcp-gallery.at-uyd-selection-mode .entry.is-selected .entry_checkbox label::after {
    content: "✓" !important;
    display: block !important;
    color: #061526 !important;
    font-family: Arial, sans-serif !important;
    font-size: 23px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
}

@media (max-width: 760px) {
    .at-uyd-toolbar {
        top: calc(8px + env(safe-area-inset-top, 0px));
        margin-bottom: 18px;
        padding: 12px;
        border-radius: 15px;
    }

    body.admin-bar .at-uyd-toolbar {
        top: calc(54px + env(safe-area-inset-top, 0px));
    }

    .at-uyd-toolbar__intro,
    .at-uyd-toolbar__selection {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .at-uyd-toolbar__intro {
        position: relative;
        padding-left: 54px;
    }

    .at-uyd-toolbar__emblem {
        position: absolute;
        top: 0;
        left: 0;
    }

    .at-uyd-toolbar__copy small {
        font-size: 13px;
    }

    .at-uyd-start {
        margin-left: -54px;
        width: calc(100% + 54px);
    }

    .at-uyd-count {
        justify-content: center;
        width: 100%;
    }

    .at-uyd-toolbar__actions {
        display: grid;
        width: 100%;
        grid-template-columns: 1fr 1fr;
    }

    .at-uyd-download {
        grid-column: 1 / -1;
    }

    .at-uyd-button {
        width: 100%;
        min-width: 0;
        padding-right: 12px;
        padding-left: 12px;
        white-space: normal;
    }
}

@media (prefers-reduced-motion: reduce) {
    .at-uyd-button,
    .wpcp-module.wpcp-gallery.at-uyd-selection-mode .entry_checkbox label {
        transition: none !important;
    }
}
