/* ASI Gutenberg Masonry Styles */

/* =============================================
   Custom Bank Picker - Checkbox Styles
   Works in Gutenberg, Media Modal & Elementor
   ============================================= */

.allsi-custom-bank-picker {
    box-sizing: border-box;
}

.allsi-custom-bank-picker *,
.allsi-custom-bank-picker *::before,
.allsi-custom-bank-picker *::after {
    box-sizing: border-box;
}

/* Grid container for checkboxes */
.allsi-custom-bank-picker > div {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 4px !important;
}

/* Base control wrapper - this gets the padding */
.allsi-custom-bank-picker .components-base-control {
    margin: 0 !important;
    padding: 6px 10px !important;
    border-radius: 4px !important;
    transition: background 0.15s ease !important;
}

.allsi-custom-bank-picker .components-base-control:hover {
    background: rgba(0, 0, 0, 0.03) !important;
}

.allsi-custom-bank-picker .components-base-control__field {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* The main label element - only left padding */
.allsi-custom-bank-picker .components-checkbox-control__label {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 0 !important;
    padding-left: 8px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    width: 100% !important;
}

/* Input container that holds the checkbox */
.allsi-custom-bank-picker .components-checkbox-control__input-container {
    display: inline-block !important;
    flex-shrink: 0 !important;
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
}

/* Hide the default WP checkbox SVG icon */
.allsi-custom-bank-picker .components-checkbox-control__input-container svg {
    display: none !important;
}

/* The actual checkbox input */
.allsi-custom-bank-picker .components-checkbox-control__input-container input[type="checkbox"],
.allsi-custom-bank-picker input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #8c8f94 !important;
    border-radius: 2px !important;
    background: #fff !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}

.allsi-custom-bank-picker input[type="checkbox"]:checked {
    background: #2271b1 !important;
    border-color: #2271b1 !important;
}

.allsi-custom-bank-picker input[type="checkbox"]:checked::before {
    content: '' !important;
    position: absolute !important;
    top: 1px !important;
    left: 4px !important;
    width: 5px !important;
    height: 9px !important;
    border: solid #fff !important;
    border-width: 0 2px 2px 0 !important;
    transform: rotate(45deg) !important;
    display: block !important;
}

.allsi-custom-bank-picker input[type="checkbox"]:focus {
    outline: 2px solid #2271b1 !important;
    outline-offset: 2px !important;
    box-shadow: none !important;
}

/* Label text span */
.allsi-custom-bank-picker .components-checkbox-control__label > span:last-child {
    font-size: 13px !important;
    font-weight: 400 !important;
    color: #1e1e1e !important;
    line-height: 16px !important;
}

/* =============================================
   End Custom Bank Picker Styles
   ============================================= */

.mpt-tab-panel {
    margin-top: 15px;
}

.mpt-tab-panel .components-tab-panel__tabs {
    gap: 4px;
}

.mpt-tab-panel .components-tab-panel__tabs-item {
    border: 1px solid #dcdcde;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    background: #f6f7f7;
    font-weight: 500;
}

.mpt-tab-panel .components-tab-panel__tabs-item.active-tab {
    background-color: #fff;
    border-color: #b0b0b2;
}

.button-center {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
}

/* Masonry grid */
.allsi-media-grid {
    position: relative;
    list-style: none;
    padding: 0;
    margin: 0 auto;
    max-width: 1400px;
    min-height: 240px;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.allsi-media-grid:not(.allsi-masonry-ready) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 5px;
    opacity: 0.4;
    transform: translateY(8px);
}

.allsi-media-grid.allsi-masonry-ready {
    opacity: 1;
    transform: none;
}

.allsi-media-grid .allsi-media-item {
    list-style: none;
    width: 100%;
    margin: 0;
    cursor: pointer;
}

.wp-core-ui .allsi-media-grid .attachment,
.wp-core-ui .allsi-media-grid .allsi-media-item {
    padding: 5px !important;    
}

.allsi-media-grid.allsi-masonry-ready .allsi-media-item {
    position: absolute;
    will-change: transform;
}

.allsi-media-grid:not(.allsi-masonry-ready) .allsi-media-item {
    position: relative;
}

.allsi-infinite-sentinel {
    width: 100%;
    height: 1px;
}

/* Image cards */
.allsi-media-card {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    background: #f7f7f9;
    box-shadow: 0 8px 30px rgba(21, 25, 36, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.allsi-media-card img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.25s ease;
}

.allsi-media-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 45px rgba(21, 25, 36, 0.15);
}

.allsi-media-card:hover img {
    transform: scale(1.02);
}

.allsi-media-card--downloaded img {
    filter: grayscale(0.5) saturate(0.6) brightness(0.8) blur(0.5px);
    transform: none !important;
}

.allsi-media-card--downloaded {
    position: relative;
    overflow: hidden;
}

.allsi-media-card--downloaded::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(2, 44, 16, 0.45);
    pointer-events: none;
}

