/* ===== CSS Variables & Theme ===== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --bg-card: #16161f;
    --bg-hover: #1e1e2a;
    
    --accent-primary: #ff6b35;
    --accent-secondary: #f7931e;
    --accent-gradient: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    --accent-glow: rgba(255, 107, 53, 0.3);
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-accent: rgba(255, 107, 53, 0.3);
    
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(255, 107, 53, 0.2);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    --font-main: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(255, 107, 53, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 100% 50%, rgba(247, 147, 30, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 0% 80%, rgba(255, 107, 53, 0.06), transparent);
    pointer-events: none;
    z-index: -1;
}

/* ===== App Container ===== */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Navigation ===== */
.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(18, 18, 26, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo-icon {
    width: 40px;
    height: 40px;
}

.nav-tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-tertiary);
    padding: 0.375rem;
    border-radius: var(--radius-lg);
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.nav-tab svg {
    width: 20px;
    height: 20px;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-tab.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

/* ===== Tab Content ===== */
.tab-content {
    display: none;
    flex: 1;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: flex;
}

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

/* ===== PDF Maker Container ===== */
.pdf-maker-container {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.section-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.image-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.section-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Order Section */
.order-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

/* Order List - Scrollable */
.order-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    max-height: 50vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-right: 0.25rem;
}

.order-list::-webkit-scrollbar {
    width: 4px;
}

.order-list::-webkit-scrollbar-track {
    background: transparent;
}

.order-list::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 2px;
}

.order-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    user-select: none;
}

.order-item:hover {
    border-color: var(--border-accent);
}

/* Drag Handle */
.drag-handle {
    width: 24px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: grab;
    flex-shrink: 0;
    touch-action: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle svg {
    width: 16px;
    height: 24px;
}

/* Sortable States */
.sortable-ghost {
    opacity: 0.3;
    background: var(--accent-primary) !important;
}

.sortable-chosen {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    transform: scale(1.02);
    z-index: 100;
}

.sortable-drag {
    opacity: 1 !important;
}

.order-item .order-number {
    width: 32px;
    height: 32px;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.order-item .thumbnail {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

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

.order-item .image-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.order-item .image-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Remove Button */
.remove-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.remove-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
    color: var(--error);
}

.remove-btn svg {
    width: 18px;
    height: 18px;
}

/* Add More Button */
.add-more-btn {
    width: 100%;
    padding: 0.875rem;
    background: transparent;
    border: 2px dashed var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
    font-family: var(--font-main);
    font-size: 0.9rem;
}

.add-more-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.add-more-btn svg {
    width: 20px;
    height: 20px;
}

.btn-outline {
    background: transparent;
    border: 2px dashed var(--border-color);
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-xl);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

.upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.upload-zone:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.upload-zone:hover::before {
    opacity: 0.05;
}

.upload-zone.drag-over {
    border-color: var(--accent-primary);
    background: rgba(255, 107, 53, 0.05);
    transform: scale(1.01);
}

.upload-zone.drag-over::before {
    opacity: 0.1;
}

.upload-content {
    position: relative;
    z-index: 1;
}

.upload-icon {
    margin-bottom: 1.5rem;
}

.upload-icon svg {
    width: 80px;
    height: 80px;
}

.upload-zone h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.upload-zone p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.supported-formats {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

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

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.preview-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-accent);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .preview-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition-normal);
    display: flex;
    align-items: flex-end;
    padding: 1rem;
}

.preview-item:hover .preview-overlay {
    opacity: 1;
}

.preview-item .preview-number {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: 28px;
    height: 28px;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn svg {
    width: 20px;
    height: 20px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 107, 53, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-accent);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1rem;
    width: 100%;
}

/* ===== Compress Container ===== */
.compress-container {
    flex: 1;
    max-width: 600px;
    margin: 0 auto;
    padding: 3rem 2rem;
    width: 100%;
}

.compress-options {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: slideUp 0.4s ease;
}

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

/* Image Preview Container */
.image-preview-container {
    width: 100%;
    max-height: 250px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-container img {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
}

/* File Info */
.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

/* Compress Info Box */
.compress-info-box {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.2);
    border-radius: var(--radius-md);
}

