.tool-section {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
}

.upload-section {
    text-align: center;
}

.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    border: 2px dashed rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.02);
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(136, 189, 242, 0.05);
}

.drop-zone.dragover {
    transform: scale(1.02);
}

.upload-icon {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.drop-zone h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.drop-zone p {
    color: var(--text-secondary);
}

/* Options Section */
.options-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.file-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--input-bg);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.file-details {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.filename {
    font-weight: 600;
    font-size: 1.1rem;
}

.filesize {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.cancel-btn {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.grid-header label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 600;
}

.selection-actions {
    display: flex;
    gap: 1rem;
}

.text-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0;
}

.text-btn:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.generate-btn {
    background: var(--primary-gradient);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    padding: 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--primary-shadow-md);
    width: 100%;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--primary-shadow-lg);
}

/* Processing Section */
.processing-section {
    padding: 4rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 2rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Results Section */
.results-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.success-icon {
    margin-bottom: 0.5rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    width: 100%;
    margin-top: 1rem;
}

.primary-btn {
    flex: 2;
    background: var(--primary-gradient);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.secondary-btn {
    flex: 1;
    background: transparent;
    color: var(--text-primary);
    font-weight: 600;
    border: 1px solid var(--glass-border);
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--primary-shadow-md);
}

.secondary-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Previews Grid */
.pages-grid-container {
    margin-bottom: 1rem;
    background: var(--input-bg);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.pages-grid::-webkit-scrollbar {
    width: 8px;
}
.pages-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}
.pages-grid::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}
.pages-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.page-thumbnail-wrapper {
    position: relative;
    aspect-ratio: 1 / 1.4;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.page-thumbnail-wrapper:hover {
    border-color: rgba(136, 189, 242, 0.5);
    transform: translateY(-2px);
}

.page-thumbnail-wrapper.selected {
    border-color: var(--primary-color);
    background: rgba(136, 189, 242, 0.1);
}

.page-thumbnail-wrapper.selected::after {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--primary-color);
    color: var(--text-primary);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.page-number-label {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: var(--input-bg);
    color: var(--text-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.page-thumbnail-wrapper canvas {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.canvas-wrapper canvas {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.canvas-loader {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@media (max-width: 600px) {
    .action-buttons {
        flex-direction: column;
    }
    .range-inputs {
        flex-direction: column;
    }
    .preview-container {
        flex-direction: column;
    }
}
