* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #e5322d;
    --primary-dark: #c62b26;
    --primary-light: #ff6b66;
    --success: #21d19f;
    --success-dark: #1ab389;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #868e96;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-md: 0 6px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.navbar {
    background: white;
    box-shadow: var(--shadow);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 1.5rem;
}

.logo i {
    font-size: 2rem;
}

.nav-links {
    display: flex;
    gap: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

.main-content {
    flex: 1;
    padding: 40px 0;
}

.tool-section {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px;
}

.tool-header {
    text-align: center;
    margin-bottom: 40px;
}

.tool-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.tool-icon i {
    font-size: 2rem;
    color: white;
}

.tool-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 10px;
}

.tool-header p {
    color: var(--gray-600);
    font-size: 1.1rem;
}

.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    background: var(--gray-50);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(229, 50, 45, 0.03);
}

.upload-zone.dragover {
    transform: scale(1.01);
}

.upload-icon {
    font-size: 4rem;
    color: var(--gray-400);
    margin-bottom: 20px;
}

.upload-content h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.upload-content p {
    color: var(--gray-500);
    margin-bottom: 25px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn i {
    font-size: 1.1rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

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

.btn-success:hover {
    background: var(--success-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--gray-300);
    color: var(--gray-800);
}

.file-list-container {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: 25px;
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.file-list-header h3 {
    font-size: 1.1rem;
    color: var(--gray-800);
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.file-item .file-preview {
    width: 50px;
    height: 50px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.file-item .file-info {
    flex: 1;
    min-width: 0;
}

.file-item .file-name {
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item .file-size {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.file-item .file-pages {
    font-size: 0.75rem;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 10px;
}

.file-item .btn-icon {
    flex-shrink: 0;
}

.file-list-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.selected-file-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--gray-100);
    border-radius: var(--radius);
    margin-bottom: 25px;
}

.selected-file-card .file-preview {
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
}

.selected-file-card .file-info {
    flex: 1;
}

.selected-file-card .file-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--gray-800);
}

.selected-file-card .file-size {
    color: var(--gray-500);
}

.split-options {
    margin-bottom: 25px;
}

.split-options h3 {
    font-size: 1.1rem;
    color: var(--gray-800);
    margin-bottom: 15px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    background: var(--gray-50);
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.radio-option:hover {
    background: var(--gray-100);
}

.radio-option:has(input:checked) {
    border-color: var(--primary);
    background: rgba(229, 50, 45, 0.05);
}

.radio-option input {
    margin-top: 4px;
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
}

.radio-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.radio-label strong {
    color: var(--gray-800);
}

.radio-label small {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.range-input {
    padding: 0 30px 10px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.page-selector {
    margin-bottom: 25px;
}

.page-selector h3 {
    font-size: 1.1rem;
    color: var(--gray-800);
    margin-bottom: 15px;
}

.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
    padding: 10px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 15px;
}

.page-thumb {
    aspect-ratio: 1;
    background: white;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.page-thumb:hover {
    border-color: var(--gray-400);
}

.page-thumb.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.page-actions {
    display: flex;
    gap: 10px;
}

.loading-overlay,
.result-overlay,
.error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content,
.result-content {
    background: white;
    padding: 50px;
    border-radius: var(--radius-lg);
    text-align: center;
    max-width: 450px;
    width: 90%;
}

.spinner {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.loading-content h3 {
    font-size: 1.5rem;
    color: var(--gray-800);
    margin-bottom: 10px;
}

.loading-content p {
    color: var(--gray-500);
    margin-bottom: 25px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    width: 0%;
    transition: width 0.3s;
    border-radius: 4px;
}

.result-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    font-size: 2.5rem;
}

.result-icon.success {
    background: rgba(33, 209, 159, 0.15);
    color: var(--success);
}

.result-icon.error {
    background: rgba(229, 50, 45, 0.15);
    color: var(--primary);
}

.result-content h2 {
    font-size: 1.75rem;
    color: var(--gray-800);
    margin-bottom: 10px;
}

.result-content p {
    color: var(--gray-500);
    margin-bottom: 30px;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-actions .btn {
    width: 100%;
    justify-content: center;
}

.footer {
    background: var(--gray-800);
    color: var(--gray-400);
    padding: 25px 0;
    text-align: center;
    margin-top: auto;
}

@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 15px;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
    }

    .nav-link {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    .nav-link span {
        display: none;
    }

    .tool-section {
        padding: 25px;
    }

    .upload-zone {
        padding: 40px 20px;
    }

    .file-list-actions {
        flex-direction: column;
        gap: 15px;
    }

    .file-list-actions .btn {
        width: 100%;
    }
}
