:root {
    --primary-color: #4a6fa5;
    --secondary-color: #6b8cbc;
    --accent-color: #ff6b6b;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --success-color: #28a745;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: var(--dark-color);
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.app-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

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

.upload-section, .preview-section {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--box-shadow);
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--light-color);
    padding-bottom: 10px;
}

.upload-area {
    border: 2px dashed var(--secondary-color);
    border-radius: var(--border-radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    background-color: rgba(107, 140, 188, 0.05);
}

.upload-area:hover {
    background-color: rgba(107, 140, 188, 0.1);
}

.upload-icon {
    font-size: 48px;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.upload-area p {
    margin-bottom: 15px;
}

.btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
}

.btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.btn-accent {
    background-color: var(--accent-color);
}

.btn-accent:hover {
    background-color: #ff5252;
}

.btn-success {
    background-color: var(--success-color);
}

.btn-success:hover {
    background-color: #218838;
}

.btn-block {
    display: block;
    width: 100%;
}

.options-section {
    margin-top: 20px;
}

.option-group {
    margin-bottom: 15px;
}

.option-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.option-group select, .option-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.image-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    padding: 10px;
}

.image-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.image-item:last-child {
    border-bottom: none;
}

.image-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 15px;
}

.image-info {
    flex-grow: 1;
}

.image-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.image-size {
    font-size: 0.8rem;
    color: #777;
}

.image-actions {
    display: flex;
    gap: 5px;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.preview-tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #666;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn:hover {
    color: var(--primary-color);
}

.preview-container {
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 20px;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    text-align: center;
    overflow: auto;
}

.preview-container.active {
    display: flex;
}

.preview-placeholder {
    color: #777;
}

.preview-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#pdfPreviewContainer {
    flex-direction: column;
    align-items: center;
}

.pdf-preview-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.pdf-preview-controls button {
    padding: 8px 16px;
}

.pdf-page-info {
    font-weight: 600;
    color: var(--primary-color);
}

.pdf-canvas {
    max-width: 100%;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: #777;
    font-size: 0.9rem;
}

.hidden {
    display: none !important;
}

.drag-over {
    background-color: rgba(107, 140, 188, 0.2);
    border-color: var(--primary-color);
}

.instructions {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--box-shadow);
}

.instructions h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.instructions ol {
    margin-left: 20px;
}

.instructions li {
    margin-bottom: 10px;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

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