:root {
    --primary: #4361ee;
    --primary-light: #4895ef;
    --secondary: #3f37c9;
    --text: #212529;
    --text-light: #6c757d;
    --background: #ffffff;
    --surface: #f8f9fa;
    --border: #dee2e6;
    --shadow: rgba(0, 0, 0, 0.1);
    --success: #4bb543;
    --success-light: #5ac552;
    --error: #e63946;
}

[data-theme="dark"] {
    --primary: #4895ef;
    --primary-light: #4361ee;
    --secondary: #3a0ca3;
    --text: #f8f9fa;
    --text-light: #adb5bd;
    --background: #121212;
    --surface: #1e1e1e;
    --border: #343a40;
    --shadow: rgba(0, 0, 0, 0.3);
    --success: #4bb543;
    --success-light: #5ac552;
    --error: #e63946;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--background);
    padding: 0;
    margin: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

.theme-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background-color: var(--surface);
    transform: scale(1.1);
}

.hero {
    text-align: center;
    padding: 40px 0 30px;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: var(--primary);
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 40px;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    margin: 40px 0;
    background-color: var(--surface);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.upload-area:hover {
    border-color: var(--primary);
}

.upload-area.active {
    border-color: var(--primary);
    background-color: rgba(67, 97, 238, 0.05);
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.upload-text h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.upload-text p {
    color: var(--text-light);
    margin-bottom: 20px;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(67, 97, 238, 0.4);
}

.btn-primary:disabled {
    background: var(--text-light);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--success-light));
    box-shadow: 0 4px 12px rgba(75, 181, 67, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--success-light), var(--success));
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(75, 181, 67, 0.4);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-secondary:hover {
    background-color: rgba(67, 97, 238, 0.1);
}

.page-selection {
    display: none;
    margin-top: 30px;
    text-align: left;
}

.page-selection h3 {
    margin-bottom: 15px;
    color: var(--text);
}

.page-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--surface);
}

.page-item {
    padding: 15px;
    text-align: center;
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.page-item:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 4px 8px var(--shadow);
}

.page-item.selected {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 8px rgba(67, 97, 238, 0.3);
}

.page-preview {
    width: 100%;
    height: 120px;
    background-color: var(--surface);
    border-radius: 4px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.page-preview canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.page-preview-placeholder {
    color: var(--text-light);
    font-size: 2rem;
}

.page-number {
    font-weight: 600;
}

.preview-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s;
}

.page-item:hover .preview-btn {
    opacity: 1;
}

.selection-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 20px;
}

.file-info {
    margin-top: 15px;
    padding: 10px;
    background-color: var(--surface);
    border-radius: 6px;
    display: none;
    text-align: center;
}

.progress-container {
    margin: 30px 0;
    display: none;
}

.progress-bar {
    height: 8px;
    background-color: var(--surface);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    text-align: center;
    color: var(--text-light);
}

.result {
    margin: 30px 0;
    text-align: center;
    display: none;
}

.result.success {
    display: block;
}

.result-icon {
    font-size: 3rem;
    color: var(--success);
    margin-bottom: 20px;
}

.result h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.result p {
    color: var(--text-light);
    margin-bottom: 20px;
}

.section {
    padding: 40px 0;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
    color: var(--text);
}

.features {
    background-color: var(--surface);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.feature-card {
    background-color: var(--background);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px var(--shadow);
    text-align: center;
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.feature-card h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.feature-card p {
    color: var(--text-light);
}

.faq-item {
    margin-bottom: 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.faq-question {
    padding: 18px;
    background-color: var(--surface);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.faq-question:hover {
    background-color: rgba(67, 97, 238, 0.05);
}

.faq-answer {
    padding: 0 18px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-answer.active {
    padding: 18px;
    max-height: 500px;
}

.faq-icon {
    transition: transform 0.3s;
}

.faq-item.active .faq-icon {
    transform: rotate(180deg);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-content p {
    margin-bottom: 20px;
    color: var(--text);
}

.about-content h2 {
    margin: 30px 0 15px;
    color: var(--text);
}

.download-container {
    display: none;
    text-align: center;
    margin: 30px 0;
}

.download-container.active {
    display: block;
}

/* Preview Modal Styles */
.preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.preview-modal.active {
    display: flex;
}

.preview-content {
    background-color: var(--background);
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.preview-header h3 {
    margin: 0;
    color: var(--text);
}

.close-preview {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.3s;
}

.close-preview:hover {
    color: var(--error);
}

.preview-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-canvas {
    max-width: 100%;
    max-height: 70vh;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.preview-nav {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .selection-controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .page-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .theme-toggle {
        right: 1rem;
        top: 1rem;
    }
}