/* =========================
   RESET
========================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background:
        radial-gradient(
            circle at top,
            #17202c 0%,
            #0b0f14 42%,
            #070a0e 100%
        );

    color: #f2f5f8;
}


/* =========================
   PAGE
========================= */

.page {
    width: min(
        1100px,
        calc(100% - 32px)
    );

    margin: 0 auto;

    padding:
        24px
        0
        60px;
}


/* =========================
   HERO
========================= */

.hero {
    text-align: center;

    padding:
        20px
        0
        34px;
}

.back-link {
    display: inline-flex;

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

    margin-bottom: 24px;

    color: #aeb8c4;

    text-decoration: none;

    font-size: 14px;
    font-weight: 600;

    transition:
        color 0.2s ease,
        transform 0.2s ease;
}

.back-link:hover {
    color: #ffffff;
    transform: translateX(-3px);
}

.hero-icon {
    width: 72px;
    height: 72px;

    margin: 0 auto 18px;

    display: flex;

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

    border-radius: 20px;

    background:
        linear-gradient(
            145deg,
            #1d2b3a,
            #101720
        );

    border:
        1px solid
        rgba(255, 255, 255, 0.08);

    box-shadow:
        0 18px 45px
        rgba(0, 0, 0, 0.35);

    font-size: 34px;
}

.hero h1 {
    margin:
        0
        0
        10px;

    font-size:
        clamp(
            30px,
            6vw,
            48px
        );

    line-height: 1.1;

    letter-spacing: -1.2px;
}

.hero p {
    max-width: 680px;

    margin:
        0 auto 18px;

    color: #9da8b5;

    font-size: 16px;
    line-height: 1.7;
}

.privacy-badge {
    display: inline-flex;

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

    padding:
        8px
        13px;

    border-radius: 999px;

    background:
        rgba(38, 180, 116, 0.08);

    border:
        1px solid
        rgba(38, 180, 116, 0.22);

    color: #9fe2c1;

    font-size: 13px;
    font-weight: 600;
}


/* =========================
   CARD
========================= */

.card {
    margin-bottom: 18px;

    padding: 22px;

    border-radius: 18px;

    background:
        rgba(16, 22, 29, 0.9);

    border:
        1px solid
        rgba(255, 255, 255, 0.07);

    box-shadow:
        0 16px 45px
        rgba(0, 0, 0, 0.18);

    backdrop-filter:
        blur(12px);
}


/* =========================
   DROP AREA
========================= */

