/**
 * Divi Form File Upload v3.0 - Frontend Styles
 * Includes preview cards with thumbnails and status indicators.
 */

/* ── Wrapper ── */
.dffu-upload-wrapper {
    margin: 0 0 20px 0;
    width: 100%;
}

.dffu-upload-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: inherit;
    font-size: inherit;
}

.dffu-upload-label .et_pb_contact_form_label_required,
.dffu-upload-label .dffu-required {
    color: #e74c3c;
    margin-left: 2px;
}

/* ── Dropzone ── */
.dffu-dropzone {
    position: relative;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: rgba(0, 0, 0, 0.02);
}

.dffu-dropzone:hover,
.dffu-dropzone.dffu-dragover {
    border-color: #2ea3f2;
    background-color: rgba(46, 163, 242, 0.05);
}

.dffu-dropzone.dffu-dragover {
    transform: scale(1.01);
}

.dffu-dropzone-icon {
    display: block;
    margin: 0 auto 10px;
    width: 40px;
    height: 40px;
    opacity: 0.5;
}

.dffu-dropzone-text {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.dffu-dropzone-meta {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #999;
}

.dffu-file-input {
    display: none !important;
}

/* ── File Preview Cards ── */
.dffu-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.dffu-file-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    width: 100%;
    animation: dffu-slide-in 0.3s ease;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.dffu-file-card.dffu-uploaded {
    border-color: #27ae60;
    background: #f0faf4;
}

@keyframes dffu-slide-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Preview area (thumbnail or icon) */
.dffu-preview {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e5e5e5;
}

.dffu-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

.dffu-file-type-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #fff;
    border-radius: 5px;
    background: #2ea3f2;
}

.dffu-file-type-icon.dffu-icon-image { background: #e67e22; }
.dffu-file-type-icon.dffu-icon-pdf   { background: #e74c3c; }
.dffu-file-type-icon.dffu-icon-doc   { background: #3498db; }
.dffu-file-type-icon.dffu-icon-xls   { background: #27ae60; }
.dffu-file-type-icon.dffu-icon-zip   { background: #9b59b6; }

/* Card info */
.dffu-card-info {
    flex: 1;
    min-width: 0;
}

.dffu-card-name {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
    margin-bottom: 2px;
}

.dffu-card-meta {
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
}

/* Status indicator */
.dffu-card-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}

.dffu-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dffu-status-dot.dffu-status-uploading {
    background: #f39c12;
    animation: dffu-pulse 1s infinite;
}

.dffu-status-dot.dffu-status-ready {
    background: #27ae60;
}

@keyframes dffu-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

.dffu-file-card.dffu-uploaded .dffu-card-status {
    color: #27ae60;
}

/* Progress bar */
.dffu-card-progress {
    width: 100%;
    height: 4px;
    background: #e5e5e5;
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.dffu-card-progress-bar {
    height: 100%;
    background: #2ea3f2;
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Remove button */
.dffu-card-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0,0,0,0.05);
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.dffu-card-remove:hover {
    background: rgba(231, 76, 60, 0.12);
    color: #e74c3c;
}

.dffu-file-card.dffu-uploading .dffu-card-remove {
    display: none;
}

/* ── Error ── */
.dffu-error-message {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(231, 76, 60, 0.08);
    border-radius: 6px;
    animation: dffu-slide-in 0.3s ease;
}

.dffu-upload-wrapper.dffu-has-error .dffu-dropzone {
    border-color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.03);
}

/* ── Dark Sections ── */
.et_pb_section--dark .dffu-dropzone,
.et_pb_bg_layout_dark .dffu-dropzone {
    border-color: rgba(255,255,255,0.3);
    background-color: rgba(255,255,255,0.05);
}
.et_pb_section--dark .dffu-dropzone-text,
.et_pb_bg_layout_dark .dffu-dropzone-text { color: rgba(255,255,255,0.7); }
.et_pb_section--dark .dffu-dropzone-meta,
.et_pb_bg_layout_dark .dffu-dropzone-meta { color: rgba(255,255,255,0.5); }
.et_pb_section--dark .dffu-file-card,
.et_pb_bg_layout_dark .dffu-file-card {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}
.et_pb_section--dark .dffu-file-card.dffu-uploaded,
.et_pb_bg_layout_dark .dffu-file-card.dffu-uploaded {
    background: rgba(39,174,96,0.1);
    border-color: rgba(39,174,96,0.4);
}
.et_pb_section--dark .dffu-card-name,
.et_pb_bg_layout_dark .dffu-card-name { color: rgba(255,255,255,0.9); }
.et_pb_section--dark .dffu-card-meta,
.et_pb_bg_layout_dark .dffu-card-meta { color: rgba(255,255,255,0.5); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .dffu-dropzone { padding: 20px 15px; }
    .dffu-preview { width: 56px; height: 56px; }
    .dffu-file-card { gap: 10px; padding: 10px; }
}
