:root {
    --primary-color: #4361ee;
    --primary-dark: #3a56d4;
    --secondary-color: #f72585;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-color: #6c757d;
    --success-color: #4bb543;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7ff;
    color: var(--dark-color);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

header h1 i {
    margin-right: 0.5rem;
}

header p {
    color: var(--gray-color);
    font-size: 1.1rem;
}

.upload-area {
    background-color: white;
    border: 2px dashed #ccc;
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    margin-bottom: 2rem;
    transition: var(--transition);
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(67, 97, 238, 0.05);
}

.upload-area i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-area h2 {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.upload-area p {
    color: var(--gray-color);
    margin: 1rem 0;
}

.file-info {
    margin-top: 1rem;
    padding: 1rem;
    background-color: rgba(67, 97, 238, 0.1);
    border-radius: var(--border-radius);
    color: var(--primary-color);
    font-weight: 500;
    display: none;
}

.extraction-options {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--box-shadow);
}

.extraction-options h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.option-checkbox {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    user-select: none;
}

.option-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: var(--transition);
}

.option-checkbox:hover input ~ .checkmark {
    border-color: var(--primary-color);
}

.option-checkbox input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.option-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.option-checkbox .checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.page-range {
    margin-top: 1rem;
}

.page-range label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.page-range input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.page-range input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn i {
    font-size: 1rem;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
    flex: 1;
}

.btn.primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
}

.btn.secondary {
    background-color: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    flex: 1;
}

.btn.secondary:hover {
    background-color: rgba(67, 97, 238, 0.1);
}

.btn.small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.result-section {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-top: 2rem;
    overflow: hidden;
}

.result-section.hidden {
    display: none;
}

.tabs {
    display: flex;
    border-bottom: 1px solid #eee;
}

.tab-btn {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray-color);
    position: relative;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active:after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
}

.tab-content {
    padding: 1.5rem;
    display: none;
}

.tab-content.active {
    display: block;
}

.text-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.extracted-text {
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    white-space: pre-wrap;
    font-family: monospace;
    line-height: 1.5;
    border: 1px solid #eee;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.image-card {
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.image-container {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    overflow: hidden;
}

.image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-info {
    padding: 0.75rem;
    background-color: white;
}

.image-info p {
    font-size: 0.8rem;
    color: var(--gray-color);
    margin-bottom: 0.5rem;
}

.image-actions {
    display: flex;
    gap: 0.5rem;
}

.image-actions .btn {
    flex: 1;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
}

.info-label {
    font-size: 0.9rem;
    color: var(--gray-color);
    margin-bottom: 0.25rem;
}

.info-value {
    font-weight: 500;
    color: var(--dark-color);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(67, 97, 238, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--dark-color);
}

.progress-container {
    width: 80%;
    max-width: 300px;
    height: 8px;
    background-color: #eee;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

#progressText {
    color: var(--gray-color);
    font-size: 0.9rem;
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .images-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .images-grid {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        overflow-x: auto;
        white-space: nowrap;
    }
}