/* =========================================
   IMAGE UPSCALER
   ========================================= */

.tool-page {
    min-height: calc(100vh - 70px);
    padding: 50px 20px 80px;
    background: #f7f8fa;
}

.tool-page-container {
    width: min(1100px, 100%);
    margin: 0 auto;
}


/* =========================================
   HEADER
   ========================================= */

.tool-page-header {
    text-align: center;
    margin-bottom: 35px;
}

.section-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.6px;
    color: #667085;
    margin-bottom: 10px;
}

.tool-page-header h1 {
    margin: 0;
    font-size: 38px;
    line-height: 1.15;
    font-weight: 700;
    color: #172033;
}

.tool-page-header p {
    max-width: 650px;
    margin: 14px auto 0;
    color: #667085;
    font-size: 15px;
    line-height: 1.7;
}


/* =========================================
   MAIN CARD
   ========================================= */

.upscaler-card {
    background: #ffffff;
    border: 1px solid #e4e7ec;
    border-radius: 18px;
    padding: 28px;
    box-shadow:
        0 8px 30px rgba(16, 24, 40, 0.06);
}


/* =========================================
   UPLOAD AREA
   ========================================= */

.upscaler-upload {
    border: 1.5px dashed #cfd5df;
    border-radius: 14px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 35px 20px;
    background: #fafbfc;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.upscaler-upload.drag-over {
    border-color: #667085;
    background: #f2f4f7;
    transform: translateY(-1px);
}

.upscaler-upload-icon {
    width: 62px;
    height: 62px;
    border-radius: 16px;
    background: #eef1f5;
    color: #344054;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 500;
    margin-bottom: 18px;
}

.upscaler-upload h2 {
    margin: 0;
    font-size: 21px;
    color: #172033;
}

.upscaler-upload p {
    margin: 8px 0 20px;
    color: #667085;
    font-size: 14px;
}

.upload-note {
    margin-top: 14px;
    color: #98a2b3;
    font-size: 12px;
}


/* =========================================
   BUTTONS
   ========================================= */

