.stpdf-wrapper {
    max-width: 1050px;
    margin: auto;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    background: #fff;
    margin-bottom: 40px;
}

.stpdf-title {
    text-align: center;
    color: #2a73d9;
    margin-top: 0;
}

.stpdf-container {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.stpdf-drop-area {
    border: 2px dashed #aaa;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    background: #f9f9f9;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    align-items: center;
}

.stpdf-drop-area>p {
    margin: 0;
}

.stpdf-drop-area:hover {
    background: #f0f4ff;
    border-color: #4a6bff;
}

.stpdf-drop-area.stpdf-is-loading {
    cursor: wait;
}

.stpdf-drop-area.stpdf-is-loading>p,
.stpdf-drop-area.stpdf-is-loading>.stpdf-primary-btn {
    display: none;
}

.stpdf-drop-area.stpdf-is-loading>#stpdfDropAreaSpinner {
    display: inline-block;
}

.stpdf-options-toggle-wrapper {
    display: none;
    margin: 15px 0 0;
    text-align: center;
    scroll-margin-top: 20px;
}

.stpdf-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #333;
}

#stpdfToggleOptions {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.stpdf-controls-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
}

.stpdf-control-group {
    flex: 1;
    min-width: 150px;
}

.stpdf-control-group label {
    display: block;
    margin-bottom: 5px;
}

.stpdf-control-group input[type="text"],
.stpdf-control-group input[type="number"],
.stpdf-control-group select {
    width: 100%;
    padding: 6px 10px;
    font-size: 16px;
    background-color: #ffffff;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.stpdf-control-group input.error {
    border-color: #dc3545;
}

.stpdf-control-group input[type="text"]:focus,
.stpdf-control-group input[type="number"]:focus,
.stpdf-control-group select:focus {
    outline: none;
    border-color: #2a73d9;
    box-shadow: 0 0 0 1px rgba(74, 107, 255, 0.25);
    background-color: #ffffff;
}

.stpdf-control-group input[type="text"]:hover,
.stpdf-control-group input[type="number"]:hover,
.stpdf-control-group select:hover {
    background-color: #ffffff;
    /* Override theme hover */
}

.stpdf-control-group input[type="text"]:active,
.stpdf-control-group input[type="number"]:active,
.stpdf-control-group select:active {
    background-color: #ffffff;
    /* Override theme active */
}

.stpdf-control-group select,
#stpdfOutputFormat {
    /* More specific selector for select */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 8L10 12L14 8' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 5px center;
    background-size: 20px 20px;
    padding-right: 40px;
    cursor: pointer;
}

/* Hide number input spinners */
.stpdf-control-group input[type=number] {
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.stpdf-control-group input[type=number]::-webkit-inner-spin-button,
.stpdf-control-group input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.stpdf-error-message {
    color: #dc3545;
    font-size: 0.85em;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out, margin-top 0.2s ease-out;
}

.stpdf-error-message:not(:empty) {
    max-height: 3em;
    /* Adjust height to fit multiple lines of text */
    margin-top: 4px;
}

.stpdf-buttons-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
    scroll-margin-top: 20px;
}

.stpdf-primary-btn,
.stpdf-secondary-btn,
.stpdf-clear-btn {
    padding: 8px 13px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
}

.stpdf-primary-btn {
    background: #2a73d9;
    color: white;
}

.stpdf-secondary-btn {
    background: #14862e;
    color: white;
}

.stpdf-clear-btn {
    background: #6c757d;
    color: white;
}

.stpdf-primary-btn:disabled,
.stpdf-secondary-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.stpdf-primary-btn:disabled:hover,
.stpdf-primary-btn:disabled:focus,
.stpdf-primary-btn:disabled:active,
.stpdf-secondary-btn:disabled:hover,
.stpdf-secondary-btn:disabled:focus,
.stpdf-secondary-btn:disabled:active {
    background: #6c757d !important;
}

/* Hover and Focus states to override theme defaults */
.stpdf-progress-container {
    background: #eee;
    border-radius: 5px;
    margin-top: 10px;
    display: none;
}

/* Override theme button styles for hover, focus, and active states */
.stpdf-primary-btn:hover,
.stpdf-primary-btn:focus,
.stpdf-primary-btn:active {
    background-color: #2a73d9 !important;
    color: white !important;
}

.stpdf-secondary-btn:hover,
.stpdf-secondary-btn:focus,
.stpdf-secondary-btn:active {
    background-color: #14862e !important;
    color: white !important;
}

.stpdf-clear-btn:hover,
.stpdf-clear-btn:focus,
.stpdf-clear-btn:active {
    background-color: #6c757d !important;
    color: white !important;
}

.stpdf-primary-btn:active,
.stpdf-secondary-btn:active,
.stpdf-clear-btn:active {
    transform: scale(0.97);
}

.stpdf-progress-bar {
    height: 20px;
    background: #4a6bff;
    width: 0%;
    color: white;
    text-align: center;
}

.stpdf-file-list {
    display: grid;
    gap: 15px;
    margin-top: 0;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    padding-bottom: 10px;
    /* Add space below the last row of items */
}

