.merge-pdf-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 48px 24px 80px;
    color: #172033;
}


/* =========================================================
   HEADER
========================================================= */

.merge-pdf-header {
    max-width: 760px;
    margin: 0 auto 38px;
    text-align: center;
}

.tool-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border: 1px solid #dce3ed;
    border-radius: 999px;
    background: #f7f9fc;
    color: #667085;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
}

.merge-pdf-header h1 {
    margin: 14px 0 10px;
    font-size: 42px;
    line-height: 1.15;
    font-weight: 750;
    letter-spacing: -1px;
    color: #111827;
}

.merge-pdf-header p {
    max-width: 680px;
    margin: 0 auto;
    color: #667085;
    font-size: 16px;
    line-height: 1.7;
}


/* =========================================================
   MAIN TOOL
========================================================= */

.merge-pdf-tool {
    max-width: 920px;
    margin: 0 auto;
}


/* =========================================================
   UPLOAD AREA
========================================================= */

.pdf-upload-area {
    min-height: 330px;
    padding: 48px 30px;
    border: 2px dashed #cfd8e6;
    border-radius: 18px;
    background: #ffffff;
    text-align: center;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.pdf-upload-area:hover {
    border-color: #98a8bd;
    background: #fbfcfe;
}

.pdf-upload-area.drag-over {
    border-color: #2563eb;
    background: #f5f9ff;
    transform: translateY(-2px);
}

.upload-icon {
    width: 68px;
    height: 78px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d8dee8;
    border-radius: 10px;
    background: #f8fafc;
    color: #dc2626;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.5px;
    position: relative;
}

.upload-icon::after {
    content: "";
    position: absolute;
    right: -1px;
    top: -1px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-left: 1px solid #d8dee8;
    border-bottom: 1px solid #d8dee8;
    clip-path: polygon(0 0, 100% 100%, 0 100%);
}

.pdf-upload-area h2 {
    margin: 0 0 8px;
    color: #111827;
    font-size: 23px;
    font-weight: 700;
}

.pdf-upload-area p {
    margin: 0;
    color: #667085;
    font-size: 15px;
}

.upload-or {
    display: block;
    margin: 12px 0;
    color: #98a2b3;
    font-size: 13px;
}

.browse-button {
    min-height: 44px;
    padding: 0 22px;
    border: 1px solid #1f2937;
    border-radius: 9px;
    background: #1f2937;
    color: #ffffff;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.browse-button:hover {
    background: #111827;
    transform: translateY(-1px);
}

.upload-limit {
    margin-top: 18px;
    color: #98a2b3;
    font-size: 12px;
}


/* =========================================================
   FILE SECTION
========================================================= */

.pdf-files-section {
    margin-top: 24px;
    padding: 26px;
    border: 1px solid #e3e8ef;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 8px 30px rgba(16, 24, 40, 0.05);
}

.files-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.files-section-header h2 {
    margin: 0 0 4px;
    color: #111827;
    font-size: 20px;
    font-weight: 700;
}

.files-section-header p {
    margin: 0;
    color: #667085;
    font-size: 13px;
}

.add-more-button {
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #ffffff;
    color: #344054;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}

.add-more-button:hover {
    border-color: #98a2b3;
    background: #f9fafb;
}


/* =========================================================
   FILE LIST
========================================================= */

.pdf-files-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pdf-file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 74px;
    padding: 12px 14px;
    border: 1px solid #e4e7ec;
    border-radius: 11px;
    background: #ffffff;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.pdf-file-card:hover {
    border-color: #cbd5e1;
    background: #fcfdff;
    box-shadow: 0 4px 14px rgba(16, 24, 40, 0.04);
}

.pdf-file-card.dragging {
    opacity: 0.55;
    border-style: dashed;
}

.pdf-file-number {
    width: 30px;
    flex: 0 0 30px;
    text-align: center;
    color: #98a2b3;
    font-size: 12px;
    font-weight: 700;
}

.pdf-file-icon {
    width: 42px;
    height: 48px;
    flex: 0 0 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #f1caca;
    border-radius: 7px;
    background: #fff7f7;
    color: #dc2626;
    font-size: 9px;
    font-weight: 800;
}

.pdf-file-content {
    min-width: 0;
    flex: 1;
}

.pdf-file-name {
    overflow: hidden;
    margin-bottom: 5px;
    color: #1d2939;
    font-size: 14px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pdf-file-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: #98a2b3;
    font-size: 12px;
}

.pdf-file-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.file-action-button {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e4e7ec;
    border-radius: 7px;
    background: #ffffff;
    color: #667085;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.file-action-button:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    color: #1d2939;
}

.file-remove-button:hover {
    border-color: #fecaca;
    background: #fff5f5;
    color: #dc2626;
}


/* =========================================================
   MERGE ACTION
========================================================= */

.merge-action-area {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid #eaecf0;
}

.merge-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    color: #667085;
    font-size: 13px;
}

