.pdf-hidden {
    display: none !important;
}

.pdf-page-remover {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: inherit;
}

.pdf-page-remover-tool {
    background: #fff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.pdf-page-remover-tool h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 20px;
}

.pdf-drop-area {
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8f9fa;
    transition: all 0.3s;
    cursor: pointer;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 20px;
}

.pdf-drop-area:hover {
    border-color: #bdc3c7;
    /* Keep same as default */
    background: #f8f9fa;
    /* Keep same as default */
}

.pdf-drop-area p {
    margin: 5px;
    font-size: 16px;
    text-align: center;
}

.pdf-btn {
    background-color: #0073e6;
    color: white;
    border: none;
    padding: 9px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pdf-btn:hover {
    background-color: #0073e6;
    color: white;
}

.pdf-btn:focus,
.pdf-btn:active {
    background-color: #0073e6;
    color: white;
    transform: scale(0.97);
    /* This is for the active state click effect */
    outline: none;
    /* Prevents default browser outline */
}

.pdf-btn-secondary,
.pdf-btn-secondary:hover,
.pdf-btn-secondary:focus,
.pdf-btn-secondary:active {
    background-color: #67787a;
}

.pdf-btn-danger {
    background-color: #c0392b;
}

.pdf-btn-danger:hover {
    background-color: #c0392b;
    color: white;
}

.pdf-btn-danger:focus,
.pdf-btn-danger:active {
    background-color: #c0392b;
    color: white;
    transform: scale(0.97);
    outline: none;
    /* Prevents default browser outline */
}

.pdf-btn:disabled,
.pdf-btn[disabled] {
    background-color: #7f8c8d;
    /* Changed for better contrast */
    cursor: not-allowed;
}

.pdf-btn:disabled:hover,
.pdf-btn[disabled]:hover {
    background-color: #7f8c8d;
    color: white;
}

.pdf-selection-instructions {
    text-align: center;
    color: #4b5657;
    max-width: 550px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 0;
}

.pdf-pages-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-height: 530px;
    overflow-y: auto;
    border-top: 1px solid #ddd;
    padding-top: 15px;
}

.pdf-page-thumbnail {
    width: 120px;
    height: 168px;
    border: 2px solid #bdc3c7;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Prevent text selection on long-press for drag-and-drop on mobile */
    -webkit-user-select: none;
    /* Safari */
    -moz-user-select: none;
    /* Firefox */
    -ms-user-select: none;
    /* IE/Edge */
    user-select: none;
    /* Standard */
}

.pdf-page-thumbnail canvas {
    transition: transform 0.3s ease-in-out;
}

.pdf-page-remover .pdf-page-number-input {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    width: 34px;
    text-align: center;
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield;
}

.pdf-page-number-input::-webkit-outer-spin-button,
.pdf-page-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pdf-page-number-input:focus {
    background-color: #fff;
    color: #000;
    border: 1px solid #3498db;
    outline: none;
    transition: transform 0.3s ease-in-out;
}

.sortable-ghost {
    opacity: 0.4;
    background: #c8ebfb;
}


.pdf-page-thumbnail:hover {
    border-color: #bdc3c7;
    /* Keep same as default */
}

.pdf-page-thumbnail.selected {
    border-color: #e74c3c;
}

.selection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
}

.pdf-page-thumbnail.selected .selection-overlay {
    opacity: 1;
}

.selection-icon {
    width: 40px;
    height: 40px;
    color: #e74c3c;
    fill: currentColor;
}

.pdf-page-preview-btn,
.pdf-page-rotate-btn {
    position: absolute;
    top: 5px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    padding: 0;
    box-sizing: border-box;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    line-height: 1;
    z-index: 2;
}

.pdf-page-select-btn {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    padding: 0;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 3;
    opacity: 0;
    /* Hidden by default, shown on hover */
    transition: opacity 0.2s;
}

.pdf-page-preview-btn svg,
.pdf-page-rotate-btn svg {
    width: 18px;
    height: 18px;
}

.pdf-page-preview-btn {
    left: 5px;
}

.pdf-page-preview-btn-mobile {
    left: 5px;
}

.pdf-page-rotate-btn {
    right: 5px;
}

.pdf-page-thumbnail:hover .pdf-page-preview-btn,
.pdf-page-thumbnail:hover .pdf-page-rotate-btn,
.pdf-page-thumbnail:hover .pdf-page-select-btn,
.pdf-page-preview-btn:focus,
.pdf-page-rotate-btn:focus,
.pdf-page-select-btn:focus {
    opacity: 1;
    display: flex;
}

.pdf-page-preview-btn:hover,
.pdf-page-preview-btn:active,
.pdf-page-preview-btn:focus {
    background: rgba(0, 0, 0, 0.6);
    /* Keep same as default */
    color: white;
    /* Keep same as default */
    outline: none;
}

.pdf-page-rotate-btn:hover,
.pdf-page-rotate-btn:active,
.pdf-page-rotate-btn:focus {
    background: rgba(0, 0, 0, 0.6);
    /* Keep same as default */
    color: white;
    /* Keep same as default */
    outline: none;
}