.drop-area {
    min-height: 290px;

    padding: 35px 20px;

    display: flex;

    flex-direction: column;

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

    text-align: center;

    border:
        1px dashed
        rgba(255, 255, 255, 0.17);

    border-radius: 15px;

    background:
        rgba(255, 255, 255, 0.015);

    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.drop-area.drag-over {
    border-color: #62a8ff;

    background:
        rgba(98, 168, 255, 0.07);

    transform: scale(1.005);
}

.upload-icon {
    width: 68px;
    height: 68px;

    margin-bottom: 15px;

    display: flex;

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

    border-radius: 18px;

    background:
        rgba(91, 145, 255, 0.09);

    font-size: 32px;
}

.drop-area h2 {
    margin:
        0
        0
        8px;

    font-size: 22px;
}

.drop-area p {
    margin:
        0
        0
        20px;

    color: #8f9ba8;

    line-height: 1.6;
}

.drop-area small {
    margin-top: 12px;

    color: #687482;

    font-size: 12px;
}


/* =========================
   BUTTONS
========================= */

button {
    font: inherit;
}

.primary-button,
.secondary-button {
    min-height: 44px;

    padding:
        10px
        17px;

    border-radius: 11px;

    cursor: pointer;

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

    transition:
        transform 0.18s ease,
        opacity 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease;
}

.primary-button {
    border:
        1px solid
        rgba(255, 255, 255, 0.08);

    background:
        linear-gradient(
            135deg,
            #356cff,
            #4591e8
        );

    color: #ffffff;

    box-shadow:
        0 10px 24px
        rgba(53, 108, 255, 0.2);
}

.secondary-button {
    border:
        1px solid
        rgba(255, 255, 255, 0.1);

    background:
        rgba(255, 255, 255, 0.045);

    color: #dce3ea;
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.secondary-button:hover:not(:disabled) {
    background:
        rgba(255, 255, 255, 0.075);

    border-color:
        rgba(255, 255, 255, 0.16);
}

.primary-button:disabled,
.secondary-button:disabled {
    opacity: 0.4;

    cursor: not-allowed;

    transform: none;
}


/* =========================
   SECTION HEADER
========================= */

.section-header {
    display: flex;

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

    gap: 15px;

    margin-bottom: 18px;
}

.section-header h2 {
    margin: 0 0 5px;

    font-size: 20px;
}

.section-header p {
    margin: 0;

    color: #7f8b98;

    font-size: 13px;
    line-height: 1.5;
}


/* =========================
   FILE INFO
========================= */

.file-info {
    display: flex;

    align-items: center;

    gap: 15px;

    padding: 16px;

    border-radius: 13px;

    background:
        rgba(255, 255, 255, 0.035);

    border:
        1px solid
        rgba(255, 255, 255, 0.06);
}

.file-icon {
    width: 52px;
    height: 52px;

    flex: 0 0 52px;

    display: flex;

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

    border-radius: 13px;

    background:
        rgba(231, 76, 60, 0.09);

    font-size: 25px;
}

.file-details {
    min-width: 0;

    display: flex;

    flex-direction: column;

    gap: 4px;
}

.file-details strong {
    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    font-size: 15px;
}

.file-details span {
    color: #7f8a97;

    font-size: 12px;
}


/* =========================
   RANGE BOX
========================= */

.range-box {
    margin-bottom: 18px;

    padding: 17px;

    border-radius: 14px;

    background:
        rgba(255, 255, 255, 0.025);

    border:
        1px solid
        rgba(255, 255, 255, 0.06);
}

.range-box label {
    display: block;

    margin-bottom: 9px;

    color: #dbe2e9;

    font-size: 13px;
    font-weight: 700;
}

.range-row {
    display: flex;

    gap: 9px;
}

.range-row input {
    flex: 1;

    min-width: 0;

    height: 44px;

    padding:
        0
        13px;

    border-radius: 10px;

    border:
        1px solid
        rgba(255, 255, 255, 0.1);

    outline: none;

    background:
        #0b1016;

    color: #f0f4f8;

    font-size: 14px;
}

.range-row input::placeholder {
    color: #596572;
}

.range-row input:focus {
    border-color:
        rgba(99, 153, 255, 0.65);

    box-shadow:
        0 0 0 3px
        rgba(99, 153, 255, 0.08);
}

.range-box > small {
    display: block;

    margin-top: 9px;

    color: #697581;

    font-size: 12px;
    line-height: 1.5;
}

.range-error {
    margin-top: 10px;

    padding: 9px 11px;

    border-radius: 9px;

    background:
        rgba(231, 76, 60, 0.08);

    border:
        1px solid
        rgba(231, 76, 60, 0.18);

    color: #ffaaa0;

    font-size: 12px;
    line-height: 1.5;
}


/* =========================
   SELECTION ACTIONS
========================= */

.selection-actions {
    display: flex;

    flex-wrap: wrap;

    gap: 9px;

    margin-bottom: 18px;
}


/* =========================
   PAGE GRID
========================= */

.page-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(
                135px,
                1fr
            )
        );

    gap: 12px;

    max-height: 700px;

    overflow-y: auto;

    padding-right: 3px;
}

.page-grid::-webkit-scrollbar {
    width: 6px;
}

.page-grid::-webkit-scrollbar-track {
    background: transparent;
}

.page-grid::-webkit-scrollbar-thumb {
    border-radius: 999px;

    background:
        rgba(255, 255, 255, 0.12);
}


/* =========================
   PAGE CARD
========================= */

.page-card {
    position: relative;

    min-height: 190px;

    padding: 10px;

    border-radius: 13px;

    border:
        1px solid
        rgba(255, 255, 255, 0.08);

    background:
        #0b1016;

    cursor: pointer;

    transition:
        border-color 0.18s ease,
        transform 0.18s ease,
        background 0.18s ease;
}

.page-card:hover {
    transform: translateY(-2px);

    border-color:
        rgba(255, 255, 255, 0.17);
}

