.tool-page {
    min-height: 100vh;
    padding: 48px 20px 80px;
    background: #f7f9fc;
}

.tool-page-container {
    width: min(1100px, 100%);
    margin: 0 auto;
}

/* =========================
   HEADER
========================= */

.tool-page-header {
    text-align: center;
    margin-bottom: 36px;
}

.section-label {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #667085;
}

.tool-page-header h1 {
    margin: 0;
    color: #172033;
    font-size: clamp(30px, 5vw, 46px);
    line-height: 1.15;
    font-weight: 750;
}

.tool-page-header p {
    max-width: 680px;
    margin: 14px auto 0;
    color: #667085;
    font-size: 16px;
    line-height: 1.7;
}


/* =========================
   MAIN CARD
========================= */

.background-remover-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 8px 30px rgba(16, 24, 40, 0.06);
}


/* =========================
   UPLOAD
========================= */

.background-upload {
    min-height: 330px;
    padding: 45px 25px;
    border: 2px dashed #d6dae3;
    border-radius: 16px;
    background: #fafbfc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.background-upload:hover {
    border-color: #98a2b3;
    background: #f8fafc;
}

.background-upload.drag-over {
    border-color: #344054;
    background: #f2f4f7;
    transform: scale(1.01);
}

.background-upload-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 18px;
    border-radius: 16px;
    background: #eef2f6;
    color: #344054;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 700;
}

.background-upload h2 {
    margin: 0;
    color: #1d2939;
    font-size: 22px;
    font-weight: 700;
}

.background-upload p {
    margin: 9px 0 6px;
    color: #667085;
    font-size: 14px;
}

.upload-formats {
    margin-bottom: 22px;
    color: #98a2b3;
    font-size: 12px;
}


/* =========================
   BUTTONS
========================= */