.pdf-page-select-btn:hover,
.pdf-page-select-btn:active,
.pdf-page-select-btn:focus {
    background: rgba(0, 0, 0, 0.6);
    /* Keep same as default */
    color: #fff;
    /* Keep same as default */
}

.pdf-page-preview-btn:active,
.pdf-page-rotate-btn:active {
    transform: scale(0.9);
}

.pdf-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    /* Changed from none to flex for centering */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.pdf-preview-content canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: 2px solid white;
    border-radius: 5px;
}

.pdf-page-number {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.pdf-page-number {
    display: none;
}

/* Hide old page number */

.pdf-preview-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    cursor: pointer;
    z-index: 1001;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    transition: background-color 0.2s;
}

.pdf-preview-close:hover {
    color: white;
    background: rgba(0, 0, 0, 0.5);
}


.pdf-preview-close:active {
    transform: scale(0.95);
}

.pdf-preview-close:focus {
    color: #ecf0f1;
    background: rgba(0, 0, 0, 0.5);
    /* Keep same as default */
    outline: none;
    /* Prevents default browser outline */
}

.pdf-page-controls {
    margin: 0 0 15px 0;
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.pdf-select-all-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #555;
}

.pdf-select-all-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.pdf-thumbnail-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: pdf-spin 1s linear infinite;
    margin-left: 10px;
}

.pdf-thumbnail-progress-container {
    flex-grow: 1;
    height: 20px;
    background-color: #ecf0f1;
    border-radius: 10px;
    margin-left: 15px;
    position: relative;
    overflow: hidden;
}

.pdf-thumbnail-progress-bar {
    height: 100%;
    width: 0%;
    background-color: #3498db;
    transition: width 0.1s linear;
    border-radius: 10px;
}

.pdf-thumbnail-progress-text {
    color: #2c3e50;
    font-size: 14px;
    font-weight: 500;
    margin-left: 10px;
    min-width: 40px;
    text-align: left;
}

.pdf-progress-container {
    height: 20px;
    background: #ecf0f1;
    border-radius: 10px;
    margin: 15px 0;
    position: relative;
    overflow: hidden;
}

.pdf-progress-bar {
    height: 100%;
    width: 0%;
    background: #3498db;
    border-radius: 10px;
    transition: width 0.3s;
}

.pdf-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: 500;
}

.pdf-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    /* Sticky properties to keep it at the top on scroll */
    position: sticky;
    top: 0;
    background-color: #fff;
    /* Match the container background */
    z-index: 10;
    /* Ensure it stays above other content */
    padding-top: 15px;
    padding-bottom: 15px;
}

.pdf-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    margin-left: 10px;
    animation: pdf-spin 1s linear infinite;
}

@keyframes pdf-spin {
    to {
        transform: rotate(360deg);
    }
}

.pdf-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.pdf-result-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

.pdf-result-preview {
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    padding: 25px;
    background: #f8f9fa;
    width: 100%;
    max-width: 350px;
    box-sizing: border-box;
    min-height: 160px;
    /* Reserve space to prevent CLS */
    text-align: center;
}

.pdf-result-icon {
    margin-bottom: 15px;
    line-height: 1;
}

.pdf-result-icon svg {
    width: 48px;
    height: 48px;
    fill: #e74c3c;
    /* PDF red color */
}

.pdf-result-filename {
    font-weight: 500;
    font-size: 17px;
    color: #333;
    margin-bottom: 8px;
    word-break: break-all;
}

.pdf-result-filesize {
    color: #4b5657;
    font-size: 15px;
}

.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;
}

.pdf-page-remover-tool #pdf-animated-loading-text {
    text-align: center;
    margin-top: 8px;
    font-size: 15px;
    color: #555;
    height: 20px;
    /* Reserve space to prevent layout shift */
    margin-bottom: 5px;
}

@media (max-width: 768px) {
    .pdf-page-remover {
        padding: 0;
    }

    .pdf-page-remover-tool {
        padding: 15px 0;
        box-shadow: none;
        border-radius: 0;
        border-top: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
        margin-bottom: 40px;
    }

    .pdf-btn {
        width: 100%;
    }

    .pdf-controls {
        flex-direction: row;
    }

    .pdf-controls .pdf-btn,
    .pdf-drop-area .pdf-btn,
    .pdf-result-actions .pdf-btn {
        width: auto;
    }

    .pdf-page-rotate-btn i {
        transform: translateY(1px);
    }

    .pdf-page-thumbnail:hover .pdf-page-preview-btn,
    .pdf-page-thumbnail:hover .pdf-page-rotate-btn,
    .pdf-page-preview-btn:focus,
    .pdf-page-rotate-btn:focus,
    .pdf-page-select-btn:focus,
    .pdf-page-preview-btn,
    .pdf-page-rotate-btn,
    .pdf-page-select-btn {
        opacity: 1;
        display: flex;
    }

    .pdf-page-thumbnail.selected .pdf-page-select-btn {
        display: none;
    }
}