/* CSS Variables */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #a855f7;
    --bg-dark: #0f0f1a;
    --bg-card: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --border: rgba(255, 255, 255, 0.1);
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Gradient */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(168, 85, 247, 0.15) 0%, transparent 70%);
    z-index: -1;
    animation: gradientShift 15s ease-in-out infinite alternate;
}

@keyframes gradientShift {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

/* Glassmorphism */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 1rem 0;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.logo svg {
    color: var(--primary);
}

.logo {
    text-decoration: none;
    cursor: pointer;
}

.nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Desktop Navigation */
.nav-desktop {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.15);
}

/* Mobile Navigation */
.nav-mobile {
    display: none;
    position: relative;
}

.nav-menu-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-mobile-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 220px;
    padding: 0.75rem 0;
    border-radius: 1rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
    z-index: 200;
    background: rgba(30, 30, 50, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.nav-mobile-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(8px);
}

.nav-mobile-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    color: #ffffff;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 1rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-mobile-menu a:last-child {
    border-bottom: none;
}

.nav-mobile-menu a:hover,
.nav-mobile-menu a:active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

/* Main */
.main {
    padding-top: 80px;
}

/* Hero */
.hero {
    text-align: center;
    padding: 4rem 0 3rem;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Features Grid */
.features {
    padding: 2rem 0 4rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    padding: 2rem;
    border-radius: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    opacity: 0;
    transition: opacity 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

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

.feature-icon {
    width: 64px;
    height: 64px;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: white;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Tool Section */
.tool-section {
    padding: 2rem 0;
}

.tool-panel {
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s;
}

.back-btn:hover {
    background: var(--glass-bg);
    color: var(--text-primary);
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 1rem;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-content svg {
    color: var(--text-muted);
}

.upload-content p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.upload-content span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.upload-hint {
    font-size: 0.85rem !important;
    color: var(--text-muted) !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* File List */
.file-list {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--glass-bg);
    border-radius: 0.75rem;
    border: 1px solid var(--glass-border);
    cursor: grab;
    transition: all 0.3s;
}

.file-item:active {
    cursor: grabbing;
}

.file-item.dragging {
    opacity: 0.5;
    transform: scale(1.02);
}

.file-item.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.file-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

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

.file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}

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

.file-actions {
    display: flex;
    gap: 0.5rem;
}

.file-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.file-action-btn:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

.drag-handle {
    color: var(--text-muted);
    cursor: grab;
}

/* Image List */
.image-list .file-item {
    flex-wrap: wrap;
}

.image-preview {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 0.5rem;
}

/* Action Bar */
.action-bar {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Options */
.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.radio-label {
    color: var(--text-primary);
}

.input-field {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input-field::placeholder {
    color: var(--text-muted);
}

.range-input {
    margin-top: 1rem;
}

.range-input label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* PDF Info */
.pdf-info {
    padding: 1rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pdf-info-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.pdf-info-details h4 {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.pdf-info-details p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Compression Levels */
.compression-levels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.level-option {
    cursor: pointer;
}

.level-option input {
    display: none;
}

.level-card {
    padding: 1.25rem;
    border-radius: 1rem;
    text-align: center;
    transition: all 0.3s;
    position: relative;
}

.level-option input:checked + .level-card {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
}

.level-name {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.level-desc {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.level-badge {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Quality Options */
.quality-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

/* Page Grid (Organize) */
.organize-workspace {
    margin-top: 1.5rem;
}

.organize-toolbar {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    border-radius: 0.75rem;
}

.toolbar-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.page-item {
    position: relative;
    aspect-ratio: 3/4;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: all 0.3s;
    overflow: hidden;
}

.page-item:hover {
    border-color: var(--primary);
}

.page-item.dragging {
    opacity: 0.5;
    transform: scale(1.05);
}

.page-item.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.2);
}

.page-item.deleted {
    opacity: 0.3;
    border-color: var(--error);
}

.page-number {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.page-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.page-rotation {
    font-size: 0.7rem;
    color: var(--primary);
    margin-top: 0.25rem;
}

.page-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.page-item:hover .page-actions {
    opacity: 1;
}

.page-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 0.375rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.page-action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.page-action-btn.delete:hover {
    background: var(--error);
    border-color: var(--error);
}

/* Result Section */
.result-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 1rem;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.result-header svg {
    color: var(--success);
}

.result-header h3 {
    font-weight: 600;
    color: var(--success);
}

.result-files {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.result-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--glass-bg);
    border-radius: 0.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.result-file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    flex: 1;
}

.result-file-details {
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.result-file-details h4 {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-file-details p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

/* Timer */
.expiry-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 0.75rem;
    margin-top: 1rem;
    color: var(--warning);
    font-size: 0.9rem;
}

.expiry-timer svg {
    flex-shrink: 0;
}

/* Compression Stats */
.compression-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--glass-bg);
    border-radius: 0.75rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.stat-item.highlight .stat-value {
    color: var(--success);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 26, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    padding: 3rem;
    border-radius: 1.5rem;
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1001;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

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

.toast.success {
    background: rgba(16, 185, 129, 0.9);
    color: white;
}

.toast.error {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.toast.warning {
    background: rgba(245, 158, 11, 0.9);
    color: white;
}

/* Footer */
.footer {
    margin-top: 4rem;
    padding: 2rem 0;
    text-align: center;
}

.footer p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    color: var(--success) !important;
}

/* Responsive */
@media (max-width: 900px) {
    .nav-desktop {
        display: none;
    }
    
    .nav-mobile {
        display: block;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .header .container {
        flex-wrap: nowrap;
        gap: 0.5rem;
    }
    
    .nav {
        width: auto;
        justify-content: flex-end;
    }
    
    .hero {
        padding: 2rem 0 1.5rem;
    }
    
    .hero h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .feature-card {
        padding: 1rem;
    }
    
    .feature-card h3 {
        font-size: 0.95rem;
    }
    
    .feature-card p {
        font-size: 0.8rem;
        display: none;
    }
    
    .feature-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 0.5rem;
    }
    
    .feature-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .tool-panel {
        padding: 1rem;
        border-radius: 1rem;
        margin: 0 -0.5rem;
    }
    
    .panel-header {
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .upload-zone {
        padding: 1.5rem 1rem;
    }
    
    .upload-zone p {
        font-size: 0.9rem;
    }
    
    .upload-hint {
        font-size: 0.75rem;
    }
    
    .compression-levels {
        grid-template-columns: 1fr;
    }
    
    .compression-stats {
        grid-template-columns: 1fr;
    }
    
    .page-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .merge-page-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 0.5rem;
    }
    
    .merge-preview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .result-file {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .result-file-info {
        width: 100%;
    }
    
    .result-actions {
        width: 100%;
        flex-direction: row;
    }
    
    .result-actions .btn {
        flex: 1;
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .toast-container {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
    }
    
    .toast {
        max-width: 100%;
        padding: 0.75rem 1rem;
    }
    
    .action-bar {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .action-bar .btn {
        width: 100%;
    }
    
    /* Organize toolbar mobile */
    .organize-toolbar {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .toolbar-hint {
        font-size: 0.8rem;
        text-align: center;
    }
    
    /* Level cards mobile */
    .level-card {
        padding: 1rem;
    }
    
    .level-name {
        font-size: 1rem;
    }
    
    .level-desc {
        font-size: 0.8rem;
    }
    
    /* Split options mobile */
    .split-mode-options {
        flex-direction: column;
    }
    
    .range-input-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .range-input-group input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .logo span {
        font-size: 1rem;
    }
    
    .logo svg {
        width: 32px;
        height: 32px;
    }
    
    .file-item {
        flex-wrap: wrap;
        padding: 0.75rem;
    }
    
    .file-info {
        width: calc(100% - 56px);
    }
    
    .file-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }
    
    .drag-handle {
        display: none;
    }
    
    /* Compress mode toggle mobile */
    .compress-mode-toggle {
        flex-direction: column;
    }
    
    .target-size-row {
        flex-direction: column;
    }
    
    .target-size-row input,
    .target-size-row select {
        width: 100%;
    }
    
    /* Page grid mobile */
    .page-grid,
    .merge-page-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .page-item-actions {
        top: 0.25rem;
        right: 0.25rem;
        gap: 0.25rem;
    }
    
    .page-action-btn {
        width: 28px;
        height: 28px;
    }
    
    /* Split page preview mobile */
    .page-preview-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    /* Panel header mobile */
    .panel-header {
        gap: 0.5rem;
    }
    
    .panel-header h2 {
        font-size: 1.25rem;
    }
    
    .back-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    /* About page mobile */
    .about-content {
        padding: 0 0.5rem;
    }
    
    .about-section {
        padding: 1rem;
    }
    
    /* Quality/Paper options mobile */
    .quality-options,
    .paper-size-options,
    .orientation-options {
        flex-direction: column;
    }
    
    /* JPG to PDF options */
    .jpg-to-pdf-options h4 {
        font-size: 1rem;
    }
    
    /* File item mobile fix */
    .file-list {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .file-item {
        display: flex !important;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .drag-handle {
        display: none !important;
    }
    
    .file-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
        flex-shrink: 0;
    }
    
    .file-icon svg {
        width: 16px;
        height: 16px;
    }
    
    .file-info {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }
    
    .file-name {
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
        width: 100%;
    }
    
    .file-size {
        font-size: 0.7rem;
    }
    
    .file-actions {
        flex-shrink: 0;
        margin-left: auto;
    }
    
    .file-action-btn {
        width: 28px;
        height: 28px;
    }
    
    /* Result file mobile fix */
    .result-file {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .result-file-info {
        width: 100%;
        overflow: hidden;
    }
    
    .result-file-info .file-icon {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }
    
    .result-file-details {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }
    
    .result-file-details h4 {
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        word-break: break-all;
    }
    
    .result-file-details p {
        font-size: 0.75rem;
    }
    
    .result-actions {
        width: 100%;
    }
    
    .result-actions .btn {
        flex: 1;
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
    }
    
    /* PDF info mobile */
    .pdf-info {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .pdf-info-details h4 {
        font-size: 0.85rem;
        word-break: break-all;
    }
    
    .pdf-info-details p {
        font-size: 0.75rem;
    }
    
    /* Compress mode toggle mobile - keep grid */
    .compress-mode-toggle {
        grid-template-columns: 1fr 1fr;
    }
    
    .compress-mode-toggle .radio-option .radio-label {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
    
    /* Features grid mobile */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection */
::selection {
    background: var(--primary);
    color: white;
}

/* Page Preview Grid */
.page-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin: 1rem 0 1.5rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

.page-preview-item {
    position: relative;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    aspect-ratio: 3/4;
}

.page-preview-item:hover {
    border-color: var(--primary);
    transform: scale(1.02);
}

.page-preview-item.selected {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}

.page-preview-item canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.page-preview-number {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 1.5rem 0.5rem 0.5rem;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.page-preview-check {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    background: var(--success);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}

.page-preview-item.selected .page-preview-check {
    display: flex;
}

.hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
}

.selected-pages-info {
    padding: 0.75rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 0.5rem;
    color: var(--success);
    margin-top: 1rem;
}

/* Organize Toolbar */
.organize-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    border-radius: 0.75rem;
}

.toolbar-actions {
    display: flex;
    gap: 0.5rem;
}

/* Compress Mode Toggle */
.compress-mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: rgba(30, 30, 50, 0.8);
    padding: 0.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--glass-border);
}

.compress-mode-toggle .radio-option {
    margin: 0;
}

.compress-mode-toggle .radio-option input {
    display: none;
}

.compress-mode-toggle .radio-option .radio-label {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s;
    background: transparent;
    white-space: nowrap;
}

.compress-mode-toggle .radio-option input:checked + .radio-label {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.compress-mode-toggle .radio-option .radio-label:hover {
    color: white;
}

/* Target Size Input */
.target-size-input {
    background: rgba(30, 30, 50, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
}

.target-size-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.target-size-row input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    background: rgba(20, 20, 40, 0.8);
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
}

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

.target-size-row input::placeholder {
    color: var(--text-muted);
}

.target-size-row select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    background: rgba(20, 20, 40, 0.8);
    color: #ffffff;
    font-size: 1rem;
    cursor: pointer;
    min-width: 120px;
}

.target-size-row select option {
    background: #1e1e32;
    color: #ffffff;
}

.target-size-hint {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.target-size-warning {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #f59e0b;
}

/* Merge Preview Section */
.merge-preview-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--glass-bg);
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
}

.merge-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.merge-preview-header h4 {
    margin: 0;
}

.merge-page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.merge-page-item {
    position: relative;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: grab;
    transition: all 0.3s;
    aspect-ratio: 3/4;
}

.merge-page-item:hover {
    border-color: var(--primary);
}

.merge-page-item.dragging {
    opacity: 0.5;
    border-color: var(--primary);
}

.merge-page-item.drag-over {
    border-color: var(--secondary);
    transform: scale(1.02);
}

.merge-page-item canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.merge-page-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    padding: 1.5rem 0.5rem 0.5rem;
    text-align: center;
}

.merge-page-item-number {
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.merge-page-item-source {
    font-size: 0.6rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Page Grid Dropzone */
.page-grid-dropzone {
    position: relative;
    min-height: 200px;
}

.dropzone-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(99, 102, 241, 0.9);
    border: 3px dashed var(--primary);
    border-radius: 1rem;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: white;
    z-index: 10;
}

.page-grid-dropzone.drag-over .dropzone-overlay {
    display: flex;
}

/* Page Grid with Preview */
.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.page-item {
    position: relative;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 0.75rem;
    overflow: hidden;
    cursor: grab;
    transition: all 0.3s;
    aspect-ratio: 3/4;
}

.page-item canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.page-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    padding: 2rem 0.5rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.page-item-number {
    font-size: 0.9rem;
    font-weight: 600;
}

.page-item-rotation {
    font-size: 0.7rem;
    color: var(--primary);
}

.page-item-source {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Page Action Buttons - Always Visible */
.page-item-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.35rem;
    z-index: 5;
}

.page-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: white;
}

.page-action-btn.rotate {
    background: rgba(99, 102, 241, 0.9);
}

.page-action-btn.rotate:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.page-action-btn.delete {
    background: rgba(239, 68, 68, 0.9);
}

.page-action-btn.delete:hover {
    background: #ef4444;
    transform: scale(1.1);
}

.page-item.deleted .page-action-btn.delete {
    background: rgba(34, 197, 94, 0.9);
}

.page-item.deleted .page-action-btn.delete:hover {
    background: #22c55e;
}

/* About Page */
.about-content {
    max-width: 700px;
    margin: 0 auto;
}

.about-hero {
    text-align: center;
    padding: 2rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.about-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: white;
}

.about-hero h3 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.about-role {
    color: var(--text-secondary);
}

.about-section {
    margin-bottom: 2rem;
}

.about-section h4 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.about-section p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.about-features {
    list-style: none;
}

.about-features li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.about-features li:last-child {
    border-bottom: none;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-badge {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.about-footer {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}

.about-footer p {
    margin: 0.25rem 0;
}