.merge-summary span {
    white-space: nowrap;
}

.merge-summary strong {
    color: #344054;
    font-weight: 700;
}

.merge-button {
    min-width: 150px;
    min-height: 46px;
    padding: 0 22px;
    border: 0;
    border-radius: 9px;
    background: #1f2937;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition:
        background 0.2s ease,
        opacity 0.2s ease,
        transform 0.2s ease;
}

.merge-button:hover:not(:disabled) {
    background: #111827;
    transform: translateY(-1px);
}

.merge-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.merge-button-loader {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.merge-button-loader::before {
    content: "";
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: mergePdfSpin 0.75s linear infinite;
}

@keyframes mergePdfSpin {
    to {
        transform: rotate(360deg);
    }
}


/* =========================================================
   RESULT
========================================================= */

.merge-result {
    margin-top: 24px;
    padding: 38px 30px;
    border: 1px solid #dce8df;
    border-radius: 16px;
    background: #fbfefc;
    text-align: center;
}

.result-success-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #b7dec2;
    border-radius: 50%;
    background: #eefaf1;
    color: #218739;
    font-size: 25px;
    font-weight: 700;
}

.merge-result h2 {
    margin: 0 0 8px;
    color: #172b1b;
    font-size: 24px;
}

.merge-result > p {
    margin: 0;
    color: #667085;
    font-size: 14px;
}

.result-details {
    max-width: 520px;
    margin: 26px auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid #e3ebe5;
    border-radius: 10px;
    background: #ffffff;
    overflow: hidden;
}

.result-detail {
    padding: 15px 10px;
    border-right: 1px solid #e3ebe5;
}

.result-detail:last-child {
    border-right: 0;
}

.result-detail span {
    display: block;
    margin-bottom: 5px;
    color: #98a2b3;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-detail strong {
    color: #344054;
    font-size: 16px;
}

.result-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.download-button,
.start-again-button {
    min-height: 44px;
    padding: 0 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    text-decoration: none;
}

.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1f2937;
    color: #ffffff;
}

.download-button:hover {
    background: #111827;
}

.start-again-button {
    border: 1px solid #d0d5dd;
    background: #ffffff;
    color: #344054;
}

.start-again-button:hover {
    background: #f9fafb;
}


/* =========================================================
   ERROR
========================================================= */

.merge-error {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 15px;
    border: 1px solid #f3caca;
    border-radius: 9px;
    background: #fff7f7;
    color: #b42318;
    font-size: 13px;
}

.error-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fee4e2;
    color: #b42318;
    font-size: 12px;
    font-weight: 800;
}


/* =========================================================
   HOW IT WORKS
========================================================= */

.merge-how-it-works {
    margin-top: 85px;
}

.section-heading {
    max-width: 680px;
    margin: 0 auto 34px;
    text-align: center;
}

.section-heading > span {
    color: #667085;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 1.5px;
}

.section-heading h2 {
    margin: 9px 0 8px;
    color: #111827;
    font-size: 29px;
    letter-spacing: -0.5px;
}

.section-heading p {
    margin: 0;
    color: #667085;
    font-size: 14px;
    line-height: 1.6;
}

.merge-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.merge-step {
    padding: 26px;
    border: 1px solid #e5e7eb;
    border-radius: 13px;
    background: #ffffff;
}

.step-number {
    margin-bottom: 18px;
    color: #98a2b3;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
}

.merge-step h3 {
    margin: 0 0 8px;
    color: #1d2939;
    font-size: 17px;
}

.merge-step p {
    margin: 0;
    color: #667085;
    font-size: 13px;
    line-height: 1.65;
}


/* =========================================================
   INFORMATION
========================================================= */

.merge-information {
    margin-top: 55px;
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 22px;
}

.information-content,
.information-points {
    padding: 28px;
    border: 1px solid #e5e7eb;
    border-radius: 13px;
    background: #ffffff;
}

.information-content h2 {
    margin: 0 0 14px;
    color: #1d2939;
    font-size: 21px;
}

.information-content p {
    margin: 0 0 12px;
    color: #667085;
    font-size: 13px;
    line-height: 1.75;
}

.information-content p:last-child {
    margin-bottom: 0;
}

