/**
 * WordPress Plugins Drag and Drop Styles
 */

/* Hide the upload form on plugin-install.php, update.php and plugins.php */
body.plugin-install-php .wp-upload-form,
body.update-php .wp-upload-form,
body.plugins-php .upload-plugin .wp-upload-form {
    display: none !important;
}

/* Full-list drop overlay on plugins.php while dragging ZIP file(s) */
.abda53-plugins-page-drop-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 100000;
    align-items: center;
    justify-content: center;
    background: rgba(240, 246, 252, 0.92);
    border: 3px dashed #2271b1;
    border-radius: 4px;
    pointer-events: none;
    box-sizing: border-box;
}

body.abda53-plugins-page-dragging .abda53-plugins-page-drop-overlay {
    display: flex;
}

.abda53-plugins-page-drop-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px;
}

.abda53-plugins-page-drop-message .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    color: #2271b1;
    margin-bottom: 12px;
    animation: pulse 1.5s ease-in-out infinite;
}

.abda53-plugins-page-drop-message p {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2271b1;
}

/* Ensure the upload-plugin container is visible on update.php */
body.update-php .upload-plugin {
    display: block !important;
}

/* Show file input as fallback if drag-drop enhancement hasn't run yet */
body.update-php .upload-plugin .wp-upload-form input[type="file"] {
    display: block !important;
    margin: 10px 0;
}

/* Hide file input once drag-drop is enabled */
body.update-php .upload-plugin.wp-drag-drop-enabled .wp-upload-form input[type="file"] {
    display: none !important;
}

.wp-drag-drop-enabled {
    position: relative;
}

.wp-drag-drop-zone {
    position: relative;
    max-width: 500px;
    margin: 20px auto;
    min-height: 200px;
    border: 2px dashed #c3c4c7;
    border-radius: 4px;
    background-color: #f6f7f7;
    transition: all 0.3s ease;
    cursor: pointer;
}

.wp-drag-drop-zone:hover {
    border-color: #2271b1;
    background-color: #f0f6fc;
}

.wp-drag-drop-enabled.wp-drag-over .wp-drag-drop-zone,
.wp-drag-drop-zone.wp-drag-active {
    border-color: #2271b1;
    background-color: #f0f6fc;
    border-width: 3px;
    box-shadow: 0 0 0 1px #2271b1 inset;
}

.wp-drag-drop-zone.wp-drag-success {
    border-color: #00a32a;
    background-color: #f0f6fc;
}

.wp-drag-drop-zone.wp-drag-error {
    border-color: #d63638;
    background-color: #fcf0f1;
}

.wp-drag-drop-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    text-align: center;
    min-height: 200px;
}

.wp-drag-drop-message .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #2271b1;
    margin-bottom: 15px;
}

.wp-drag-drop-enabled.wp-drag-over .wp-drag-drop-message .dashicons,
.wp-drag-drop-zone.wp-drag-active .wp-drag-drop-message .dashicons {
    color: #2271b1;
    animation: pulse 1.5s ease-in-out infinite;
}

.wp-drag-drop-zone.wp-drag-success .wp-drag-drop-message .dashicons {
    color: #00a32a;
}

.wp-drag-drop-zone.wp-drag-error .wp-drag-drop-message .dashicons {
    color: #d63638;
}

.wp-drag-drop-message p {
    margin: 0;
    font-size: 16px;
    color: #50575e;
    font-weight: 500;
}

.wp-drag-drop-enabled.wp-drag-over .wp-drag-drop-message p,
.wp-drag-drop-zone.wp-drag-active .wp-drag-drop-message p {
    color: #2271b1;
}

.wp-drag-drop-zone.wp-drag-success .wp-drag-drop-message p {
    color: #00a32a;
}

.wp-drag-drop-zone.wp-drag-error .wp-drag-drop-message p {
    color: #d63638;
}

/* Upload list: files queued for upload, one per line */
.wp-drag-drop-selected {
    margin: 10px 20px 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
    text-align: left;
}

.wp-drag-drop-selected li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 2px 0;
    padding: 4px 8px;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 3px;
}

.wp-drag-drop-selected .wp-drag-drop-filename {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wp-drag-drop-remove {
    flex-shrink: 0;
    border: none;
    background: none;
    padding: 0 4px;
    font-size: 16px;
    line-height: 1;
    color: #d63638;
    cursor: pointer;
}

.wp-drag-drop-remove:hover {
    color: #fff;
    background: #d63638;
    border-radius: 2px;
}

/* Activate button shown after a multi-plugin upload completes */
.wp-drag-drop-zone .wp-activate-uploaded-button {
    margin: 12px 0 20px;
}

.wp-drag-drop-zone .wp-activate-uploaded-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Support button shown after uploads (and activation) are complete */
.wp-drag-drop-zone .wp-support-button {
    margin: 12px 0 20px;
}

.wp-drag-drop-zone .wp-support-badge {
    display: block;
    margin: 12px 0 20px;
}

/* Per-file results when uploading multiple plugins */
.wp-drag-drop-results {
    margin: 15px 20px 20px;
    padding: 0;
    list-style: none;
    font-size: 13px;
    text-align: left;
    align-self: stretch;
}

.wp-drag-drop-results li {
    margin: 4px 0;
}

.wp-drag-drop-results li.wp-drag-result-success {
    color: #00a32a;
}

.wp-drag-drop-results li.wp-drag-result-conflict {
    color: #996800;
}

.wp-drag-drop-results li.wp-drag-result-error {
    color: #d63638;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Install Now button */
.wp-drag-drop-zone .wp-install-now-button {
    margin: 0 0 20px 0;
    padding: 12px 24px;
    font-size: 16px;
    height: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wp-drag-drop-zone .wp-install-now-button .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    line-height: 1;
}

.wp-drag-drop-zone .wp-install-now-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wp-drag-drop-zone .wp-install-now-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
