/* ═══════════════════════════════════════════════════════════
   PDF結合・分割ツール — styles
   prefix: pm-
═══════════════════════════════════════════════════════════ */

.pm-container {
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 16px 40px;
    color: #1f2937;
}

/* ── Mode Tabs ── */
.pm-mode-tabs {
    display: flex;
    gap: 0;
    background: #f3f4f6;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
}

.pm-mode-tab {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    color: #6b7280;
    transition: all 0.2s;
    text-align: center;
    white-space: nowrap;
}

.pm-mode-tab.active {
    background: #fff;
    color: #2563eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ── Section Cards ── */
.pm-section {
    margin-bottom: 20px;
}

.pm-card {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 16px;
}

.pm-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 16px;
}

/* ── Drop Zone ── */
.pm-drop-zone {
    border: 2.5px dashed #93c5fd;
    border-radius: 14px;
    background: #eff6ff;
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.pm-drop-zone:hover {
    border-color: #60a5fa;
    background: #dbeafe;
}

.pm-drop-zone.dragover {
    border-color: #3b82f6;
    background: #dbeafe;
    transform: scale(1.01);
}

.pm-drop-zone.compact {
    padding: 14px 20px;
    border-width: 2px;
}

.pm-drop-zone.compact .pm-drop-icon {
    font-size: 18px;
    margin-bottom: 0;
    display: inline;
    margin-right: 6px;
}

.pm-drop-zone.compact .pm-drop-text {
    display: inline;
    font-size: 13px;
    margin: 0;
}

.pm-drop-zone.compact .pm-drop-hint {
    display: none;
}

.pm-drop-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.pm-drop-text {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 6px;
    line-height: 1.5;
}

.pm-drop-hint {
    font-size: 11px;
    color: #9ca3af;
    margin: 0;
}

/* ── File List ── */
.pm-file-list {
    margin-bottom: 16px;
}

.pm-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 6px;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.pm-file-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pm-file-item.sortable-ghost {
    opacity: 0.35;
    border-color: #3b82f6;
}

.pm-file-item.sortable-chosen {
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
}

.pm-drag-handle {
    cursor: grab;
    color: #9ca3af;
    font-size: 16px;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    line-height: 1;
}

.pm-thumb {
    width: 30px;
    height: 40px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: #f3f4f6;
}

.pm-file-info {
    flex: 1;
    min-width: 0;
}

.pm-file-name {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pm-file-meta {
    font-size: 11px;
    color: #9ca3af;
    margin: 2px 0 0;
}

.pm-file-remove {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    flex-shrink: 0;
    transition: all 0.15s;
    font-family: inherit;
    line-height: 1;
}

.pm-file-remove:hover {
    color: #ef4444;
    background: #fef2f2;
}

/* ── Single file info (extract/split) ── */
.pm-single-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #eff6ff;
    border: 1.5px solid #93c5fd;
    border-radius: 10px;
    margin-bottom: 16px;
}

.pm-single-file-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: #1e40af;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pm-single-file-pages {
    font-size: 12px;
    color: #3b82f6;
    font-weight: 600;
    flex-shrink: 0;
}

.pm-single-file-clear {
    background: none;
    border: none;
    color: #93c5fd;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
    transition: color 0.15s;
    font-family: inherit;
    line-height: 1;
}

.pm-single-file-clear:hover {
    color: #ef4444;
}

/* ── Page range input ── */
.pm-input-group {
    margin-bottom: 14px;
}

.pm-input-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 6px;
}

.pm-input-text {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 600;
    color: #1f2937;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.pm-input-text:focus {
    outline: none;
    border-color: #3b82f6;
}

.pm-input-hint {
    font-size: 11px;
    color: #9ca3af;
    margin: 4px 0 0;
}

.pm-validation-msg {
    font-size: 12px;
    margin: 6px 0 0;
    font-weight: 600;
}

.pm-validation-msg.valid {
    color: #10b981;
}

.pm-validation-msg.invalid {
    color: #ef4444;
}

/* ── Split options ── */
.pm-split-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.pm-split-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.pm-split-option:hover {
    border-color: #93c5fd;
}

.pm-split-option.selected {
    background: #eff6ff;
    border-color: #3b82f6;
}

.pm-split-option input[type="radio"] {
    accent-color: #3b82f6;
    flex-shrink: 0;
}

.pm-split-option label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
}

.pm-split-n-input {
    width: 50px;
    padding: 6px 8px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
}

.pm-split-n-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.pm-split-pos-input {
    flex: 1;
    padding: 6px 10px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
}

.pm-split-pos-input:focus {
    outline: none;
    border-color: #3b82f6;
}

/* ── Action Button ── */
.pm-btn {
    display: block;
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    text-align: center;
    box-sizing: border-box;
}

.pm-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pm-btn-merge {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
}

.pm-btn-merge:not(:disabled):hover {
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.5);
}

.pm-btn-extract {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
}

.pm-btn-extract:not(:disabled):hover {
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.5);
}

.pm-btn-split {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.pm-btn-split:not(:disabled):hover {
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.5);
}

/* ── Progress ── */
.pm-progress {
    display: none;
    margin-bottom: 16px;
}

.pm-progress.visible {
    display: block;
}

.pm-progress-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.pm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}

.pm-progress-fill.indeterminate {
    width: 40%;
    animation: pm-indeterminate 1.2s ease-in-out infinite;
}

@keyframes pm-indeterminate {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(350%);
    }
}

.pm-progress-text {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    margin: 0;
    text-align: center;
}

/* ── Alerts ── */
.pm-alert {
    display: none;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
    line-height: 1.5;
    white-space: pre-line;
}

.pm-alert.visible {
    display: block;
}

.pm-alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1.5px solid #6ee7b7;
}

.pm-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1.5px solid #fca5a5;
}

/* ── Security Banner ── */
.pm-security-banner {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1.5px solid #93c5fd;
    border-radius: 14px;
    padding: 16px;
    margin-top: 20px;
    margin-bottom: 24px;
}

.pm-security-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.pm-security-icon {
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1;
}

.pm-security-item strong {
    font-size: 11px;
    font-weight: 700;
    color: #1e40af;
    display: block;
    margin-bottom: 2px;
}

.pm-security-item p {
    font-size: 10px;
    color: #3b82f6;
    margin: 0;
    line-height: 1.35;
}

@media (max-width: 520px) {
    .pm-security-banner {
        grid-template-columns: 1fr;
    }

    .pm-mode-tab {
        font-size: 12px;
        padding: 10px 6px;
    }
}

/* ── Add file button ── */
.pm-btn-add-file {
    display: block;
    width: 100%;
    padding: 10px;
    border: 1.5px dashed #93c5fd;
    border-radius: 10px;
    background: transparent;
    color: #3b82f6;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: all 0.15s;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.pm-btn-add-file:hover {
    background: #eff6ff;
    border-color: #3b82f6;
}