/* =====================================================
   Merge PDF Text Tool
   ===================================================== */

/* Hide by default */
.tool-wrapper [data-tool-action-buttons],
.tool-wrapper [data-tool-options-section],
.tool-wrapper [data-tool-files-container],
.tool-wrapper [data-tool-add-more-files]{
    display:none;
}

/* Visible State */
.tool-wrapper [data-tool-options-section].visible,
.tool-wrapper [data-tool-files-container].visible,
.tool-wrapper [data-tool-add-more-files].visible{
    display:block;
}

.tool-wrapper [data-tool-action-buttons].visible{
    display:flex;
}

/* Upload Area Always Clickable */
.upload-area{
    position:relative;
    z-index:20;
}

/* ==========================
   MAIN WORKSPACE
========================== */

.tool-wrapper{
    max-width:1100px;
    margin:0 auto;
}

.processing-workspace{
    max-width:1000px;
    margin:30px auto;
}

/* ==========================
   FILES AREA
========================== */

.files-container{
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    gap:16px;

    margin:25px auto;
}

.file-card{
    width:220px;

    background:#fff;
    border:1px solid #e5e7eb;
    border-radius:16px;

    padding:16px;

    transition:.2s;
    box-shadow:0 4px 12px rgba(0,0,0,.04);
}

.file-card:hover{
    transform:translateY(-3px);
    box-shadow:0 10px 25px rgba(0,0,0,.08);
}

/* ==========================
   OPTIONS BOX
========================== */

.options-section{
    max-width:1000px;

    margin:30px auto;

    padding:24px;

    background:#fff;

    border:1px solid #e5e7eb;
    border-radius:18px;

    box-shadow:0 6px 20px rgba(0,0,0,.04);
}

.options-grid{
    display:grid;

    grid-template-columns:
    repeat(auto-fit,minmax(240px,1fr));

    gap:20px;
}

/* ==========================
   BUTTONS
========================== */

.action-buttons{
    display:flex;
    justify-content:center;
    align-items:center;

    gap:12px;

    margin-top:25px;
}

.action-buttons .btn{
    min-width:180px;
    height:48px;

    border-radius:999px;

    font-weight:600;
}

/* ==========================
   ADD MORE FILES
========================== */

.add-more-files{
    width:100%;
    display:flex;
    justify-content:center;
    align-items:center;
    margin:15px auto;
    text-align:center;
}

.add-more-files .btn-upload{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;

    padding:10px 18px;

    border:1px dashed #6366f1;
    border-radius:10px;

    background:#eef2ff;
    color:#4f46e5;

    font-size:13px;
    font-weight:600;

    cursor:pointer;
    user-select:none;

    transition:all .25s ease;
}

.add-more-files .btn-upload:hover{
    background:#e0e7ff;
    transform:scale(1.03);
}

.add-more-files .btn-upload:active{
    transform:scale(.98);
}

.add-more-files .btn-upload i{
    font-size:12px;
}

/* ==========================
   MOBILE
========================== */

@media(max-width:768px){

    .files-container{
        justify-content:center;
    }

    .file-card{
        width:100%;
        max-width:320px;
    }

    .action-buttons{
        flex-direction:column;
    }

    .action-buttons .btn{
        width:100%;
        max-width:320px;
    }
}

/* =====================================================
   Options Section
   ===================================================== */

