.pdf-rotate-hidden {
    display: none !important;
}

.pdf-rotate-drop-zone.dragover {
    border-color: #2980b9;
    background-color: rgba(52, 152, 219, 0.1);
}

body.pdf-rotate-modal-open {
    overflow: hidden;
}

body.pdf-rotate-no-select {
    -webkit-user-select: none;
    /* Safari */
    -moz-user-select: none;
    /* Firefox */
    -ms-user-select: none;
    /* IE10+/Edge */
    user-select: none;
    /* Standard */
    -webkit-touch-callout: none;
    /* iOS Safari */
}

.pdf-rotate-tool-container {
    position: relative;
    max-width: 900px;
    margin: 0 auto 60px;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pdf-rotate-tool-container>h2 {
    text-align: center;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.8rem;
    font-weight: 500;
}

.pdf-rotate-start-area {
    max-width: 600px;
    margin: 0 auto;
    border: 2px dashed #3498db;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.pdf-rotate-tool-container .pdf-rotate-start-area:hover {
    border-color: #2980b9;
    background: rgba(52, 152, 219, 0.05);
}

.pdf-rotate-file-input {
    display: none;
}

.pdf-rotate-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-grow: 1;
    padding: 40px 20px;
}

.pdf-rotate-drop-zone .pdf-rotate-btn {
    pointer-events: none;
}

.pdf-rotate-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 10px;
    font-size: 32px;
}

.pdf-rotate-loading-overlay .pdf-rotate-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #2c3e50;
}

.pdf-rotate-spinner-container span {
    font-size: 18px;
    margin-top: 15px;
    font-weight: 500;
}

.pdf-rotate-progress-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    margin-top: 30px;
    padding: 0 10px;
}

.pdf-rotate-thumbnail-loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: pdf-rotate-spinner-anim 1s linear infinite;
    margin-right: 15px;
}

.pdf-rotate-progress-container {
    flex-grow: 1;
    height: 20px;
    background-color: #ecf0f1;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.pdf-rotate-progress-bar-inner {
    height: 100%;
    width: 0%;
    background-color: #3498db;
    transition: width 0.1s linear;
    border-radius: 10px;
}

.pdf-rotate-progress-percentage-text {
    color: #2c3e50;
    font-size: 16px;
    font-weight: 500;
    margin-left: 10px;
    min-width: 40px;
    text-align: left;
}

.pdf-rotate-animated-loading-text {
    text-align: center;
    margin-top: -5px;
    margin-bottom: 10px;
    margin-top: 15px;
    font-size: 16px;
    color: #555;
    height: 20px;
    /* Reserve space to prevent layout shift */
}

.pdf-rotate-spinner {
    animation: pdf-rotate-spinner-anim 1.5s linear infinite;
    width: 32px;
    height: 32px;
}

.pdf-rotate-spinner .path {
    stroke: #2c3e50;
    stroke-linecap: round;
    animation: pdf-rotate-dash-anim 1.5s ease-in-out infinite;
}

.pdf-rotate-spinner-light .path {
    stroke: white;
}

@keyframes pdf-rotate-spinner-anim {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes pdf-rotate-dash-anim {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }

    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }

    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

.pdf-rotate-editor {
    margin-top: 10px;
}

.pdf-rotate-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    position: relative;
}

.pdf-rotate-thumbnail {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #f5f5f5;
    cursor: move;
    transition: all 0.2s;
    width: 150px;
    height: 200px;
    margin: 0 auto;
    -webkit-touch-callout: none;
    /* Prevent long-press menu on mobile */
    -webkit-user-select: none;
    /* Safari */
    -moz-user-select: none;
    /* Firefox */
    -ms-user-select: none;
    /* IE10+/Edge */
    user-select: none;
    /* Standard */
}

.pdf-rotate-thumbnail-held {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-color: #3498db;
}

.pdf-rotate-thumbnail.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.pdf-rotate-thumbnail canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.pdf-rotate-page-number {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    -webkit-user-select: none;
    /* Safari */
    -moz-user-select: none;
    /* Firefox */
    -ms-user-select: none;
    /* IE10+/Edge */
    user-select: none;
    /* Standard */
    display: none;
    /* Hide the old static page number */
}

.pdf-rotate-thumbnail-controls {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 3;
    pointer-events: none;
}

.pdf-rotate-thumbnail:hover .pdf-rotate-thumbnail-controls,
.pdf-rotate-thumbnail-controls.mobile-visible {
    opacity: 1;
    pointer-events: auto;
}

.pdf-rotate-thumbnail-btn {
    pointer-events: auto;
    position: relative;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease;
    background-color: rgba(44, 62, 80, 0.7);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    padding: 0;
}

.pdf-rotate-thumbnail-btn svg {
    width: 18px;
    height: 18px;
}

.pdf-rotate-thumbnail-btn.clicked-zoom {
    transform: scale(1.2);
}