.compress-info-box svg {
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.compress-info-box p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.file-info svg {
    width: 40px;
    height: 40px;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.file-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

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

/* Size Selector */
.size-selector {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.size-selector label {
    font-weight: 500;
    color: var(--text-primary);
}

.size-input-group {
    display: flex;
    gap: 0.5rem;
}

.size-input-group input {
    flex: 1;
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.size-input-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

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

.size-input-group select {
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.size-input-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Quality Slider */
.quality-slider {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quality-slider label {
    font-weight: 500;
    color: var(--text-primary);
}

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

.slider-container input[type="range"] {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-gradient);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast);
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.quality-value {
    min-width: 50px;
    text-align: right;
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--accent-primary);
}

.quality-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 3rem;
    text-align: center;
    max-width: 450px;
    width: 100%;
    border: 1px solid var(--border-color);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.success-icon {
    margin-bottom: 1.5rem;
}

.success-icon svg {
    width: 80px;
    height: 80px;
}

.modal-content h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
}

.modal-actions .btn {
    flex: 1;
}

/* Filename Modal */
.filename-modal-content {
    max-width: 400px;
}

.filename-modal-content h2 {
    margin-bottom: 1.5rem;
}

.filename-input-group {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: border-color var(--transition-fast);
}

.filename-input-group:focus-within {
    border-color: var(--accent-primary);
}

.filename-input-group input {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    outline: none;
}

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

.file-extension {
    padding: 1rem;
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    border-left: 1px solid var(--border-color);
}

#file-extension-select {
    padding: 1rem;
    background: var(--bg-hover);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    border: none;
    border-left: 1px solid var(--border-color);
    cursor: pointer;
    outline: none;
}

#file-extension-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.5rem;
}


/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

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

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.loader-ring {
    width: 60px;
    height: 60px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#loading-text {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .nav-bar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-tabs {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* ===== Mobile Optimizations ===== */
@media (max-width: 640px) {
    html {
        font-size: 14px;
    }
    
    .nav-bar {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .logo {
        font-size: 1.1rem;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
    }
    
    .nav-tabs {
        padding: 0.25rem;
        gap: 0.25rem;
        border-radius: var(--radius-md);
        width: 100%;
    }
    
    .nav-tab {
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
        border-radius: var(--radius-sm);
        flex: 1;
        justify-content: center;
        gap: 0.35rem;
    }
    
    .nav-tab svg {
        width: 18px;
        height: 18px;
    }
    
    /* PDF Maker Container - Mobile */
    .pdf-maker-container {
        padding: 1rem;
        gap: 1rem;
    }
    
    /* Upload Zone - Mobile Optimized */
    .upload-zone {
        padding: 2rem 1.5rem;
        border-radius: var(--radius-lg);
        min-height: 180px;
    }
    
    /* PDF Maker Mobile */
    .pdf-maker-container {
        padding: 1rem;
    }
    
    .upload-icon svg {
        width: 50px;
        height: 50px;
    }
    
    .upload-zone h2 {
        font-size: 1.1rem;
        margin-bottom: 0.25rem;
    }
    
    .upload-zone p {
        font-size: 0.85rem;
    }
    
    .supported-formats {
        font-size: 0.7rem;
    }
    
    /* Order Section - Mobile */
    .order-section {
        padding: 1rem;
    }
    
    .section-header h3 {
        font-size: 1rem;
    }
    
    .section-hint {
        font-size: 0.8rem;
    }
    
    /* Order Items - Mobile */
    .order-item {
        padding: 0.625rem 0.5rem;
        gap: 0.5rem;
    }
    
    .drag-handle {
        width: 28px;
        height: 40px;
    }
    
    .drag-handle svg {
        width: 18px;
        height: 28px;
    }
    
    .order-item .order-number {
        width: 26px;
        height: 26px;
        font-size: 0.8rem;
    }
    
    .order-item .thumbnail {
        width: 44px;
        height: 44px;
    }
    
    .order-item .image-name {
        font-size: 0.75rem;
    }
    
    .remove-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
    
    .remove-btn svg {
        width: 18px;
        height: 18px;
    }
    
    /* Action Bar - Fixed at bottom */
    .action-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        flex-direction: row;
        padding: 1rem;
        gap: 0.75rem;
        background: var(--bg-secondary);
        border-top: 1px solid var(--border-color);
        z-index: 100;
        margin: 0;
        border-radius: 0;
    }
    
    .action-bar .btn {
        flex: 1;
        padding: 0.875rem;
        font-size: 0.9rem;
    }
    
    /* Add padding to container when action bar is visible */
    .pdf-maker-container:has(#pdf-actions[style*="flex"]) {
        padding-bottom: 80px;
    }
    
    /* Buttons - Larger Touch Targets */
    .btn {
        padding: 0.875rem 1.25rem;
        font-size: 0.95rem;
        min-height: 48px;
        touch-action: manipulation;
    }
    
    .btn svg {
        width: 20px;
        height: 20px;
    }
    
    .btn-large {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 52px;
    }
    
    /* Compress Container */
    .compress-container {
        padding: 1rem;
    }
    
    .compress-options {
        padding: 1.25rem;
        gap: 1.25rem;
        margin-top: 1rem;
    }
    
    .image-preview-container {
        max-height: 180px;
    }
    
    /* File Info */
    .file-info {
        padding: 0.875rem;
        gap: 0.75rem;
    }
    
    .file-info svg {
        width: 32px;
        height: 32px;
    }
    
    .file-name {
        font-size: 0.9rem;
    }
    
    .file-size {
        font-size: 0.8rem;
    }
    
    /* Size Selector */
    .size-selector label {
        font-size: 0.95rem;
    }
    
    .size-input-group {
        gap: 0.5rem;
    }
    
    .size-input-group input,
    .size-input-group select {
        padding: 0.875rem;
        font-size: 1rem;
        min-height: 48px;
    }
    
    /* Quality Slider */
    .quality-slider label {
        font-size: 0.95rem;
    }
    
    .slider-container {
        gap: 0.75rem;
    }
    
    .slider-container input[type="range"] {
        height: 8px;
    }
    
    .slider-container input[type="range"]::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }
    
    .quality-value {
        font-size: 1rem;
        min-width: 50px;
    }
    
    .quality-labels {
        font-size: 0.7rem;
        margin-top: 0.25rem;
    }
    
    /* Modal */
    .modal {
        padding: 1rem;
    }
    
    .modal-content {
        padding: 1.75rem 1.25rem;
        border-radius: var(--radius-lg);
    }
    
    .success-icon svg {
        width: 60px;
        height: 60px;
    }
    
    .modal-content h2 {
        font-size: 1.2rem;
    }
    
    .modal-content p {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .modal-actions .btn {
        width: 100%;
    }
    
    /* Loading */
    .loader-ring {
        width: 50px;
        height: 50px;
    }
    
    #loading-text {
        font-size: 0.95rem;
    }
}

/* ===== Extra Small Screens (< 360px) ===== */
@media (max-width: 360px) {
    html {
        font-size: 13px;
    }
    
    .nav-tab svg {
        width: 20px;
        height: 20px;
    }
    
    .upload-zone {
        padding: 2rem 1rem;
    }
    
    .upload-icon svg {
        width: 50px;
        height: 50px;
    }
    
    .preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== Touch Optimizations ===== */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .upload-zone:hover {
        transform: none;
    }
    
    .btn-primary:hover {
        transform: none;
    }
    
    .preview-item:hover {
        transform: none;
    }
    
    /* Always show overlay on mobile */
    .preview-item .preview-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 40%);
    }
    
    /* Active states for touch feedback */
    .btn:active {
        transform: scale(0.97);
        opacity: 0.9;
    }
    
    .upload-zone:active {
        transform: scale(0.99);
        border-color: var(--accent-primary);
    }
    
    .image-list-item:active {
        background: var(--bg-hover);
    }
    
    .nav-tab:active {
        transform: scale(0.97);
    }
}

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

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

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

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

/* ===== Selection ===== */
::selection {
    background: rgba(255, 107, 53, 0.3);
    color: var(--text-primary);
}

/* ===== Safe Area for Notch Phones ===== */
@supports (padding: max(0px)) {
    .nav-bar {
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .action-bar {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    .modal {
        padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    }
}

/* ===== Touch Device Specific ===== */
.touch-device .upload-zone {
    cursor: default;
}

.touch-device .btn {
    cursor: default;
}

.touch-device .drag-handle {
    cursor: default;
}

.touch-device .remove-btn {
    cursor: default;
}
