:root {
    --primary-color: #007AFF;
    --secondary-color: #5856D6;
    --success-color: #34C759;
    --warning-color: #FF9500;
    --error-color: #FF3B30;
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F5F5F7;
    --border-color: #E5E5E7;
    --shadow-light: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 8px 32px rgba(0, 0, 0, 0.12);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

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

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: var(--transition);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 32px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 400;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

/* Main Content */
.main {
    min-height: calc(100vh - 70px);
    padding: 40px 0;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 60px;
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Instructions */
.instructions {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 32px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-light);
}

.instructions-content h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.instructions-content ol {
    list-style: none;
    counter-reset: step-counter;
}

.instructions-content li {
    counter-increment: step-counter;
    margin-bottom: 12px;
    padding-left: 40px;
    position: relative;
    font-size: 16px;
    color: var(--text-secondary);
}

.instructions-content li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

/* Upload Section */
.upload-section {
    margin-bottom: 40px;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 60px 40px;
    text-align: center;
    background: var(--bg-secondary);
    transition: var(--transition);
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(0, 122, 255, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(0, 122, 255, 0.1);
    transform: scale(1.02);
}

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

.upload-icon {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.upload-content h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.upload-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.upload-btn:hover {
    background: #0056CC;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* Controls Section */
.controls-section {
    margin-bottom: 40px;
}

.controls {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--shadow-light);
}

.slider-container {
    margin-bottom: 24px;
}

.slider-container label {
    display: block;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.quality-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
}

.quality-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.quality-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-light);
}

.bulk-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: #0056CC;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

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

.btn-secondary:hover {
    background: #28A745;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* Images Section */
.images-section {
    margin-bottom: 40px;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.image-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
}

.image-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

.image-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.image-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    truncate: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    flex: 1;
}

.image-size {
    font-size: 12px;
    color: var(--text-secondary);
}

.image-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.preview-item {
    text-align: center;
}

.preview-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.preview-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.compression-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
}

.size-info {
    display: flex;
    flex-direction: column;
}

.size-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.size-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.savings {
    color: var(--success-color);
    font-weight: 600;
    font-size: 14px;
}

.image-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    margin-right: 8px;
}

.btn-small:last-child {
    margin-right: 0;
}

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

.btn-download:hover {
    background: #28A745;
}

.btn-remove {
    background: var(--error-color);
    color: white;
    padding: 8px 12px;
}

.btn-remove:hover {
    background: #DC3545;
}

.btn-download:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-primary);
    margin: 5% auto;
    padding: 0;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-medium);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.modal-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 32px;
}

.modal-body h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.modal-body h4 {
    font-size: 16px;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal-body p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.contact-content {
    text-align: center;
}

.contact-info {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--border-radius);
    margin: 24px 0;
}

.contact-info i {
    font-size: 24px;
    color: var(--primary-color);
}

.contact-info h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.contact-info p {
    margin: 0;
    color: var(--text-secondary);
}

.contact-note {
    font-style: italic;
    color: var(--text-secondary);
    margin-top: 20px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-content {
    text-align: center;
}

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

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

.loading-content p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 18px;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .upload-content h3 {
        font-size: 20px;
    }
    
    .instructions {
        padding: 24px;
    }
    
    .controls {
        padding: 24px;
    }
    
    .bulk-actions {
        flex-direction: column;
    }
    
    .images-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .nav {
        gap: 20px;
    }
    
    .image-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .hero-title {
        font-size: 28px;
    }
    
    .upload-content h3 {
        font-size: 18px;
    }
    
    .image-preview {
        grid-template-columns: 1fr;
    }
    
    .compression-info {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}
