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

:root {
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --success-600: #16a34a;
    --success-700: #15803d;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    background: var(--gray-50);
    color: #111827;
    line-height: 1.6;
    min-height: 100vh;
}

.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60vh;
    background: var(--gradient);
    z-index: -1;
    opacity: 0.05;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.header {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
}

.brand {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.logo {
    width: 64px;
    height: 64px;
    background: var(--gradient);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.logo:hover {
    transform: translateY(-2px) scale(1.05);
}

.brand-text h1 {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--gray-600);
    font-size: 1rem;
    font-weight: 500;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
}

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

.upload-container {
    background: white;
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.upload-container:hover {
    border-color: var(--primary-600);
    background: #eff6ff;
    transform: translateY(-2px);
}

.upload-container.drag-over {
    border-color: var(--primary-600);
    background: #dbeafe;
    box-shadow: var(--shadow-lg);
}

#imageInput {
    display: none;
}

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

.upload-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.upload-icon .material-symbols-rounded {
    font-size: 3rem;
    color: white;
}

.upload-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: var(--primary-600);
    color: white;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.upload-button:hover {
    background: var(--primary-700);
    transform: translateY(-2px);
}

.upload-hint {
    color: var(--gray-600);
    font-size: 0.95rem;
    margin: 0;
}

.upload-formats {
    color: var(--gray-400);
    font-size: 0.875rem;
    margin: 0;
}

.file-info {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

.info-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--primary-600);
}

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

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
}

.conversion-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

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

.option-card {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.option-card:hover {
    background: white;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.option-card label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    background: white;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
}

.select-wrapper select:focus {
    outline: none;
    border-color: var(--primary-600);
    box-shadow: 0 0 0 3px #dbeafe;
}

.select-wrapper .material-symbols-rounded {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.range-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 999px;
    outline: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary-600);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--primary-600);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    border: none;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--gray-600);
}

.quality-badge {
    background: var(--primary-600);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.875rem;
}

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

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gray-300);
    border-radius: 999px;
    transition: var(--transition);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary-600);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.resize-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group .material-symbols-rounded {
    position: absolute;
    left: 0.75rem;
    color: var(--gray-400);
}

.input-group input[type="number"] {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.75rem;
    border: 2px solid var(--gray-200);
    border-radius: 0.5rem;
    transition: var(--transition);
}

.input-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-600);
    box-shadow: 0 0 0 3px #dbeafe;
}

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

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-600);
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    flex: 1;
    min-width: 160px;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-600);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-700);
    transform: translateY(-2px);
}

.btn-primary:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--success-600);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
    background: var(--success-700);
    transform: translateY(-2px);
}

.btn-outline {
    background: white;
    color: #111827;
    border-color: var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-50);
    transform: translateY(-2px);
}

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

.preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.preview-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.preview-card:hover {
    transform: translateY(-4px);
}

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

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 700;
}

.file-badge {
    background: var(--gray-100);
    color: var(--gray-700);
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.file-badge.success {
    background: #dcfce7;
    color: #15803d;
}

.image-container {
    position: relative;
    min-height: 300px;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.image-container img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 0.5rem;
    object-fit: contain;
    transition: var(--transition);
}

.loading-spinner {
    position: absolute;
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-radius: 50%;
    border-top-color: var(--primary-600);
    animation: spin 1s linear infinite;
    display: none;
}

.image-container.loading .loading-spinner {
    display: block;
}

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

.success-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(34, 197, 94, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: white;
}

.success-overlay .material-symbols-rounded {
    font-size: 4rem;
}

.footer {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    margin-top: 3rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
}

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

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

.footer-logo {
    width: 48px;
    height: 48px;
    background: var(--gradient);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.footer-title {
    font-weight: 700;
    font-size: 1.125rem;
}

.footer-tagline {
    color: var(--gray-600);
    font-size: 0.875rem;
    font-style: italic;
}

.footer-features {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600);
    font-size: 0.875rem;
}

.copyright {
    color: var(--gray-400);
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header {
        padding: 1.5rem;
    }
    
    .brand {
        flex-direction: column;
        text-align: center;
    }
    
    .stats-bar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .conversion-options {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .preview {
        grid-template-columns: 1fr;
    }
}