.primary-btn,
.remove-background-btn,
.secondary-btn {
    border: 0;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

.primary-btn {
    color: #ffffff;
    background: var(--gp-gradient);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-btn:hover {
    background: var(--gp-gradient-hover);
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(0, 132, 250, 0.30);
}

.remove-background-btn {
    width: 100%;
    color: #ffffff;
    background: var(--gp-gradient);
}

.remove-background-btn:hover {
    background: var(--gp-gradient-hover);
    transform: translateY(-1px);
}

.secondary-btn {
    color: #344054;
    background: #ffffff;
    border: 1px solid #d0d5dd;
}

.secondary-btn:hover {
    background: #f9fafb;
}


/* =========================
   FILE INFORMATION
========================= */

.background-info {
    margin-top: 24px;
    padding: 20px;
    border: 1px solid #eaecf0;
    border-radius: 14px;
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 22px;
    align-items: center;
}

.background-preview-wrapper {
    min-width: 0;
}

.preview-label {
    display: block;
    margin-bottom: 9px;
    color: #667085;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.background-preview {
    height: 130px;
    border-radius: 10px;
    overflow: hidden;
    background: #f2f4f7;
    border: 1px solid #eaecf0;
}

.background-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.background-file-details h3 {
    margin: 0 0 7px;
    color: #1d2939;
    font-size: 16px;
    word-break: break-word;
}

.background-file-details p {
    margin: 4px 0;
    color: #667085;
    font-size: 13px;
}

.background-file-details .file-status {
    color: #344054;
    font-weight: 600;
}


/* =========================
   ACTION
========================= */

.background-action {
    margin-top: 20px;
}


/* =========================
   LOADING
========================= */

.background-loading {
    margin-top: 22px;
    padding: 32px 20px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #eaecf0;
    text-align: center;
}

.loading-spinner {
    width: 38px;
    height: 38px;
    margin: 0 auto 16px;
    border: 3px solid #e4e7ec;
    border-top-color: #344054;
    border-radius: 50%;
    animation: backgroundSpinner 0.8s linear infinite;
}

@keyframes backgroundSpinner {
    to {
        transform: rotate(360deg);
    }
}

.background-loading h3 {
    margin: 0;
    color: #1d2939;
    font-size: 16px;
}

.background-loading p {
    margin: 7px 0 0;
    color: #667085;
    font-size: 13px;
}


/* =========================
   RESULT
========================= */

.background-result {
    margin-top: 24px;
    padding: 24px;
    border: 1px solid #eaecf0;
    border-radius: 16px;
    background: #ffffff;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 24px;
}

.result-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 50%;
    background: #f2f4f7;
    color: #344054;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    font-weight: 700;
}

.result-header h2 {
    margin: 0;
    color: #1d2939;
    font-size: 19px;
}

.result-header p {
    margin: 4px 0 0;
    color: #667085;
    font-size: 13px;
}


/* =========================
   BEFORE / AFTER
========================= */

.result-preview-area {
    display: grid;
    grid-template-columns: 1fr 45px 1fr;
    gap: 16px;
    align-items: center;
}

.result-preview-box {
    min-width: 0;
}

.result-image-container {
    height: 300px;
    overflow: hidden;
    border: 1px solid #eaecf0;
    border-radius: 12px;
    background: #f8fafc;
}

.result-image-container img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.result-arrow {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #f2f4f7;
    color: #475467;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
}

.transparent-preview .result-image-container {
    background-color: #ffffff;
    background-image:
        linear-gradient(45deg, #edf0f3 25%, transparent 25%),
        linear-gradient(-45deg, #edf0f3 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #edf0f3 75%),
        linear-gradient(-45deg, transparent 75%, #edf0f3 75%);
    background-size: 20px 20px;
    background-position:
        0 0,
        0 10px,
        10px -10px,
        -10px 0;
}


/* =========================
   RESULT ACTIONS
========================= */

.result-actions {
    margin-top: 22px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.download-btn {
    min-width: 150px;
}

.secondary-btn {
    min-width: 180px;
}


/* =========================
   ERROR
========================= */

.background-error {
    margin-top: 20px;
    padding: 15px 17px;
    border: 1px solid #eaecf0;
    border-radius: 10px;
    background: #fafafa;
}

.background-error strong {
    color: #1d2939;
    font-size: 14px;
}

.background-error p {
    margin: 5px 0 0;
    color: #667085;
    font-size: 13px;
}


/* =========================
   INFORMATION SECTION
========================= */

.tool-information {
    margin-top: 55px;
}

.tool-information-header {
    text-align: center;
    margin-bottom: 28px;
}

.tool-information-header h2 {
    margin: 0;
    color: #172033;
    font-size: 28px;
}

.tool-information-header p {
    max-width: 650px;
    margin: 10px auto 0;
    color: #667085;
    font-size: 14px;
    line-height: 1.7;
}

.information-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.information-card {
    padding: 24px;
    border: 1px solid #eaecf0;
    border-radius: 14px;
    background: #ffffff;
}

.information-number {
    margin-bottom: 18px;
    color: #98a2b3;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
}

.information-card h3 {
    margin: 0 0 8px;
    color: #1d2939;
    font-size: 17px;
}

.information-card p {
    margin: 0;
    color: #667085;
    font-size: 13px;
    line-height: 1.65;
}


/* =========================
   FEATURES
========================= */

.tool-features {
    margin-top: 18px;
    padding: 20px;
    border: 1px solid #eaecf0;
    border-radius: 14px;
    background: #ffffff;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.feature-item {
    padding: 6px 18px;
    border-right: 1px solid #eaecf0;
}

.feature-item:last-child {
    border-right: 0;
}

.feature-item strong {
    display: block;
    margin-bottom: 5px;
    color: #344054;
    font-size: 13px;
}

.feature-item span {
    color: #98a2b3;
    font-size: 12px;
    line-height: 1.5;
}


/* =========================
   MOBILE
========================= */

@media (max-width: 800px) {

    .tool-page {
        padding: 32px 15px 60px;
    }

    .background-remover-card {
        padding: 18px;
        border-radius: 15px;
    }

    .background-info {
        grid-template-columns: 1fr;
    }

    .background-preview {
        height: 220px;
    }

    .result-preview-area {
        grid-template-columns: 1fr;
    }

    .result-arrow {
        margin: 0 auto;
        transform: rotate(90deg);
    }

    .information-grid {
        grid-template-columns: 1fr;
    }

    .tool-features {
        grid-template-columns: 1fr 1fr;
    }

    .feature-item {
        border-right: 0;
        border-bottom: 1px solid #eaecf0;
        padding: 14px;
    }

    .feature-item:nth-child(odd) {
        border-right: 1px solid #eaecf0;
    }

    .feature-item:nth-child(3),
    .feature-item:nth-child(4) {
        border-bottom: 0;
    }
}


@media (max-width: 500px) {

    .tool-page-header h1 {
        font-size: 30px;
    }

    .tool-page-header p {
        font-size: 14px;
    }

    .background-upload {
        min-height: 280px;
        padding: 30px 18px;
    }

    .result-image-container {
        height: 230px;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-actions .primary-btn,
    .result-actions .secondary-btn {
        width: 100%;
    }

    .tool-features {
        grid-template-columns: 1fr;
    }

    .feature-item,
    .feature-item:nth-child(odd) {
        border-right: 0;
        border-bottom: 1px solid #eaecf0;
    }

    .feature-item:last-child {
        border-bottom: 0;
    }
}


/* The HTML "hidden" attribute must win over the display rules above,
   otherwise the preview, error and result boxes are all visible on load. */
[hidden] {
    display: none !important;
}
