/* Toolstrem PDF Merger Styling */
.pdf-merger-wrap {
    font-family: var(--font-sans);
    color: var(--text-main);
    padding: 2rem 0;
}

.pdf-merger-container {
    max-width: 960px; /* Slightly wider to support side-by-side or large layout workspace */
    margin: 0 auto;
    padding: 0 1rem;
}

/* Glassmorphism Card Wrapper */
.pdf-merger-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 2.25rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

/* Drag & Drop Upload Zone */
.dropzone-area {
    border: 2px dashed rgba(59, 130, 246, 0.4);
    background: var(--bg-surface-alt);
    border-radius: 14px;
    padding: 3.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    outline: none;
    margin-bottom: 1.5rem;
}

.dropzone-area * {
    pointer-events: none;
}


.dropzone-area:hover, .dropzone-area.dragover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.15);
}

.dropzone-area:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.dropzone-icon {
    font-size: 3.2rem;
    color: var(--primary);
    margin-bottom: 1.25rem;
    transition: transform 0.3s ease;
}

.dropzone-area:hover .dropzone-icon {
    transform: translateY(-5px) scale(1.05);
}

.dropzone-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.dropzone-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Split Queue & Visual Workspace panels */
.workspace-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Files Queue List */
.files-panel-title {
    font-size: 0.88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-queue-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.queue-item {
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.queue-item:hover {
    box-shadow: var(--shadow-sm);
}

/* File thumbnail wrapper */
.queue-thumb-container {
    width: 50px;
    height: 70px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.queue-thumb-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.queue-thumb-icon {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.queue-meta {
    flex-grow: 1;
    overflow: hidden;
}

.queue-name-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.queue-filename {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-main);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    cursor: pointer;
}

.queue-filename:hover {
    color: var(--primary);
    text-decoration: underline;
}

.queue-rename-input {
    font-size: 0.85rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--primary);
    color: var(--text-main);
    width: 100%;
}

.queue-details {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.queue-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.queue-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.queue-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
}

.queue-btn-danger:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Page Organizer Workspace */
.pages-organizer-container {
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
}

.organizer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 10px;
}

.organizer-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.organizer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary-sm {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary-sm:hover {
    background: var(--border-color);
}

/* Page Organizer Visual Grid */
.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1rem;
    min-height: 100px;
}

/* Card representation of a single PDF page */
.page-thumbnail-card {
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 8px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.page-thumbnail-card.draggable-dragging {
    opacity: 0.4;
    border-color: var(--primary);
    transform: scale(0.95);
}

.page-thumbnail-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.page-thumb-preview-wrap {
    width: 100%;
    aspect-ratio: 0.72;
    background: #f1f5f9;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    position: relative;
}

.page-thumb-preview-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.page-badge-index {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(15, 23, 42, 0.75);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.page-doc-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: var(--primary);
    color: #ffffff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Page action icons overlay */
.page-thumb-actions {
    display: flex;
    justify-content: space-between;
    width: 100%;
    border-top: 1px solid var(--border-color);
    padding-top: 6px;
    margin-top: auto;
}

.page-action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 3px 5px;
    border-radius: 4px;
    transition: all 0.15s;
}

.page-action-btn:hover {
    color: var(--text-main);
    background: rgba(0,0,0,0.05);
}

[data-theme="dark"] .page-action-btn:hover {
    background: rgba(255,255,255,0.08);
}

.page-action-btn-danger:hover {
    color: #ef4444 !important;
}

/* Insertion point placeholder */
.insert-separator {
    width: 4px;
    margin: 0 -4px;
    height: 100%;
    background: transparent;
    transition: background 0.2s;
    cursor: pointer;
    position: relative;
    z-index: 10;
}

.insert-separator.active {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

/* Configure Panel and Merge Action */
.settings-section {
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.settings-input-row {
    display: flex;
    gap: 8px;
}

.text-input-field {
    flex-grow: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.text-input-field:focus {
    border-color: var(--primary);
}

.settings-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    height: 42px;
}

.settings-switch-lbl {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Custom switch input layout matches PDF to Word */
.pg-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.pg-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.pg-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border-color);
    transition: .3s;
    border-radius: 34px;
}

.pg-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .pg-slider {
    background-color: var(--primary);
}

input:focus-visible + .pg-slider {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.4);
}

input:checked + .pg-slider:before {
    transform: translateX(20px);
}

/* Large Execution Action Button */
.btn-merge-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: linear-gradient(90deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 1.1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.25);
    margin-bottom: 1.5rem;
}

.btn-merge-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
}

