/**
 * MCP Workflow Engine Media Upload Styles
 */

.mcpwe-dropzone {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    position: relative;
    min-height: 150px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.mcpwe-dropzone::before {
    content: "+";
    font-size: 28px;
    font-weight: 600;
    color: #999;
    margin-bottom: 4px;
}

.mcpwe-dropzone:hover::before {
    color: #0073aa;
}

.mcpwe-dropzone:hover {
    border-color: #0073aa;
    background: #f0f0f0;
}

.mcpwe-dropzone.mcpwe-drag-over {
    border-color: #0073aa;
    background: #e8f4f8;
}

.mcpwe-dropzone-label {
    position: relative;
    z-index: 0;
    color: #666;
    font-size: 14px;
}

.mcpwe-upload-list {
    margin-top: 10px;
}

.mcpwe-upload-item {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mcpwe-upload-filename {
    flex: 1;
    font-size: 13px;
    color: #333;
}

.mcpwe-upload-progress {
    flex: 1;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    overflow: hidden;
}

.mcpwe-upload-progress-bar {
    height: 100%;
    background: #0073aa;
    width: 0%;
    transition: width 0.2s;
}

.mcpwe-upload-status {
    font-size: 12px;
    color: #666;
    min-width: 100px;
    text-align: right;
}

.mcpwe-upload-item.mcpwe-upload-error .mcpwe-upload-status {
    color: #d63638;
}

.mcpwe-upload-item.mcpwe-upload-success .mcpwe-upload-status {
    color: #00a32a;
}

.mcpwe-preview {
    margin-top: 10px;
}

.mcpwe-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Featured image preview: constrained thumbnail with dark frame */
#mcpwe-primary-preview {
    max-width: 320px;
    background: #1e1e1e;
    padding: 8px;
    border-radius: 8px;
    display: inline-block;
}

#mcpwe-primary-preview img {
    max-height: 200px;
    width: auto;
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain;
    display: block;
    border-radius: 4px;
}

#mcpwe-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.mcpwe-dropzone[data-type="gallery"] {
    width: 100%;
    max-width: 100%;
    height: 60px;
    min-height: 60px;
    padding: 8px;
    margin-bottom: 12px;
    border-radius: 8px;
}

.mcpwe-dropzone[data-type="gallery"]::before {
    font-size: 22px;
}

.mcpwe-dropzone[data-type="gallery"] span {
    font-size: 13px;
}

#mcpwe-gallery-grid,
.mcpwe-upload-list,
.mcpwe-dropzone {
    max-width: 100%;
}

/* Featured row: drop zone + preview in one line */
.mcpwe-featured-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 10px;
}

.mcpwe-featured-row .mcpwe-dropzone {
    width: 140px;
    height: 140px;
}

.mcpwe-gallery-item {
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    background: #f5f5f5;
}

.mcpwe-gallery-thumb {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
    border-radius: 4px;
}

.mcpwe-gallery-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.mcpwe-gallery-item:hover .mcpwe-gallery-remove {
    opacity: 1;
}

.mcpwe-gallery-remove:hover {
    background: rgba(214, 54, 56, 0.9);
}

.mcpwe-upload-help {
    font-size: 13px;
    color: #666;
    margin: 8px 0;
}

@media (max-width: 600px) {
    #mcpwe-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .mcpwe-featured-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .mcpwe-featured-row .mcpwe-dropzone {
        width: 100%;
        height: 120px;
    }

    .mcpwe-featured-row .mcpwe-preview img {
        width: 100%;
        height: auto;
        max-width: 100%;
    }
}