/* Prevent theme hover/focus effects */
.pdf-rotate-tool-container .pdf-rotate-thumbnail-btn:hover,
.pdf-rotate-tool-container .pdf-rotate-thumbnail-btn:active,
.pdf-rotate-tool-container .pdf-rotate-thumbnail-btn:focus {
    background-color: rgba(44, 62, 80, 0.7);
    color: white;
    box-shadow: none;
    outline: none;
    border: none;
}

.pdf-rotate-tool-container .pdf-rotate-thumbnail-btn:active {
    /* Keep the zoom effect from being overridden */
    transform: scale(1.2);
}

.pdf-rotate-tool-container .pdf-rotate-thumbnail-btn:not(.clicked-zoom):active {
    transform: scale(0.95);
}

.pdf-rotate-actions {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 20px;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 11;
    padding: 5px 0;
    margin-bottom: 20px;
    flex-direction: column;
    /* Stack buttons and spinner vertically */
}

.pdf-rotate-bulk-spinner-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 0;
    margin-bottom: 5px;
    color: #2c3e50;
    font-size: 17px;
    height: 20px;
    /* Reserve space to prevent layout shift */
}

.pdf-rotate-main-buttons {
    display: flex;
    gap: 10px;
}

.pdf-rotate-btn {
    padding: 7px 13px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pdf-rotate-clear-btn {
    background: #ecf0f1;
    color: #2c3e50;
}

.pdf-rotate-primary-btn {
    background: #1f6a9c;
    color: white;
}

/* Prevent theme hover/focus effects */
.pdf-rotate-tool-container .pdf-rotate-clear-btn:hover,
.pdf-rotate-tool-container .pdf-rotate-clear-btn:active,
.pdf-rotate-tool-container .pdf-rotate-clear-btn:focus {
    background: #ecf0f1;
    color: #2c3e50;
    box-shadow: none;
    outline: none;
    border: none;
}

.pdf-rotate-tool-container .pdf-rotate-clear-btn:active {
    transform: scale(0.95);
}

.pdf-rotate-tool-container .pdf-rotate-primary-btn:hover,
.pdf-rotate-tool-container .pdf-rotate-primary-btn:active,
.pdf-rotate-tool-container .pdf-rotate-primary-btn:focus {
    background: #1f6a9c;
    color: white;
    box-shadow: none;
    outline: none;
    border: none;
}

.pdf-rotate-tool-container .pdf-rotate-primary-btn:active {
    transform: scale(0.95);
}

.pdf-rotate-result {
    margin-top: 30px;
    text-align: center;
}

.pdf-rotate-success-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.pdf-rotate-success-icon {
    width: 50px;
    height: 50px;
    color: #27ae60;
    margin-bottom: 15px;
}

.pdf-rotate-result-title {
    margin: 0 0 20px 0;
    color: #2c3e50;
}

.pdf-rotate-result-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.pdf-rotate-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.pdf-rotate-close-fullscreen {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

/* Prevent theme hover/focus effects */
.pdf-rotate-tool-container .pdf-rotate-close-fullscreen:hover,
.pdf-rotate-tool-container .pdf-rotate-close-fullscreen:active,
.pdf-rotate-tool-container .pdf-rotate-close-fullscreen:focus {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    box-shadow: none;
    outline: none;
    border: none;
}

.pdf-rotate-tool-container .pdf-rotate-close-fullscreen:active {
    transform: scale(0.95);
}

#pdf-rotate-fullscreen-canvas {
    max-width: 90%;
    max-height: 90%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.sortable-ghost {
    opacity: 0.5;
    background: #c8ebfb;
}

.sortable-fallback {
    opacity: 0.85;
    background: #ffffff;
    border-radius: 4px;
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    cursor: move;
}

.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-rotate-tool-container .pdf-rotate-page-number-input {
    position: absolute;
    bottom: 5px;
    left: 5px;
    /* Move to the left corner */
    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-rotate-page-number-input::-webkit-outer-spin-button,
.pdf-rotate-page-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pdf-rotate-page-number-input {
    -webkit-user-select: none;
    /* Safari */
    -moz-user-select: none;
    /* Firefox */
    -ms-user-select: none;
    /* IE10+/Edge */
    user-select: none;
    /* Standard */
}

.pdf-rotate-tool-container .pdf-rotate-page-number-input:focus {
    background-color: #fff;
    color: #000;
    border: 1px solid #3498db;
    outline: none;
    cursor: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

@media (max-width: 768px) {
    .pdf-rotate-tool-container {
        padding-left: 0;
        padding-right: 0;
        margin: 0 auto 50px;
        box-shadow: none;
        border-top: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
        border-radius: 0;
    }

    .pdf-rotate-thumbnails {
        grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    }

    .pdf-rotate-thumbnail {
        width: 145px;
        height: 195px;
    }

    .pdf-rotate-actions {
        flex-direction: column;
        padding: 10px;
    }

    .pdf-rotate-btn {
        padding: 8px 10px;
    }

    .pdf-rotate-thumbnail-controls {
        opacity: 1;
    }

    .pdf-rotate-tool-container h2 {
        font-size: 1.5rem;
    }

    /* Ensure fullscreen canvas is centered on mobile */
    #pdf-rotate-fullscreen-canvas {
        margin: auto;
    }
}