* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.controls {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    margin-bottom: 25px;
    transition: all 0.3s ease;
    cursor: pointer;
    background: white;
}

.upload-area:hover, .upload-area.dragover {
    border-color: #764ba2;
    background: #f0f4ff;
    transform: translateY(-2px);
}

.upload-area.has-file {
    border-color: #28a745;
    background: #f0fff4;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.6;
}

.settings-group {
    margin-bottom: 25px;
}

.settings-group h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 5px;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

select, input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

select:focus, input:focus {
    outline: none;
    border-color: #667eea;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    margin-top: 10px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.preview-area {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    min-height: 600px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.preview-controls {
    display: flex;
    gap: 10px;
}

.preview-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.preview-btn.active {
    background: #667eea;
}

.preview-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
}

.layout-preview {
    display: grid;
    gap: 10px;
    max-width: 100%;
}

.layout-4up {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.layout-zine {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.layout-side {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}

.page-preview {
    border: 1px solid #ddd;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 150px;
    font-size: 12px;
    color: #666;
    position: relative;
    overflow: hidden;
}

.page-preview canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.page-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.page-number {
    position: absolute;
    top: 5px;
    left: 5px;
    background: #667eea;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
}

.status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
}

.status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.file-info {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.file-info h4 {
    margin-bottom: 10px;
    color: #333;
}

.file-details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    font-size: 14px;
}

.file-details strong {
    color: #667eea;
}

.original-view {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    max-height: 500px;
    overflow-y: auto;
}

.original-page {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    background: white;
    text-align: center;
}

.original-page canvas {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.original-page h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .original-view {
        grid-template-columns: 1fr;
    }
}

.footer {
    text-align: center;
    padding: 10px;
    margin-top: 20px;
    color: #666;
    font-size: 0.9em;
    border-top: 1px solid #eee;
}

.footer p {
    margin: 0;
    font-weight: bold;
}