:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #1e40af;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --transition: all 0.2s ease-in-out;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    min-height: 100vh;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem 1rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-hero {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.header-tagline {
    font-size: 1.125rem;
    opacity: 0.95;
    text-align: center;
    max-width: 800px;
}

.header-search {
    width: 100%;
    max-width: 560px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.header-search:focus-within {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
}

.header-search i {
    color: white;
    opacity: 0.9;
}

.header-search input {
    border: none;
    outline: none;
    width: 100%;
    background: transparent;
    color: white;
    font-size: 1rem;
}

.header-search input::placeholder {
    color: rgba(255, 255, 255, 0.85);
}

header h1 {
    font-size: 2.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
}

.logo-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
    border-radius: 6px;
}

.main-nav {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.4);
}

.nav-link:active {
    transform: translateY(0);
}

header p {
    font-size: 1.125rem;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto 1.5rem;
    text-align: center;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.header-features {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.feature-badge {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.feature-badge:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Navigation */
.back-button {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Grid Layout */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.75rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.tool-card {
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: var(--transition);
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-card i {
    font-size: 3.5rem;
    color: var(--primary-color);
    margin-bottom: 1.25rem;
    transition: var(--transition);
}

.tool-card:hover i {
    transform: scale(1.1);
}

.tool-card h3 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.tool-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Tool Sections */
.tools-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.tool-section {
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.tool-header h2 {
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.75rem;
    font-weight: 600;
}

.tool-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    transform: translateY(-2px);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    transform: scale(1.02);
}

.upload-area i {
    font-size: 3.5rem;
    color: var(--primary-color);
    margin-bottom: 1.25rem;
    transition: var(--transition);
}

.upload-area:hover i {
    transform: scale(1.1);
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.upload-area .file-info {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Form Elements */
.input-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    transition: var(--transition);
}

.input-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-group i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.input-group input,
.input-group textarea,
.input-group select {
    border: none;
    outline: none;
    width: 100%;
    font-size: 1rem;
    background: transparent;
    color: var(--text-primary);
}

.input-group input::placeholder,
.input-group textarea::placeholder {
    color: var(--text-muted);
}

textarea {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    font-size: 1rem;
    resize: vertical;
    min-height: 120px;
    transition: var(--transition);
}

textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    padding: 1.25rem 2.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-width: 140px;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button.secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

button.secondary:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

/* Progress and Status */
.progress-container {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin: 1rem 0;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-xl);
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

#progress-text {
    text-align: center;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

.status-message {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin: 1rem 0;
    font-weight: 500;
}

.status-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Thumbnail Grid */
.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
    align-items: start;
    justify-items: center;
}

.page-thumbnail {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 0; /* Prevent flex item from collapsing */
    margin-bottom: 1rem; /* Prevent vertical overlapping */
}

.page-thumbnail:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.page-thumbnail.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.page-thumbnail img,
.page-thumbnail canvas {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 500px; /* Even larger thumbnails for better readability */
    border-radius: var(--radius-sm);
    transition: var(--transition);
    object-fit: contain; /* Maintain aspect ratio */
}

.page-thumbnail canvas {
    display: block; /* Ensure canvas behaves like a block element */
}

/* Rotation controls */
.rotation-controls {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    z-index: 10;
}

.rotation-controls button {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.375rem;
    cursor: pointer;
    font-size: 0.8rem;
    min-width: auto;
    transition: var(--transition);
}

.rotation-controls button:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.rotation-indicator {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.page-thumbnail:hover img {
    transform: scale(1.05);
}

.page-number {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
}

/* File List */
.file-list {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.file-list:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}


/* PDF Viewer Specific Styles */
.viewer-controls {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    align-items: start;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.control-group h4 {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.navigation-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    min-width: 100px;
}

.nav-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.page-info {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    min-width: 100px;
    text-align: center;
    padding: 0.5rem;
    background: var(--background-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.zoom-button {
    background: var(--surface-color);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-button:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.zoom-level {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 50px;
    text-align: center;
    padding: 0.5rem;
    background: var(--background-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.view-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.view-button {
    background: var(--surface-color);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 120px;
    justify-content: center;
}

.view-button:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.view-button.active {
    background: var(--primary-color);
    color: white;
}

.pdf-viewer-container {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-viewer {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.pdf-viewer canvas {
    max-width: 100%;
    max-height: 100%;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-sm);
}

/* Help Text */
.help-text {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    line-height: 1.4;
    font-style: italic;
}

.help-text::before {
    content: '💡 ';
}

.file-list h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    background: var(--background-color);
}

.file-item.dragging {
    opacity: 0.6;
    border-style: dashed;
}

.file-item:last-child {
    margin-bottom: 0;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-icon {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
}

.file-size {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.file-remove {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.file-remove:hover {
    background: var(--error-color);
    color: white;
}

/* Merge Options */
.merge-options {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 1rem 0;
}

.merge-options label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 500;
}

.merge-options input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary-color);
}

/* Footer */
footer {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        padding: 2rem 1rem;
    }
    
    .header-top {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .header-hero {
        padding: 0 0.5rem;
    }
    
    .main-nav {
        justify-content: center;
        gap: 1rem;
    }
    
    .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    header h1 {
        font-size: 2.25rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding: 0 1rem;
    }
    
    .tool-card {
        padding: 2rem 1.5rem;
    }
    
    .tools-container {
        padding: 0 1rem;
    }
    
    .tool-section {
        padding: 2rem 1.5rem;
    }
    
    .upload-area {
        padding: 3rem 1.5rem;
    }
    
    .thumbnail-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .main-nav {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }
    
    .nav-link {
        text-align: center;
        width: 100%;
    }
    
    .tool-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .tool-header h2 {
        font-size: 1.5rem;
    }
    
    .upload-area {
        padding: 2.5rem 1rem;
    }
    
    .upload-area i {
        font-size: 2.5rem;
    }
}

/* Animation Utilities */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.animate-fadeIn {
    animation: fadeIn 0.5s ease-out;
}

.animate-slideIn {
    animation: slideIn 0.3s ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Focus States for Accessibility */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0000ff;
        --text-primary: #000000;
        --border-color: #000000;
    }
    
    .tool-card {
        border: 2px solid var(--border-color);
    }
}

/* XML Output Styling */
.xml-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.xml-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.xml-content {
    background: #1e1e1e;
    border-radius: var(--radius-md);
    padding: 1rem;
    overflow-x: auto;
    max-height: 500px;
    border: 1px solid var(--border-color);
}

.xml-content pre {
    margin: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #d4d4d4;
}

.xml-tag {
    color: #569cd6;
}

.xml-attribute {
    color: #9cdcfe;
}

.xml-comment {
    color: #6a9955;
    font-style: italic;
}

.xml-content code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Result Section Styles */
.result-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.result-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.result-actions {
    display: flex;
    gap: 0.75rem;
}

/* XML Options Section */
.xml-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.checkbox-label span {
    user-select: none;
}

/* Status Messages */
.status-message {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.status-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.result-actions .secondary {
    background: var(--text-secondary);
    color: white;
}

.result-actions .secondary:hover {
    background: var(--text-primary);
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