.information-points {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.information-point {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.information-point strong {
    color: #344054;
    font-size: 13px;
}

.information-point span {
    color: #667085;
    font-size: 12px;
    line-height: 1.5;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 850px) {

    .merge-pdf-page {
        padding: 38px 18px 60px;
    }

    .merge-pdf-header h1 {
        font-size: 36px;
    }

    .merge-information {
        grid-template-columns: 1fr;
    }

    .merge-steps {
        grid-template-columns: 1fr;
    }
}


@media (max-width: 650px) {

    .merge-pdf-page {
        padding: 30px 14px 50px;
    }

    .merge-pdf-header {
        margin-bottom: 26px;
    }

    .merge-pdf-header h1 {
        font-size: 31px;
    }

    .merge-pdf-header p {
        font-size: 14px;
    }

    .pdf-upload-area {
        min-height: 290px;
        padding: 38px 18px;
    }

    .pdf-files-section {
        padding: 18px;
    }

    .files-section-header {
        align-items: flex-start;
    }

    .pdf-file-card {
        gap: 9px;
        padding: 10px;
    }

    .pdf-file-number {
        display: none;
    }

    .pdf-file-actions {
        gap: 3px;
    }

    .file-action-button {
        width: 30px;
        height: 30px;
    }

    .merge-action-area {
        flex-direction: column;
        align-items: stretch;
    }

    .merge-summary {
        justify-content: center;
    }

    .merge-button {
        width: 100%;
    }

    .result-details {
        grid-template-columns: 1fr;
    }

    .result-detail {
        border-right: 0;
        border-bottom: 1px solid #e3ebe5;
    }

    .result-detail:last-child {
        border-bottom: 0;
    }

    .information-points {
        grid-template-columns: 1fr;
    }
}


@media (max-width: 430px) {

    .merge-pdf-header h1 {
        font-size: 27px;
    }

    .pdf-file-icon {
        width: 36px;
        height: 42px;
        flex-basis: 36px;
    }

    .pdf-file-meta {
        gap: 7px;
        font-size: 11px;
    }

    .pdf-file-actions {
        flex-direction: column;
    }

    .add-more-button {
        padding: 0 12px;
    }

    .result-actions {
        flex-direction: column;
    }

    .download-button,
    .start-again-button {
        width: 100%;
    }
}


.upload-source-section {
    margin-bottom: 24px;
}

.upload-source-title {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 12px;
}

.upload-source-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.upload-source-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: 0.2s ease;
}

.upload-source-btn:hover {
    border-color: #9ca3af;
    transform: translateY(-1px);
}

.upload-source-btn.active {
    border-color: #111827;
    box-shadow: 0 0 0 1px #111827;
}

.upload-source-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.source-icon {
    font-size: 24px;
}

.upload-source-btn strong {
    display: block;
    font-size: 14px;
    color: #111827;
}

.upload-source-btn small {
    display: block;
    margin-top: 3px;
    color: #6b7280;
    font-size: 11px;
}

.cloud-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cloud-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.cloud-modal-content {
    position: relative;
    width: min(900px, 100%);
    max-height: 85vh;
    overflow: auto;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
    padding: 26px;
    z-index: 1;
}

.cloud-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.cloud-modal-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #6b7280;
}

.cloud-modal-header h2 {
    margin: 5px 0;
    font-size: 25px;
    color: #111827;
}

.cloud-modal-header p {
    margin: 0;
    color: #6b7280;
}

.cloud-modal-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 9px;
    background: #f3f4f6;
    font-size: 24px;
    cursor: pointer;
}

.google-drive-connect {
    text-align: center;
    padding: 50px 20px;
}

.cloud-connect-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.google-drive-connect h3 {
    margin-bottom: 8px;
    color: #111827;
}

.google-drive-connect p {
    max-width: 500px;
    margin: 0 auto 22px;
    color: #6b7280;
}

.cloud-connect-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border-radius: 9px;
    background: #111827;
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
}

.select-drive-pdf {
    border: 0;
    background: #111827;
    color: #ffffff;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
}

.select-drive-pdf:disabled {
    opacity: 0.6;
    cursor: wait;
}

.select-drive-pdf.added {
    background: #166534;
}

@media (max-width: 800px) {

    .upload-source-options {
        grid-template-columns: repeat(2, 1fr);
    }

}

@media (max-width: 500px) {

    .upload-source-options {
        grid-template-columns: 1fr;
    }

    .cloud-modal-content {
        padding: 18px;
    }

}




.cloud-save-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: #ffffff;
    color: #111827;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
}

.cloud-save-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.cloud-save-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.cloud-save-status {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

.cloud-save-status.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.cloud-save-status.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

/* The hidden attribute must win over the display rules above
   (otherwise the error box and the button loader are always visible) */
[hidden] {
    display: none !important;
}