/* Hover overlay */
.allsi-media-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
    color: #fff;
    background: linear-gradient(180deg, rgba(8, 12, 20, 0) 0%, rgba(8, 12, 20, 0.85) 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.allsi-media-card:hover .allsi-media-overlay {
    opacity: 1;
}

.allsi-media-author {
    font-size: 13px;
    font-weight: 500;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.allsi-settings-button {
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    color: #fff;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: background 0.2s ease, transform 0.2s ease;
}

.allsi-settings-button svg {
    pointer-events: none;
}

.allsi-settings-button:hover,
.allsi-settings-button:focus-visible {
    background: rgba(0, 0, 0, 0.75);
    transform: scale(1.08);
}

.allsi-download-badge {
    background: rgba(34, 197, 94, 0.9);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.35);
}

.allsi-download-stamp {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    z-index: 2;
    color: #ecfdf5;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
}

.allsi-download-stamp__icon {
    width: 64px;
    height: 64px;
    border-radius: 999px;
    border: 3px solid rgba(52, 211, 153, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 700;
    background: rgba(5, 46, 22, 0.75);
    box-shadow: 0 12px 25px rgba(6, 78, 59, 0.45);
}

/* Settings panel */
.allsi-settings-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100001;
    padding: 20px;
}

.allsi-settings-dialog {
    display: flex;
    gap: 24px;
    width: min(860px, 100%);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 25px 60px rgba(5, 12, 27, 0.25);
    padding: 28px;
    animation: asiPop 0.2s ease;
}

@keyframes asiPop {
    from { transform: translateY(10px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.allsi-settings-preview img {
    width: 240px;
    height: 300px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15, 16, 28, 0.18);
}

.allsi-settings-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.allsi-settings-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.allsi-settings-label {
    font-weight: 600;
    font-size: 13px;
    color: #1f2937;
}

.allsi-filename-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.allsi-filename-input {
    flex: 1;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 13px;
}

.allsi-filename-extension {
    padding: 6px 10px;
    border-radius: 4px;
    background: #f1f1f3;
    border: 1px solid #e5e5e7;
    font-size: 13px;
    color: #4b5563;
}

.allsi-settings-caption-group .components-textarea-control__input {
    min-height: 90px;
}

.allsi-attribution-link {
    margin-top: -6px;
    font-size: 12px;
    color: #1a73e8;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.allsi-attribution-link:hover,
.allsi-attribution-link:focus-visible {
    color: #1558b0;
    text-decoration: underline;
}

.allsi-settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.allsi-standalone-wrapper {
    margin-top: 0;
}

.allsi-inline-explorer {
    background: #fff;
    border: 1px solid #dcdcde;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 12px 35px rgba(15, 19, 28, 0.08);
    margin-top: 0;
    width: 100%;
    box-sizing: border-box;
}

.allsi-download-notice {
    margin-bottom: 20px;
}

.allsi-media-browser-wrap {
    max-width: none;
}

@media (max-width: 900px) {
    .allsi-settings-dialog {
        flex-direction: column;
        align-items: center;
    }

    .allsi-settings-preview img {
        width: 100%;
        height: auto;
    }

    .allsi-settings-actions {
        flex-direction: column;
    }
}