.primary-btn,
.secondary-btn {
    border: 0;
    border-radius: 9px;
    min-height: 44px;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition:
        background 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.primary-btn {
    background: var(--gp-gradient);
    color: #ffffff;
}

.primary-btn:hover {
    background: var(--gp-gradient-hover);
    transform: translateY(-1px);
    box-shadow:
        0 5px 14px rgba(0, 132, 250, 0.30);
}

.secondary-btn {
    background: #ffffff;
    color: #344054;
    border: 1px solid #d0d5dd;
}

.secondary-btn:hover {
    background: #f9fafb;
}


/* =========================================
   FILE INFORMATION
   ========================================= */

.upscaler-info {
    margin-top: 22px;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    padding: 20px;
    border: 1px solid #eaecf0;
    border-radius: 14px;
    background: #fcfcfd;
}

.upscaler-preview-box {
    height: 190px;
    border-radius: 10px;
    overflow: hidden;
    background:
        linear-gradient(45deg, #f2f4f7 25%, transparent 25%),
        linear-gradient(-45deg, #f2f4f7 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f2f4f7 75%),
        linear-gradient(-45deg, transparent 75%, #f2f4f7 75%);
    background-size: 20px 20px;
    background-position:
        0 0,
        0 10px,
        10px -10px,
        -10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upscaler-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.upscaler-file-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-content: center;
}

.upscaler-file-details > div {
    padding: 14px;
    background: #ffffff;
    border: 1px solid #eaecf0;
    border-radius: 10px;
}

.detail-label {
    display: block;
    margin-bottom: 5px;
    color: #98a2b3;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.upscaler-file-details strong {
    display: block;
    color: #344054;
    font-size: 13px;
    word-break: break-word;
}

.status-ready {
    color: #344054 !important;
}


/* =========================================
   UPSCALE ACTION
   ========================================= */

.upscaler-action {
    margin-top: 22px;
    padding: 22px;
    border: 1px solid #eaecf0;
    border-radius: 14px;
    background: #ffffff;
}

.scale-section {
    margin-bottom: 20px;
}

.scale-title {
    font-size: 13px;
    font-weight: 600;
    color: #344054;
    margin-bottom: 12px;
}

.scale-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.scale-option {
    position: relative;
    cursor: pointer;
}

.scale-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.scale-option-content {
    min-height: 70px;
    padding: 14px 16px;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}

.scale-option-content strong {
    font-size: 18px;
    color: #172033;
}

.scale-option-content small {
    margin-top: 4px;
    color: #667085;
    font-size: 12px;
}

.scale-option:hover .scale-option-content {
    border-color: #98a2b3;
}

.scale-option input:checked
+ .scale-option-content {
    border-color: #344054;
    background: #f8f9fb;
    box-shadow:
        inset 0 0 0 1px #344054;
}

.upscale-btn {
    width: 100%;
}


/* =========================================
   LOADING
   ========================================= */

.upscaler-loading {
    padding: 45px 20px;
    text-align: center;
}

.loading-spinner {
    width: 38px;
    height: 38px;
    border: 3px solid #e4e7ec;
    border-top-color: #344054;
    border-radius: 50%;
    margin: 0 auto 18px;
    animation: upscaleSpin 0.8s linear infinite;
}

@keyframes upscaleSpin {
    to {
        transform: rotate(360deg);
    }
}

.upscaler-loading h3 {
    margin: 0;
    color: #172033;
    font-size: 17px;
}

.upscaler-loading p {
    margin: 7px 0 0;
    color: #667085;
    font-size: 13px;
}


/* =========================================
   RESULT
   ========================================= */

.upscaler-result {
    margin-top: 24px;
    padding: 24px;
    border: 1px solid #eaecf0;
    border-radius: 14px;
    background: #fcfcfd;
}

.result-heading {
    margin-bottom: 22px;
}

.result-heading h2 {
    margin: 0;
    font-size: 22px;
    color: #172033;
}

.result-comparison {
    display: grid;
    grid-template-columns: 1fr 45px 1fr;
    align-items: center;
    gap: 15px;
}

.result-image-box {
    min-width: 0;
}

.result-image-label {
    margin-bottom: 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #667085;
}

.result-image-wrapper {
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e4e7ec;
    background:
        linear-gradient(45deg, #f2f4f7 25%, transparent 25%),
        linear-gradient(-45deg, #f2f4f7 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f2f4f7 75%),
        linear-gradient(-45deg, transparent 75%, #f2f4f7 75%);
    background-size: 20px 20px;
    background-position:
        0 0,
        0 10px,
        10px -10px,
        -10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.result-arrow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #eef1f5;
    color: #344054;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.result-dimensions {
    margin-top: 9px;
    color: #667085;
    font-size: 12px;
    text-align: center;
}


/* =========================================
   RESULT META
   ========================================= */

.result-meta {
    margin-top: 22px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.result-meta > div {
    padding: 13px;
    border: 1px solid #eaecf0;
    border-radius: 9px;
    background: #ffffff;
    text-align: center;
}

.result-meta span {
    display: block;
    margin-bottom: 5px;
    color: #98a2b3;
    font-size: 11px;
}

.result-meta strong {
    color: #344054;
    font-size: 14px;
}


/* =========================================
   RESULT ACTIONS
   ========================================= */

.result-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 22px;
    flex-wrap: wrap;
}


/* =========================================
   ERROR
   ========================================= */

.upscaler-error {
    margin-top: 20px;
    padding: 15px 17px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    background: #fafafa;
}

.error-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
    background: #eef1f5;
    color: #344054;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.upscaler-error strong {
    color: #344054;
    font-size: 13px;
}

.upscaler-error p {
    margin: 4px 0 0;
    color: #667085;
    font-size: 12px;
}


/* =========================================
   INFORMATION SECTION
   ========================================= */

.upscaler-information {
    margin-top: 45px;
}

.upscaler-information h2 {
    margin: 0;
    font-size: 26px;
    color: #172033;
}

.upscaler-information > p {
    max-width: 750px;
    margin: 10px 0 25px;
    color: #667085;
    font-size: 14px;
    line-height: 1.7;
}

.upscaler-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.feature-item {
    padding: 18px;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    background: #ffffff;
}

.feature-item strong {
    display: block;
    color: #344054;
    font-size: 14px;
}

.feature-item span {
    display: block;
    margin-top: 6px;
    color: #667085;
    font-size: 12px;
    line-height: 1.5;
}


/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 800px) {

    .tool-page {
        padding: 35px 15px 60px;
    }

    .tool-page-header h1 {
        font-size: 30px;
    }

    .upscaler-card {
        padding: 18px;
    }

    .upscaler-info {
        grid-template-columns: 1fr;
    }

    .upscaler-preview-box {
        height: 220px;
    }

    .result-comparison {
        grid-template-columns: 1fr;
    }

    .result-arrow {
        margin: 0 auto;
        transform: rotate(90deg);
    }

    .result-meta {
        grid-template-columns: 1fr;
    }

    .upscaler-features {
        grid-template-columns: 1fr;
    }
}


@media (max-width: 520px) {

    .tool-page-header h1 {
        font-size: 26px;
    }

    .upscaler-upload {
        min-height: 260px;
        padding: 25px 15px;
    }

    .upscaler-file-details {
        grid-template-columns: 1fr;
    }

    .scale-options {
        grid-template-columns: 1fr;
    }

    .result-image-wrapper {
        height: 240px;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-actions .primary-btn,
    .result-actions .secondary-btn {
        width: 100%;
    }
}


/* 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;
}
