/* src/styles/pdf-tool.css */

/* === Drop Zone === */
.pdf-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: var(--space-lg);
}

.pdf-dropzone:hover,
.pdf-dropzone.drag-over {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.05);
}

.pdf-dropzone-icon {
    font-size: 3rem;
    margin-bottom: var(--space-sm);
}

.pdf-dropzone-text {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.pdf-dropzone-text strong {
    color: var(--accent);
}

.pdf-dropzone input[type="file"] {
    display: none;
}

/* === File List (for multi-file tools like Merge) === */
.pdf-file-list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-lg) 0;
}

.pdf-file-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-xs);
    background: var(--bg-secondary, var(--surface));
    cursor: grab;
}

.pdf-file-item:active {
    cursor: grabbing;
}

.pdf-file-item .drag-handle {
    color: var(--text-muted);
    cursor: grab;
    font-size: 1.2em;
}

.pdf-file-item .file-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pdf-file-item .file-info {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    white-space: nowrap;
}

.pdf-file-item .remove-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 1.1em;
}

.pdf-file-item .remove-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* === Page Thumbnail Grid === */
.pdf-page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.pdf-page-thumb {
    position: relative;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.pdf-page-thumb:hover {
    border-color: var(--accent);
}

.pdf-page-thumb.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

.pdf-page-thumb canvas {
    width: 100%;
    height: auto;
    display: block;
}

.pdf-page-thumb .page-number {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 3px;
}

.pdf-page-thumb .page-check {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.8);
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    opacity: 0;
    transition: opacity 0.2s;
}

.pdf-page-thumb:hover .page-check,
.pdf-page-thumb.selected .page-check {
    opacity: 1;
}

.pdf-page-thumb.selected .page-check {
    background: var(--accent);
    border-color: var(--accent);
}

/* === Progress Bar === */
.pdf-progress {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin: var(--space-sm) 0;
}

.pdf-progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.pdf-status {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

/* === Action Bar === */
.pdf-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-top: var(--space-lg);
}

.pdf-actions .btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    font-size: var(--font-size-sm);
    transition: opacity 0.2s;
}

.pdf-actions .btn-primary:hover {
    opacity: 0.9;
}

.pdf-actions .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pdf-actions .btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-size-sm);
}

/* === Options Panel === */
.pdf-options {
    background: var(--bg-secondary, var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.pdf-option-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.pdf-option-row:last-child {
    margin-bottom: 0;
}

.pdf-option-row label {
    min-width: 120px;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.pdf-option-row select,
.pdf-option-row input[type="number"],
.pdf-option-row input[type="text"] {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: var(--font-size-sm);
}

/* === Result Summary === */
.pdf-result {
    background: var(--bg-secondary, var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-top: var(--space-lg);
}

.pdf-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) 0;
}

.pdf-result-row .label {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.pdf-result-row .value {
    font-weight: 600;
}

.pdf-result-row .value.success {
    color: #22c55e;
}

/* === Drag and Drop Reorder === */
.pdf-file-item.dragging {
    opacity: 0.4;
}

.pdf-file-item.drag-target {
    border-top: 2px solid var(--accent);
}

/* === Responsive === */
@media (max-width: 600px) {
    .pdf-page-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .pdf-actions {
        flex-direction: column;
    }

    .pdf-actions .btn-primary,
    .pdf-actions .btn-secondary {
        width: 100%;
        text-align: center;
    }
}
