/**
 * DGA Featured Images Shortcode Styles
 *
 * Airbnb-style featured image uploader for [postupdate_featured_images] shortcode
 * Drag & drop upload zone with modal interface
 *
 * @package DGA_Post_Editor
 * @version 2.0.0
 * @requires dgape-design-tokens.css
 *
 * Class naming convention preserved for JavaScript compatibility:
 * - .postupdate-* classes
 *
 * NOTE: All !important declarations have been removed.
 * Using proper specificity instead for maintainability.
 */

/* ========================================
   WRAPPER
   ======================================== */
.postupdate-featured-wrap {
    position: relative;
    display: inline-block;
    margin: var(--dgape-space-3) 0;
    z-index: var(--dgape-z-base);
    font-family: var(--dgape-font-family);
}

.postupdate-featured-wrap * {
    box-sizing: border-box;
}

/* ========================================
   TRIGGER BUTTON
   ======================================== */
.postupdate-featured-wrap .postupdate-featured-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    font-size: var(--dgape-text-base);
    line-height: 1;
    text-align: center;
    color: var(--dgape-text-inverse);
    background-color: var(--dgape-success);
    border: none;
    border-radius: var(--dgape-radius-full);
    box-shadow: var(--dgape-shadow-md);
    cursor: pointer;
    overflow: hidden;
    transition: var(--dgape-transition-all);
}

.postupdate-featured-wrap .postupdate-featured-btn:hover {
    background-color: var(--dgape-success-dark);
    transform: translateY(-2px);
    box-shadow: var(--dgape-shadow-lg);
}

.postupdate-featured-wrap .postupdate-featured-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(82, 196, 26, 0.2);
}

.postupdate-featured-wrap .postupdate-featured-btn:active {
    transform: translateY(0);
}

/* Image icon (dashicons) */
.postupdate-featured-wrap .postupdate-image-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    width: 20px;
    height: 20px;
    line-height: 1;
    vertical-align: middle;
    color: inherit;
}

.postupdate-featured-wrap .postupdate-image-icon::before {
    display: block;
    line-height: 1;
}

/* Legacy tree icon */
.postupdate-featured-wrap .postupdate-tree-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 20px;
    line-height: 1;
    vertical-align: middle;
    color: inherit;
}

.postupdate-featured-wrap .postupdate-tree-icon::before {
    display: block;
    line-height: 1;
}

/* ========================================
   MODAL OVERLAY
   ======================================== */
.postupdate-featured-wrap .postupdate-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--dgape-z-modal-backdrop);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--dgape-transition-normal),
                visibility var(--dgape-transition-normal);
}

.postupdate-featured-wrap .postupdate-modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.postupdate-featured-wrap .postupdate-modal-overlay {
    position: absolute;
    inset: 0;
    background-color: var(--dgape-bg-modal-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ========================================
   MODAL CONTAINER
   ======================================== */
.postupdate-featured-wrap .postupdate-modal-container {
    position: relative;
    width: calc(100% - var(--dgape-space-8));
    max-width: 520px;
    max-height: calc(100vh - var(--dgape-space-16));
    overflow-y: auto;
    background-color: var(--dgape-bg-primary);
    border-radius: var(--dgape-radius-xl);
    box-shadow: var(--dgape-shadow-modal);
    z-index: var(--dgape-z-modal);
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    transition: transform var(--dgape-transition-normal),
                opacity var(--dgape-transition-normal);
}

.postupdate-featured-wrap .postupdate-modal[aria-hidden="false"] .postupdate-modal-container {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ========================================
   MODAL HEADER
   ======================================== */
.postupdate-featured-wrap .postupdate-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--dgape-space-4) var(--dgape-space-6);
    background-color: var(--dgape-primary-500);
    color: var(--dgape-text-inverse);
    border-radius: var(--dgape-radius-xl) var(--dgape-radius-xl) 0 0;
}

.postupdate-featured-wrap .postupdate-modal-title {
    margin: 0;
    font-size: var(--dgape-text-lg);
    font-weight: var(--dgape-font-semibold);
    color: inherit;
}

.postupdate-featured-wrap .postupdate-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: var(--dgape-text-2xl);
    line-height: 1;
    color: inherit;
    background: transparent;
    border: none;
    border-radius: var(--dgape-radius-full);
    cursor: pointer;
    transition: var(--dgape-transition-all);
}

.postupdate-featured-wrap .postupdate-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

/* ========================================
   MODAL BODY
   ======================================== */
.postupdate-featured-wrap .postupdate-modal-body {
    padding: var(--dgape-space-6);
}

/* ========================================
   UPLOAD ZONE (Airbnb Style)
   ======================================== */
.postupdate-featured-wrap .postupdate-upload-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: var(--dgape-space-6);
    margin-bottom: var(--dgape-space-4);
    text-align: center;
    background-color: var(--dgape-bg-secondary);
    border: 2px dashed var(--dgape-border-default);
    border-radius: var(--dgape-radius-lg);
    transition: var(--dgape-transition-all);
    cursor: pointer;
}

.postupdate-featured-wrap .postupdate-upload-zone:hover {
    border-color: var(--dgape-primary-400);
    background-color: var(--dgape-primary-50);
}