.btn-merge-action:active {
    transform: translateY(0);
}

.btn-merge-action:disabled {
    background: #475569 !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Sticky Action Button layout on Mobile viewports */
@media (max-width: 576px) {
    .pdf-merger-card {
        padding: 1.25rem;
        border-radius: 12px;
    }
    .pdf-merger-container {
        padding: 0 0.5rem;
    }
    .dropzone-area {
        padding: 2.25rem 1rem;
    }
    .section-title {
        font-size: 1.6rem !important;
    }
    .sticky-mobile-trigger {
        position: fixed;
        bottom: 16px;
        left: 16px;
        right: 16px;
        width: calc(100% - 32px) !important;
        z-index: 1000;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
        margin-bottom: 0 !important;
    }
}

/* Live progress bar metrics */
.progress-hud {
    background: var(--bg-surface-alt);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.progress-stats-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.progress-bar-bg {
    background: var(--border-color);
    height: 8px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--border-focus));
    border-radius: 10px;
    transition: width 0.2s ease;
}

/* Result Screen layout */
.result-card {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 14px;
    padding: 2.25rem;
    text-align: center;
    margin-bottom: 2rem;
}

.result-success-icon {
    font-size: 3.5rem;
    color: #10b981;
    margin-bottom: 1.25rem;
}

.result-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.result-meta-txt {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
}

.result-actions-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-download-pg {
    background: #10b981;
    border: none;
    color: #ffffff;
    padding: 0.9rem 2.25rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}

.btn-download-pg:hover {
    background: #059669;
    transform: translateY(-2px);
}

.btn-reset-pg {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.9rem 2.25rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset-pg:hover {
    background: var(--border-color);
    color: var(--text-main);
}

/* History logs */
.history-card {
    background: var(--bg-surface-alt);
    border-radius: 14px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    margin-top: 1.5rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.history-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.btn-clear-history {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-clear-history:hover {
    color: #ef4444;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.82rem;
    border: 1px solid var(--border-color);
}

.history-meta-line {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-filename {
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 250px;
}

.history-stats {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.history-item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-action-trigger {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.history-action-trigger:hover {
    color: var(--border-focus);
}

.history-delete-trigger:hover {
    color: #ef4444;
}

/* Toast Alerts */
.pg-toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-surface);
    border-left: 4px solid #ef4444;
    color: var(--text-main);
    padding: 14px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    font-weight: 600;
    font-size: 0.88rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border-color);
}

.pg-toast-notification.success {
    border-left-color: #10b981;
}

.pg-toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* Security notice banner */
.notice-banner {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 1.5rem;
}

.notice-banner i {
    color: var(--primary);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.notice-banner p {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0;
    font-weight: 550;
}

/* Feature grid items */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 3rem 0;
}

@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
}

.feature-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
    transition: all 0.25s ease;
}

.feature-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.feature-card i {
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.feature-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Zoom preview modal */
.zoom-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    padding: 1rem;
}

.zoom-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.zoom-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
    max-width: 600px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: var(--shadow-xl);
    position: relative;
}

.zoom-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.zoom-close:hover {
    color: var(--text-main);
}

.zoom-canvas-wrap {
    width: 100%;
    max-height: 450px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    margin-bottom: 1rem;
}

.zoom-canvas-wrap canvas {
    max-width: 100%;
    height: auto;
}

.zoom-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}