.page-card.selected {
    border-color:
        #4e8dff;

    background:
        rgba(78, 141, 255, 0.09);

    box-shadow:
        0 0 0 1px
        rgba(78, 141, 255, 0.12);
}

.page-card input {
    position: absolute;

    top: 10px;
    left: 10px;

    width: 18px;
    height: 18px;

    margin: 0;

    accent-color: #4e8dff;

    z-index: 2;
}

.page-number {
    position: absolute;

    top: 9px;
    right: 10px;

    color: #7e8a97;

    font-size: 11px;
    font-weight: 700;
}

.page-card.selected .page-number {
    color: #a9c6ff;
}

.page-preview {
    width: 100%;

    height: 145px;

    margin-top: 23px;

    display: flex;

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

    overflow: hidden;

    border-radius: 7px;

    background:
        #e8eaed;

    color: #111;

    font-size: 13px;
}

.page-preview canvas {
    display: block;

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

    width: auto;
    height: auto;
}


/* =========================
   SELECTION SUMMARY
========================= */

.selection-summary {
    display: flex;

    flex-wrap: wrap;

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

    gap: 8px;

    margin-top: 17px;

    padding: 13px 15px;

    border-radius: 11px;

    background:
        rgba(78, 141, 255, 0.06);

    border:
        1px solid
        rgba(78, 141, 255, 0.12);
}

.selection-summary strong {
    color: #dbe8ff;

    font-size: 13px;
}

.selection-summary span {
    color: #7f8b99;

    font-size: 12px;
}


/* =========================
   SPLIT OPTIONS
========================= */

.option-grid {
    display: grid;

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

    gap: 12px;

    margin-bottom: 18px;
}

.option-card {
    position: relative;

    display: flex;

    align-items: flex-start;

    gap: 11px;

    min-height: 110px;

    padding: 15px;

    border-radius: 13px;

    border:
        1px solid
        rgba(255, 255, 255, 0.08);

    background:
        rgba(255, 255, 255, 0.025);

    cursor: pointer;

    transition:
        border-color 0.18s ease,
        background 0.18s ease;
}

.option-card:hover {
    border-color:
        rgba(255, 255, 255, 0.16);
}

.option-card:has(input:checked) {
    border-color:
        rgba(78, 141, 255, 0.65);

    background:
        rgba(78, 141, 255, 0.07);
}

.option-card input {
    width: 18px;
    height: 18px;

    flex: 0 0 18px;

    margin: 1px 0 0;

    accent-color: #4e8dff;
}

.option-content {
    display: flex;

    flex-direction: column;

    gap: 7px;
}

.option-content strong {
    font-size: 14px;
}

.option-content small {
    color: #7f8b98;

    font-size: 12px;
    line-height: 1.5;
}

.action-button {
    width: 100%;

    min-height: 50px;

    font-size: 15px;
}


/* =========================
   PROGRESS
========================= */

.progress-section {
    padding: 18px 20px;
}

.progress-header {
    display: flex;

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

    gap: 10px;

    margin-bottom: 11px;
}

.progress-header strong {
    font-size: 13px;
}