.postupdate-featured-wrap .postupdate-upload-zone.is-dragover {
    border-color: var(--dgape-primary-500);
    background-color: var(--dgape-primary-100);
    transform: scale(1.01);
}

/* Upload Prompt */
.postupdate-featured-wrap .postupdate-upload-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: var(--dgape-text-secondary);
    cursor: pointer;
}

.postupdate-featured-wrap .postupdate-upload-icon {
    display: inline-block;
    margin-bottom: var(--dgape-space-3);
    font-size: 40px;
    color: var(--dgape-primary-500);
    transition: var(--dgape-transition-color);
}

.postupdate-featured-wrap .postupdate-upload-zone:hover .postupdate-upload-icon {
    color: var(--dgape-primary-600);
}

.postupdate-featured-wrap .postupdate-upload-prompt p {
    margin: var(--dgape-space-2) 0 0;
    font-size: var(--dgape-text-sm);
    line-height: var(--dgape-leading-relaxed);
    color: var(--dgape-text-secondary);
}

.postupdate-featured-wrap .postupdate-upload-prompt p strong {
    color: var(--dgape-primary-500);
}

/* ========================================
   UPLOAD PREVIEW
   ======================================== */
.postupdate-featured-wrap .postupdate-upload-preview {
    width: 100%;
    margin-top: var(--dgape-space-3);
    text-align: center;
}

.postupdate-featured-wrap .postupdate-upload-preview img {
    display: block;
    max-width: 100%;
    max-height: 200px;
    margin: 0 auto;
    border-radius: var(--dgape-radius-md);
    box-shadow: var(--dgape-shadow-sm);
    object-fit: contain;
}

.postupdate-featured-wrap .postupdate-preview-actions {
    display: flex;
    justify-content: center;
    margin-top: var(--dgape-space-3);
}

.postupdate-featured-wrap .postupdate-remove-image {
    padding: var(--dgape-space-2) var(--dgape-space-3);
    font-family: var(--dgape-font-family);
    font-size: var(--dgape-text-xs);
    font-weight: var(--dgape-font-semibold);
    color: var(--dgape-text-inverse);
    background-color: var(--dgape-error);
    border: none;
    border-radius: var(--dgape-radius-md);
    cursor: pointer;
    transition: var(--dgape-transition-all);
}

.postupdate-featured-wrap .postupdate-remove-image:hover {
    background-color: var(--dgape-error-dark);
}

/* ========================================
   PROGRESS BAR
   ======================================== */
.postupdate-featured-wrap .postupdate-progress-wrap {
    display: none;
    width: 100%;
    height: 6px;
    margin-top: var(--dgape-space-4);
    background-color: var(--dgape-gray-200);
    border-radius: var(--dgape-radius-full);
    overflow: hidden;
}

.postupdate-featured-wrap .postupdate-progress-wrap.is-visible {
    display: block;
}

.postupdate-featured-wrap .postupdate-progress-bar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--dgape-primary-400), var(--dgape-primary-500));
    border-radius: var(--dgape-radius-full);
    transition: width var(--dgape-transition-slow);
}

/* ========================================
   STATUS MESSAGE
   ======================================== */
.postupdate-featured-wrap .postupdate-status {
    min-height: 24px;
    margin-top: var(--dgape-space-4);
    font-size: var(--dgape-text-sm);
    font-weight: var(--dgape-font-medium);
    text-align: center;
    color: var(--dgape-text-secondary);
    transition: var(--dgape-transition-color);
}

.postupdate-featured-wrap .postupdate-status.is-error {
    color: var(--dgape-error);
}

.postupdate-featured-wrap .postupdate-status.is-success {
    color: var(--dgape-success);
}

/* ========================================
   MODAL FOOTER
   ======================================== */
.postupdate-featured-wrap .postupdate-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--dgape-space-3);
    padding: var(--dgape-space-4) var(--dgape-space-6);
    background-color: var(--dgape-bg-secondary);
    border-top: 1px solid var(--dgape-border-light);
    border-radius: 0 0 var(--dgape-radius-xl) var(--dgape-radius-xl);
}

.postupdate-featured-wrap .postupdate-cancel-btn {
    padding: var(--dgape-space-2) var(--dgape-space-4);
    min-height: var(--dgape-height-md);
    font-family: var(--dgape-font-family);
    font-size: var(--dgape-text-sm);
    font-weight: var(--dgape-font-semibold);
    color: var(--dgape-text-primary);
    background-color: var(--dgape-bg-primary);
    border: 1px solid var(--dgape-border-default);
    border-radius: var(--dgape-radius-md);
    cursor: pointer;
    transition: var(--dgape-transition-all);
}

.postupdate-featured-wrap .postupdate-cancel-btn:hover {
    background-color: var(--dgape-bg-tertiary);
    border-color: var(--dgape-border-dark);
}

