.remove-background-settings {
    width: 100%;
}


/* =========================================
   AI STATUS
========================================= */

.background-ai-card {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 20px;

    padding: 16px;

    border-radius: 12px;

    background: #f5f3ff;
}


.background-ai-info {
    display: flex;

    flex-direction: column;

    gap: 4px;
}


.background-ai-info span {
    font-size: 13px;

    color: #6b7280;
}


.background-ai-status {
    flex: 0 0 auto;

    padding: 7px 10px;

    border-radius: 20px;

    font-size: 12px;
    font-weight: 700;

    background: #e5e7eb;
    color: #4b5563;
}


.background-ai-status.loading {
    background: #fef3c7;
    color: #92400e;
}


.background-ai-status.ready {
    background: var(--green-hover);
    color: var(--green-text);
}


.background-ai-status.error {
    background: #fee2e2;
    color: #991b1b;
}


/* =========================================
   SECTIONS
========================================= */

.background-setting-section {
    margin-bottom: 20px;

    padding: 18px;

    background: #ffffff;

    border: 1px solid #e5e7eb;
    border-radius: 14px;

    transition:
        opacity 0.2s ease,
        border-color 0.2s ease;
}


.background-setting-section.disabled {
    opacity: 0.5;
}


.background-setting-title {
    margin-bottom: 5px;

    font-size: 16px;
    font-weight: 750;
}


.background-setting-help {
    margin-bottom: 14px;

    font-size: 13px;

    color: #6b7280;
}


.background-setting-header {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;
}


/* =========================================
   BACKGROUND MODE
========================================= */

.background-mode-buttons {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(130px, 1fr)
        );

    gap: 10px;
}


.background-mode-btn {
    padding: 11px 12px;

    background: #ffffff;

    border: 1px solid #d1d5db;
    border-radius: 10px;

    cursor: pointer;
}


.background-mode-btn.active {
    border-color: var(--violet);

    box-shadow:
        0 0 0 2px
        rgba(91, 33, 182, 0.12);
}


.background-extra-setting {
    display: flex;

    align-items: center;

    gap: 12px;

    margin-top: 15px;
}


.background-extra-setting.hidden {
    display: none;
}


#backgroundReplacementColor {
    width: 54px;
    height: 38px;
}


/* =========================================
   FORMAT
========================================= */

.background-output-formats {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(130px, 1fr)
        );

    gap: 10px;
}


.background-format-btn {
    min-height: 70px;

    display: flex;

    flex-direction: column;

    align-items: flex-start;
    justify-content: center;

    gap: 4px;

    padding: 12px;

    background: #ffffff;

    border: 1px solid #d1d5db;
    border-radius: 10px;

    cursor: pointer;
}


.background-format-btn.active {
    border-color: var(--violet);

    box-shadow:
        0 0 0 2px
        rgba(91, 33, 182, 0.12);
}


.background-format-btn:disabled {
    opacity: 0.35;

    cursor: not-allowed;
}


.background-format-btn span {
    font-size: 12px;

    color: #6b7280;
}


#backgroundEdgeSoftness,
#backgroundOutputQuality {
    width: 100%;
}


/* =========================================
   VALIDATION
========================================= */

.background-validation {
    margin-bottom: 20px;

    padding: 12px 14px;

    border-radius: 10px;

    background: #f3f4f6;

    color: #6b7280;

    font-weight: 600;
}


.background-validation.valid {
    background: var(--green-hover);

    color: var(--green-text);
}


.background-validation.error {
    background: #fee2e2;

    color: #991b1b;
}


/* =========================================
   PREVIEW
========================================= */

.background-preview {
    margin-top: 22px;
}


.background-preview.hidden {
    display: none;
}


.background-preview-title {
    margin-bottom: 12px;

    font-size: 17px;
    font-weight: 750;
}


.background-preview-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 16px;
}


.background-preview-panel {
    display: flex;

    flex-direction: column;

    gap: 8px;
}


.background-preview-panel > span {
    font-size: 13px;

    font-weight: 700;

    color: #4b5563;
}


.background-preview-image-box {
    min-height: 280px;

    display: flex;

    align-items: center;
    justify-content: center;

    overflow: hidden;

    padding: 10px;

    border: 1px solid #e5e7eb;
    border-radius: 12px;

    background: #f9fafb;
}


.background-preview-image-box img {
    display: block;

    max-width: 100%;
    max-height: 420px;

    object-fit: contain;
}


.checkerboard {
    background-color: #ffffff;

    background-image:
        linear-gradient(
            45deg,
            #e5e7eb 25%,
            transparent 25%
        ),
        linear-gradient(
            -45deg,
            #e5e7eb 25%,
            transparent 25%
        ),
        linear-gradient(
            45deg,
            transparent 75%,
            #e5e7eb 75%
        ),
        linear-gradient(
            -45deg,
            transparent 75%,
            #e5e7eb 75%
        );

    background-size:
        20px 20px;

    background-position:
        0 0,
        0 10px,
        10px -10px,
        -10px 0;
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 700px) {

    .background-ai-card {
        align-items: flex-start;

        flex-direction: column;
    }


    .background-mode-buttons,
    .background-output-formats,
    .background-preview-grid {
        grid-template-columns: 1fr;
    }


    .background-setting-header {
        flex-direction: column;

        gap: 4px;
    }

}
/* Output-format guidance: keep the note visually attached to the choices. */
.background-output-hint {
    margin-top: 12px;
    margin-bottom: 0;
}

/* Final shared-preview / AI status refinements */
.background-ai-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(190px, 300px);
    align-items: center;
}
.background-ai-status {
    width: 100%;
    box-sizing: border-box;
    white-space: normal;
    line-height: 1.35;
    text-align: center;
    overflow-wrap: anywhere;
}
.background-extra-setting .eft-file-picker { width: 100%; }
#backgroundPreview { margin-top: 22px; }
#backgroundPreview .background-preview-grid { margin-top: 2px; }

@media (max-width: 700px) {
    .background-ai-card { grid-template-columns: 1fr; }
    .background-ai-status { max-width: none; }
}