.stpdf-file-item {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
    background: #f8f9fa;
}

.stpdf-file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.stpdf-file-size {
    font-size: 0.9em;
    color: #6c757d;
}

.stpdf-file-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.stpdf-initial-preview-wrapper {
    position: relative;
    height: 150px;
    background: white;
    border: 1px solid #ccc;
    margin-bottom: 10px;
    padding: 10px;
    box-sizing: border-box;
}

.stpdf-remove-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.5);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s ease-in-out;
}

.stpdf-remove-icon:hover {
    background-color: rgba(220, 53, 69, 0.8);
}

.stpdf-remove-icon:active {
    transform: scale(0.9);
}

.stpdf-remove-icon svg {
    fill: white;
    width: 16px;
    height: 16px;
}

.stpdf-preview-wrapper {
    position: relative;
    width: 100%;
    height: 150px;
    background: white;
    border: 1px solid #ccc;
    margin-bottom: 10px;
    cursor: pointer;
    overflow: hidden;
}

.stpdf-icon-container {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.stpdf-fullscreen-icon,
.stpdf-download-icon {
    background-color: rgba(0, 0, 0, 0.6);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s ease-in-out;
}

.stpdf-fullscreen-icon {
    pointer-events: none;
}

.stpdf-download-icon {
    cursor: pointer;
}

.stpdf-download-icon:hover,
.stpdf-download-icon:focus,
.stpdf-download-icon:active,
.stpdf-download-icon:visited,
.stpdf-download-icon:active {
    background-color: rgba(0, 0, 0, 0.6);
}

.stpdf-fullscreen-icon svg,
.stpdf-download-icon svg {
    fill: white;
    width: 18px;
    height: 18px;
}

.stpdf-download-icon:active {
    transform: scale(0.9);
}

.stpdf-spinner {
    display: inline-block;
    width: 26px;
    height: 26px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: #4a6bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.stpdf-flex-container {
    display: flex;
    flex-direction: row;
    gap: 32px;
}

.stpdf-input-section {
    flex: 1 1 340px;
    min-width: 320px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.stpdf-output-section {
    flex: 2 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Add light dashed border and padding */
    border: 2px dashed #d0d7de;
    border-radius: 8px;
    background: #fcfcfc;
    padding: 10px 10px 18px;
    min-height: 220px;
    /* Make this section scrollable when content overflows */
    max-height: 465px;
    overflow-y: auto;
}

.stpdf-file-list {
    width: 100%;
    min-height: 200px;
}

/* Custom scrollbar for the output section */
.stpdf-output-section::-webkit-scrollbar {
    width: 8px;
}

.stpdf-output-section::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.stpdf-output-section::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

/* Placeholder text style */
.stpdf-placeholder {
    display: flex;
    flex-grow: 1;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

/* Modal (background) */
.stpdf-modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    /* Stay in place */
    z-index: 1000;
    /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    /* Enable scroll if needed */
    background-color: rgba(0, 0, 0, 0.85);
    /* Black w/ opacity */
    padding-top: 20px;
    padding-bottom: 20px;
}

/* Modal Content (the image) */
.stpdf-modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 95vh;
}

/* Close Button */
.stpdf-modal-close {
    position: absolute;
    top: 20px;
    right: 25px;
    color: #f1f1f1;
    font-size: 30px;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.1s ease-in-out;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.stpdf-modal-close:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.stpdf-modal-close:active {
    transform: scale(0.95);
}

.faq-list {
    margin-top: 1rem;
}

.faq-list dt {
    font-weight: 500;
    font-size: 1.1em;
}

.faq-list dd {
    margin-left: 0;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding-left: 1rem;
    padding-bottom: 10px;
    border-bottom: 1px dashed #ddd;
}

@media (max-width: 768px) {
    .stpdf-wrapper {
        box-shadow: none;
        border: none;
        border-top: 1px solid #e0e0e0;
        border-bottom: 1px solid #e0e0e0;
        border-radius: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .stpdf-controls-panel {
        display: none;
        /* Hide controls by default on mobile */
        flex-direction: column;
    }

    .stpdf-controls-panel.stpdf-is-visible {
        display: flex;
        /* Show when toggled */
    }

    .stpdf-options-toggle-wrapper {
        display: block;
        /* Show toggle on mobile */
    }

    .stpdf-buttons-wrapper {
        margin-top: 20px;
    }

    .stpdf-flex-container {
        flex-direction: column;
        gap: 20px;
    }

    .stpdf-input-section,
    .stpdf-output-section {
        max-width: 100%;
        flex: none;
        /* Reset flex behavior for vertical stacking */
        min-width: 0;
        /* Prevents overflow on very small screens */
    }

    .stpdf-output-section {
        display: none;
        min-height: 450px;
        height: auto;
    }

    .stpdf-primary-btn,
    .stpdf-secondary-btn,
    .stpdf-clear-btn {
        padding: 10px 20px;
    }

    /* Visually hidden class for screen readers */
    .stpdf-visually-hidden {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}