.options-section{
    background:var(--card-bg,#fff);
    border:1px solid var(--border,#e5e7eb);
    border-radius:16px;
    padding:24px;
    margin:24px 0;
    box-shadow:0 4px 12px rgba(0,0,0,.04);
}

.options-title{
    display:flex;
    align-items:center;
    gap:8px;
    margin:0 0 20px;
    font-size:18px;
    font-weight:700;
    color:var(--text,#0f172a);
}

.options-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
    gap:18px;
}

.option-group{
    display:flex;
    flex-direction:column;
    gap:8px;
}

.option-label{
    font-size:13px;
    font-weight:600;
    color:var(--text,#334155);
}

.option-select,
.option-input{
    width:100%;
    height:46px;
    padding:0 14px;
    border:1px solid var(--border,#dbe2ea);
    border-radius:12px;
    background:#fff;
    font-size:14px;
    transition:.25s;
}

.option-select:focus,
.option-input:focus{
    outline:none;
    border-color:var(--primary,#2563eb);
    box-shadow:0 0 0 3px rgba(37,99,235,.12);
}

.checkbox-group{
    display:flex;
    align-items:center;
    gap:8px;
    margin-top:6px;
}

.checkbox-group label{
    display:flex;
    align-items:center;
    gap:8px;
    cursor:pointer;
    font-size:14px;
    color:var(--text,#334155);
}

/* =====================================================
   Files Container
   ===================================================== */

.files-container{
    display:flex;
    flex-wrap:wrap;
    gap:16px;
    margin:24px 0;
    min-height:80px;
}

.file-card{
    width:220px;
    background:#fff;
    border:1px solid var(--border,#e5e7eb);
    border-radius:16px;
    padding:14px;
    display:flex;
    flex-direction:column;
    gap:10px;
    transition:.25s;
    box-shadow:0 2px 10px rgba(0,0,0,.04);
}

.file-card:hover{
    transform:translateY(-2px);
    box-shadow:0 8px 18px rgba(0,0,0,.08);
}

.file-name{
    display:flex;
    align-items:center;
    gap:8px;
    font-size:14px;
    font-weight:600;
    color:var(--text,#0f172a);
    word-break:break-word;
}

.file-meta{
    display:flex;
    justify-content:space-between;
    font-size:12px;
    color:var(--text-light,#64748b);
}

.remove-file{
    align-self:flex-end;
    border:none;
    border-radius:999px;
    padding:6px 12px;
    cursor:pointer;
    font-size:12px;
    font-weight:600;
    transition:.2s;
}

.remove-file:hover{
    transform:translateY(-1px);
}

/* =====================================================
   Action Buttons
   ===================================================== */

.action-buttons{
    display:flex;
    justify-content:center;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
    margin-top:20px;
}

.btn{
    min-width:160px;
    height:46px;
    padding:0 20px;

    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;

    border-radius:999px;
    border:1px solid var(--border,#e5e7eb);

    font-size:14px;
    font-weight:600;

    cursor:pointer;
    transition:.25s;
}

.btn:hover{
    transform:translateY(-2px);
    box-shadow:0 8px 18px rgba(0,0,0,.08);
}

.btn i{
    font-size:13px;
}

/* =====================================================
   Toast
   ===================================================== */

.toast{
    position:fixed;
    left:50%;
    bottom:24px;
    transform:translateX(-50%);
    padding:12px 20px;
    border-radius:999px;

    font-size:14px;
    font-weight:500;

    opacity:0;
    visibility:hidden;

    transition:.25s;

    z-index:9999;

    box-shadow:0 12px 24px rgba(0,0,0,.15);
}

.toast.show{
    opacity:1;
    visibility:visible;
}

/* =====================================================
   Loading
   ===================================================== */

.loading{
    display:none;
    align-items:center;
    justify-content:center;
    gap:10px;

    margin:16px 0;
    padding:14px;

    border-radius:16px;

    font-weight:600;
}

.loading-spinner{
    animation:spin 1s linear infinite;
}

@keyframes spin{
    from{transform:rotate(0deg);}
    to{transform:rotate(360deg);}
}

/* =====================================================
   Error Message
   ===================================================== */

.error-message{
    display:none;

    padding:14px 16px;
    margin:16px 0;

    border-radius:12px;

    font-size:14px;
    font-weight:500;
}

/* =====================================================
   Mobile
   ===================================================== */

@media (max-width:768px){

    .options-grid{
        grid-template-columns:1fr;
    }

    .files-container{
        justify-content:center;
    }

    .file-card{
        width:100%;
        max-width:320px;
    }

    .action-buttons{
        flex-direction:column;
    }

    .btn{
        width:100%;
        max-width:320px;
    }
}