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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: left;
    margin-bottom: 40px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.header-left {
    flex: 1;
    min-width: 250px;
}

.header-left h1 {
    margin: 0;
    color: #2563eb;
    font-size: 2.5em;
}

.header-left .subtitle {
    margin: 0.5rem 0 0 0;
    color: #666;
    font-size: 1.1em;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.legal-ready-logo {
    height: 80px;
    width: auto;
    object-fit: contain;
}

.legal-ready-text {
    margin: 0;
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
    text-align: right;
}

.upload-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.upload-box {
    text-align: center;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.btn-secondary {
    background: #10b981;
    color: white;
    margin-left: 10px;
}

.btn-secondary:hover {
    background: #059669;
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
    min-width: 220px;
}

.file-info {
    margin-top: 20px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 6px;
    text-align: center;
    color: #64748b;
}

.status {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
}

.status.info {
    background: #dbeafe;
    color: #1e40af;
}

.status.success {
    background: #d1fae5;
    color: #065f46;
}

.status.error {
    background: #fee2e2;
    color: #991b1b;
}

.index-editor {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toolbar {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar button {
    padding: 8px 16px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.toolbar button:hover {
    background: #f9fafb;
    border-color: #2563eb;
}

.validation-status {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 6px;
    font-weight: 500;
}

.validation-status.valid {
    background: #d1fae5;
    color: #065f46;
}

.validation-status.invalid {
    background: #fee2e2;
    color: #991b1b;
}

.validation-status div {
    margin: 5px 0;
}

.document-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.document-table th {
    background: #f8fafc;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
}

.document-table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.document-table tfoot td {
    padding: 12px;
    font-weight: 600;
    border-top: 2px solid #2563eb;
}

.document-table tr:hover {
    background: #f8fafc;
}

.document-table tr.excluded-row {
    opacity: 0.6;
    background: #f5f5f5 !important;
}

.document-table tr.excluded-row td {
    text-decoration: line-through;
    color: #94a3b8;
}

.document-table tr.excluded-row:hover {
    background: #e5e7eb !important;
}

.document-table .editable {
    cursor: pointer;
    position: relative;
}

.document-table .editable:hover {
    background: #fef3c7;
}

.document-table .cell-edit {
    width: 100%;
    padding: 8px;
    border: 2px solid #2563eb;
    border-radius: 4px;
    font-size: 14px;
}

.document-table button {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 4px;
}

.document-table button:hover {
    background: #f9fafb;
}

.document-table button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.process-section {
    text-align: center;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

.process-section button {
    padding: 16px 48px;
    font-size: 18px;
    font-weight: 600;
}

.error-box {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.error-box h2 {
    color: #991b1b;
    margin-bottom: 15px;
}

.error-box p {
    color: #64748b;
    margin: 10px 0;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Choice screen styling */
.choice-screen {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.choice-screen h2 {
    color: #2563eb;
    margin-bottom: 10px;
}

.choice-buttons {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.choice-option {
    flex: 1;
    min-width: 280px;
    max-width: 400px;
    padding: 30px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.choice-option:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
}

.choice-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.choice-option h3 {
    color: #1e293b;
    margin-bottom: 10px;
}

.choice-option p {
    color: #64748b;
    margin-bottom: 20px;
    line-height: 1.5;
}

.choice-option button {
    margin: 0;
}

/* Level selection styling */
.level-option {
    transition: all 0.2s;
}

.level-option:hover {
    border-color: #2563eb !important;
    background: #f8fafc;
}

.level-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Responsive styles for header with logo */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .header-left {
        text-align: center;
    }
    
    .header-left h1 {
        font-size: 2rem;
    }
    
    .header-right {
        align-items: center;
    }
    
    .legal-ready-logo {
        height: 60px;
    }
    
    .legal-ready-text {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .header-left h1 {
        font-size: 1.75rem;
    }
    
    .header-left .subtitle {
        font-size: 1rem;
    }
    
    .legal-ready-logo {
        height: 50px;
    }
}

/* Recommended option styling */
.choice-option.recommended {
    border-color: #10b981;
    border-width: 3px;
    background: linear-gradient(to bottom, #f0fdf4 0%, #ffffff 100%);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.2);
    position: relative;
}

.choice-option.recommended:hover {
    border-color: #059669;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.recommended-badge {
    position: absolute;
    top: -12px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* Responsive adjustments for recommended badge */
@media (max-width: 768px) {
    .recommended-badge {
        top: 10px;
        right: 10px;
        font-size: 12px;
        padding: 3px 10px;
    }
}

/* User info and logout styling */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
    margin-top: 12px;
    border: 1px solid #e2e8f0;
}

.user-email {
    font-size: 14px;
    color: #475569;
    font-weight: 500;
}

.logout-btn {
    padding: 6px 14px;
    background: #ef4444;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #dc2626;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* Responsive adjustments for user info */
@media (max-width: 768px) {
    .user-info {
        justify-content: center;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .user-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .logout-btn {
        width: 100%;
        text-align: center;
    }
}

/* ========================================
   PAGE OFFSET MODAL STYLES - v1.6.5
   ======================================== */

/* Modal overlay */
.offset-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal content box */
.offset-modal-content {
    background: white;
    padding: 32px;
    border-radius: 12px;
    max-width: 550px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Heading */
.offset-modal-content h3 {
    margin: 0 0 16px 0;
    color: #1f2937;
    font-size: 24px;
    font-weight: 600;
}

/* Explanation text */
.offset-modal-content .explanation {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* Form group */
.offset-modal-content .form-group {
    margin: 24px 0;
}

.offset-modal-content .form-group label {
    display: block;
    margin-bottom: 10px;
    color: #374151;
    font-size: 16px;
}

/* Page number input */
.offset-modal-content .page-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 600;
    transition: border-color 0.2s;
}

.offset-modal-content .page-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Help text */
.offset-modal-content .help-text {
    display: block;
    margin-top: 8px;
    color: #9ca3af;
    font-size: 14px;
}

/* Info box */
.offset-modal-content .info-box {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 14px;
    margin: 16px 0;
    color: #0c4a6e;
    line-height: 1.5;
}

.offset-modal-content .info-box.highlight {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.offset-modal-content .info-box strong {
    color: #1e40af;
}

.offset-modal-content .info-box.highlight strong {
    color: #78350f;
}

/* Example box */
.offset-modal-content .example-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 14px;
    margin: 16px 0;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.6;
}

.offset-modal-content .example-box strong {
    color: #1f2937;
}

/* Modal actions */
.offset-modal-content .modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

/* Buttons */
.offset-modal-content .btn-secondary,
.offset-modal-content .btn-primary {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.offset-modal-content .btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.offset-modal-content .btn-secondary:hover {
    background: #e5e7eb;
}

.offset-modal-content .btn-secondary:active {
    transform: scale(0.98);
}

.offset-modal-content .btn-primary {
    background: #667eea;
    color: white;
}

.offset-modal-content .btn-primary:hover {
    background: #5568d3;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.offset-modal-content .btn-primary:active {
    transform: scale(0.98);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .offset-modal-content {
        padding: 24px;
        border-radius: 8px;
    }
    
    .offset-modal-content h3 {
        font-size: 20px;
    }
    
    .offset-modal-content .modal-actions {
        flex-direction: column;
    }
    
    .offset-modal-content .btn-secondary,
    .offset-modal-content .btn-primary {
        width: 100%;
    }
}

/* Accessibility */
.offset-modal-content .page-input:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.offset-modal-content .btn-secondary:focus-visible,
.offset-modal-content .btn-primary:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}
