.pdf-container {
    width: min(var(--max-w), calc(100% - 24px));
    margin: 0 auto;
}

.pdf-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-main);
}

.pdf-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border-color: var(--primary);
    text-decoration: none;
}

.pdf-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.pdf-title {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 8px;
}

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

/* Tool specific layout */
.pdf-tool-header {
    text-align: center;
    margin-bottom: 30px;
}

.pdf-dropzone {
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    padding: 50px 20px;
    text-align: center;
    cursor: pointer;
    background: #fdfdfd;
    transition: background 0.2s, border-color 0.2s;
    margin-bottom: 20px;
}

.pdf-dropzone:hover, .pdf-dropzone.dragover {
    background: var(--nav-active-bg);
}

.pdf-dropzone .pdf-icon {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 10px;
}

/* Work area */
.pdf-workspace {
    display: none; /* hidden until files selected */
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.pdf-item-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    list-style: none;
    padding: 0;
}

.pdf-item {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 10px;
    text-align: center;
    position: relative;
    cursor: grab;
}

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

.pdf-item-preview {
    width: 100%;
    height: 150px;
    object-fit: contain;
    background: white;
    border: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.pdf-item-canvas-container {
    width: 100%;
    height: 150px;
    background: white;
    border: 1px solid var(--border-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.pdf-item-canvas-container canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.pdf-item-name {
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pdf-item-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.pdf-item-rotate {
    position: absolute;
    top: -8px;
    left: -8px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.pdf-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-body);
    padding: 15px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.pdf-settings {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.pdf-progress {
    display: none;
    margin-top: 20px;
}

.pdf-progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.pdf-progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.2s;
}

.pdf-progress-text {
    text-align: center;
    font-size: 0.9rem;
    margin-top: 8px;
    color: var(--primary);
    font-weight: bold;
}

.pdf-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .pdf-item-list {
        grid-template-columns: repeat(2, 1fr);
    }
    .pdf-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}