.progress-header span {
    color: #9cbcff;

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

.progress-track {
    width: 100%;

    height: 9px;

    overflow: hidden;

    border-radius: 999px;

    background:
        rgba(255, 255, 255, 0.07);
}

.progress-bar {
    width: 0;
    height: 100%;

    border-radius: inherit;

    background:
        linear-gradient(
            90deg,
            #356cff,
            #5499e8
        );

    transition:
        width 0.2s ease;
}


/* =========================
   RESULT SECTION
========================= */

.result-list {
    display: flex;

    flex-direction: column;

    gap: 10px;

    margin-bottom: 18px;
}

.result-item {
    display: flex;

    align-items: center;

    gap: 12px;

    padding: 13px;

    border-radius: 12px;

    background:
        rgba(255, 255, 255, 0.025);

    border:
        1px solid
        rgba(255, 255, 255, 0.07);
}

.result-item input {
    width: 18px;
    height: 18px;

    flex: 0 0 18px;

    accent-color: #4e8dff;
}

.result-file-icon {
    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    display: flex;

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

    border-radius: 10px;

    background:
        rgba(231, 76, 60, 0.08);

    font-size: 20px;
}

.result-details {
    min-width: 0;

    flex: 1;

    display: flex;

    flex-direction: column;

    gap: 3px;
}

.result-details strong {
    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    font-size: 13px;
}

.result-details span {
    color: #737f8c;

    font-size: 11px;
}

.result-download {
    flex: 0 0 auto;

    min-height: 38px;

    padding:
        8px
        11px;

    border-radius: 9px;

    border:
        1px solid
        rgba(255, 255, 255, 0.1);

    background:
        rgba(255, 255, 255, 0.045);

    color: #dbe3ea;

    cursor: pointer;

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

.result-download:hover {
    background:
        rgba(255, 255, 255, 0.08);
}

.result-actions {
    display: flex;

    flex-wrap: wrap;

    gap: 9px;
}


/* =========================
   INFO GRID
========================= */

.info-grid {
    display: grid;

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

    gap: 14px;

    margin-top: 18px;
}

.info-card {
    padding: 20px;

    border-radius: 16px;

    background:
        rgba(16, 22, 29, 0.78);

    border:
        1px solid
        rgba(255, 255, 255, 0.06);
}

.info-icon {
    margin-bottom: 10px;

    font-size: 24px;
}

.info-card h3 {
    margin:
        0
        0
        7px;

    font-size: 15px;
}

.info-card p {
    margin: 0;

    color: #77838f;

    font-size: 12px;

    line-height: 1.65;
}


/* =========================
   WARNING
========================= */

.warning-card {
    display: flex;

    align-items: flex-start;

    gap: 13px;

    margin-top: 18px;

    padding: 17px;

    border-radius: 14px;

    background:
        rgba(238, 170, 64, 0.045);

    border:
        1px solid
        rgba(238, 170, 64, 0.12);
}

.warning-icon {
    flex: 0 0 auto;

    font-size: 22px;
}

.warning-card h3 {
    margin:
        0
        0
        5px;

    font-size: 14px;
}

.warning-card p {
    margin: 0;

    color: #918576;

    font-size: 12px;

    line-height: 1.6;
}


/* =========================
   RESPONSIVE
========================= */

@media (
    max-width: 760px
) {

    .page {
        width:
            min(
                100% - 20px,
                680px
            );

        padding-top: 12px;
    }

    .hero {
        padding-top: 12px;
    }

    .card {
        padding: 16px;
    }

    .option-grid {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .page-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(
                    0,
                    1fr
                )
            );
    }

    .result-item {
        align-items: flex-start;

        flex-wrap: wrap;
    }

    .result-download {
        margin-left: 30px;
    }

    .result-actions > button {
        flex: 1 1 auto;
    }

}


@media (
    max-width: 480px
) {

    .page {
        width:
            calc(100% - 14px);

        padding-bottom: 35px;
    }

    .hero h1 {
        font-size: 31px;
    }

    .hero p {
        font-size: 14px;
    }

    .hero-icon {
        width: 62px;
        height: 62px;

        font-size: 29px;
    }

    .drop-area {
        min-height: 255px;

        padding:
            28px
            15px;
    }

    .drop-area h2 {
        font-size: 19px;
    }

    .range-row {
        flex-direction: column;
    }

    .range-row .secondary-button {
        width: 100%;
    }

    .selection-actions {
        display: grid;

        grid-template-columns:
            1fr
            1fr;
    }

    .selection-actions button {
        width: 100%;
    }

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

        gap: 8px;
    }

    .page-card {
        min-height: 170px;

        padding: 7px;
    }

    .page-preview {
        height: 130px;
    }

    .selection-summary {
        align-items: flex-start;

        flex-direction: column;
    }

    .result-item {
        gap: 9px;
    }

    .result-download {
        width: calc(100% - 30px);

        margin-left: 30px;
    }

    .result-actions {
        display: grid;

        grid-template-columns:
            1fr;
    }

    .result-actions button {
        width: 100%;
    }

    .warning-card {
        padding: 14px;
    }

}


/* =========================
   REDUCED MOTION
========================= */

@media (
    prefers-reduced-motion: reduce
) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;

        transition:
            none !important;
    }

}