/* --- Base Styles --- */
#pdf-tool-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 1000px;
    margin: 40px auto;
    padding: 20px;
    background-color: #f8f8f8;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* --- Header --- */
#tool-header h2 {
    color: #e5322d; /* iLovePDF red */
    font-size: 2.5em;
    margin-bottom: 5px;
}
#tool-header p {
    color: #555;
    margin-bottom: 30px;
}

/* --- Buttons --- */
.btn-select,
.btn-action,
.btn-download {
    display: inline-block;
    padding: 12px 30px;
    margin: 10px 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-weight: bold;
    font-size: 1em;
    transition: background-color 0.3s, transform 0.1s;
}

.btn-select {
    background-color: #3f92e9; /* Blue accent */
    color: white;
}
.btn-select:hover {
    background-color: #2b7cd8;
}

.btn-action {
    background-color: #e5322d; /* iLovePDF Red */
    color: white;
    font-size: 1.2em;
    width: 100%;
    max-width: 300px;
}
.btn-action:hover {
    background-color: #c72924;
}

.btn-download {
    background-color: #28a745; /* Green for success */
    color: white;
}
.btn-download:hover {
    background-color: #1e7e34;
}

/* --- Drop Zone --- */
#file-drop-zone {
    border: 4px dashed #ccc;
    border-radius: 8px;
    padding: 50px 20px;
    background-color: white;
    cursor: pointer;
    margin-bottom: 30px;
    transition: border-color 0.3s, background-color 0.3s;
}

#file-drop-zone.drag-over {
    border-color: #e5322d;
    background-color: #fff0f0;
}

#file-drop-zone p {
    font-size: 1.2em;
    color: #888;
    margin-bottom: 20px;
}

/* --- File List (Work Area) --- */
#file-list-container {
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-bottom: 30px;
}

#uploaded-file-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.pdf-file-item {
    background-color: #fefefe;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    width: 150px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    cursor: grab; /* Indicating drag-and-drop reordering */
}

.pdf-file-item .file-name {
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-top: 5px;
    color: #333;
}

.remove-file {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e5322d;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    line-height: 18px;
    text-align: center;
    font-size: 14px;
    cursor: pointer;
    font-weight: bold;
}

.pdf-icon {
    font-size: 40px;
    color: #e5322d;
    display: block;
    margin-bottom: 5px;
}

/* --- Result Container --- */
#result-container {
    padding: 40px 20px;
    background-color: #e8ffe8; /* Light green background */
    border: 1px solid #28a745;
    border-radius: 8px;
    margin-top: 30px;
}
#result-container h3 {
    color: #28a745;
}

/* --- Utility --- */
.hidden {
    display: none !important;
}

/* --- Responsive Adjustments (Mobile Optimization) --- */
@media (max-width: 600px) {
    #pdf-tool-wrapper {
        margin: 20px 10px;
        padding: 10px;
    }

    #tool-header h2 {
        font-size: 2em;
    }

    .btn-select,
    .btn-action,
    .btn-download {
        padding: 10px 20px;
        font-size: 0.9em;
    }
    
    #file-drop-zone {
        padding: 30px 10px;
    }

    #uploaded-file-list {
        /* Stack items vertically on small screens */
        flex-direction: column;
        align-items: stretch;
    }

    .pdf-file-item {
        width: auto;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 15px;
    }

    .pdf-file-item .file-name {
        text-align: left;
        flex-grow: 1;
        margin-left: 10px;
        margin-top: 0;
    }

    .pdf-icon {
        font-size: 30px;
        margin-bottom: 0;
    }

    .remove-file {
        position: static;
        flex-shrink: 0;
    }
}