.postupdate-featured-wrap .postupdate-update-btn {
    padding: var(--dgape-space-2) var(--dgape-space-4);
    min-height: var(--dgape-height-md);
    font-family: var(--dgape-font-family);
    font-size: var(--dgape-text-sm);
    font-weight: var(--dgape-font-semibold);
    color: var(--dgape-text-inverse);
    background-color: var(--dgape-primary-500);
    border: none;
    border-radius: var(--dgape-radius-md);
    cursor: pointer;
    transition: var(--dgape-transition-all);
}

.postupdate-featured-wrap .postupdate-update-btn:hover {
    background-color: var(--dgape-primary-600);
    box-shadow: var(--dgape-shadow-sm);
}

.postupdate-featured-wrap .postupdate-update-btn:disabled {
    background-color: var(--dgape-gray-400);
    cursor: not-allowed;
    opacity: 0.6;
}

/* ========================================
   DEBUG MODE (Development Only)
   ======================================== */
.postupdate-featured-wrap .postupdate-debug {
    margin-top: var(--dgape-space-3);
    padding: var(--dgape-space-3);
    font-family: var(--dgape-font-family-mono);
    font-size: var(--dgape-text-xs);
    color: var(--dgape-text-secondary);
    background-color: var(--dgape-bg-tertiary);
    border: 1px solid var(--dgape-border-light);
    border-radius: var(--dgape-radius-sm);
}

/* Body scroll lock removed - modal overlay handles scroll prevention */

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 600px) {
    .postupdate-featured-wrap .postupdate-modal-container {
        width: calc(100% - var(--dgape-space-4));
        max-height: calc(100vh - var(--dgape-space-8));
        margin: var(--dgape-space-4);
    }

    .postupdate-featured-wrap .postupdate-modal-header {
        padding: var(--dgape-space-3) var(--dgape-space-4);
    }

    .postupdate-featured-wrap .postupdate-modal-title {
        font-size: var(--dgape-text-base);
    }

    .postupdate-featured-wrap .postupdate-modal-body {
        padding: var(--dgape-space-4);
    }

    .postupdate-featured-wrap .postupdate-upload-zone {
        min-height: 180px;
        padding: var(--dgape-space-4);
    }

    .postupdate-featured-wrap .postupdate-upload-icon {
        font-size: 32px;
    }

    .postupdate-featured-wrap .postupdate-modal-footer {
        flex-direction: column-reverse;
        gap: var(--dgape-space-2);
        padding: var(--dgape-space-4);
    }

    .postupdate-featured-wrap .postupdate-cancel-btn,
    .postupdate-featured-wrap .postupdate-update-btn {
        width: 100%;
    }
}

/* ========================================
   DARK MODE SUPPORT
   ======================================== */
@media (prefers-color-scheme: dark) {
    .postupdate-featured-wrap .postupdate-modal-container {
        background-color: var(--dgape-bg-secondary);
    }

    .postupdate-featured-wrap .postupdate-modal-header {
        background-color: var(--dgape-primary-600);
    }

    .postupdate-featured-wrap .postupdate-upload-zone {
        background-color: var(--dgape-bg-tertiary);
        border-color: var(--dgape-border-default);
    }

    .postupdate-featured-wrap .postupdate-upload-zone:hover {
        background-color: rgba(30, 115, 190, 0.1);
        border-color: var(--dgape-primary-400);
    }

    .postupdate-featured-wrap .postupdate-upload-prompt p {
        color: var(--dgape-text-secondary);
    }

    .postupdate-featured-wrap .postupdate-modal-footer {
        background-color: var(--dgape-bg-tertiary);
        border-top-color: var(--dgape-border-default);
    }

    .postupdate-featured-wrap .postupdate-cancel-btn {
        color: var(--dgape-text-primary);
        background-color: var(--dgape-bg-primary);
        border-color: var(--dgape-border-default);
    }

    .postupdate-featured-wrap .postupdate-cancel-btn:hover {
        background-color: var(--dgape-bg-hover);
    }
}

/* ========================================
   HIGH CONTRAST MODE
   ======================================== */
@media (prefers-contrast: high) {
    .postupdate-featured-wrap .postupdate-modal-container {
        border: 3px solid var(--dgape-text-primary);
    }

    .postupdate-featured-wrap .postupdate-upload-zone {
        border-width: 3px;
    }

    .postupdate-featured-wrap .postupdate-featured-btn:focus,
    .postupdate-featured-wrap .postupdate-cancel-btn:focus,
    .postupdate-featured-wrap .postupdate-update-btn:focus {
        outline: 3px solid var(--dgape-text-primary);
        outline-offset: 2px;
    }
}

/* ========================================
   REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    .postupdate-featured-wrap .postupdate-modal,
    .postupdate-featured-wrap .postupdate-modal-container,
    .postupdate-featured-wrap .postupdate-featured-btn,
    .postupdate-featured-wrap .postupdate-upload-zone,
    .postupdate-featured-wrap .postupdate-cancel-btn,
    .postupdate-featured-wrap .postupdate-update-btn,
    .postupdate-featured-wrap .postupdate-progress-bar {
        transition: none;
    }

    .postupdate-featured-wrap .postupdate-featured-btn:hover,
    .postupdate-featured-wrap .postupdate-upload-zone.is-dragover {
        transform: none;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .postupdate-featured-wrap {
        display: none;
    }
}
