/* Modern CSS Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

/* CSS Custom Properties (Variables) */
:root {
    /* Modern Color Palette */
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-active: #4338ca;
    --primary-light: #a5b4fc;
    --primary-dark: #3730a3;
    
    --secondary-color: #6b7280;
    --secondary-hover: #4b5563;
    --secondary-light: #d1d5db;
    
    --success-color: #059669;
    --success-hover: #047857;
    --success-light: #a7f3d0;
    
    --error-color: #dc2626;
    --error-hover: #b91c1c;
    --error-light: #fecaca;
    
    --warning-color: #d97706;
    --warning-hover: #b45309;
    --warning-light: #fed7aa;
    
    /* Modern Neutral Colors */
    --background-color: #fafbfc;
    --background-secondary: #f1f5f9;
    --surface-color: #ffffff;
    --surface-hover: #f8fafc;
    --surface-elevated: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.8);
    --surface-dark: #1e293b;
    
    /* Border Colors */
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --border-focus: #6366f1;
    --border-light: #f1f5f9;
    
    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    --text-accent: #6366f1;
    
    /* Spacing Scale */
    --space-xs: 0.25rem;   /* 4px */
    --space-sm: 0.5rem;    /* 8px */
    --space-md: 1rem;      /* 16px */
    --space-lg: 1.5rem;    /* 24px */
    --space-xl: 2rem;      /* 32px */
    --space-2xl: 3rem;     /* 48px */
    --space-3xl: 4rem;     /* 64px */
    
    /* Typography Scale */
    --text-xs: 0.75rem;    /* 12px */
    --text-sm: 0.875rem;   /* 14px */
    --text-base: 1rem;     /* 16px */
    --text-lg: 1.125rem;   /* 18px */
    --text-xl: 1.25rem;    /* 20px */
    --text-2xl: 1.5rem;    /* 24px */
    --text-3xl: 1.875rem;  /* 30px */
    --text-4xl: 2.25rem;   /* 36px */
    
    /* Border Radius */
    --radius-sm: 0.25rem;  /* 4px */
    --radius-md: 0.5rem;   /* 8px */
    --radius-lg: 0.75rem;  /* 12px */
    --radius-xl: 1rem;     /* 16px */
    
    /* Modern Shadows */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
    --shadow-glow: 0 0 0 1px rgb(99 102 241 / 0.05), 0 1px 3px 0 rgb(99 102 241 / 0.1);
    --shadow-colored: 0 10px 15px -3px rgb(99 102 241 / 0.1), 0 4px 6px -4px rgb(99 102 241 / 0.1);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Container Widths */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
}

/* Base Styles */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Modern Background Gradient */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%),
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
    pointer-events: none;
    z-index: -2;
}

/* Animated Background Shapes */
.bg-shapes {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    animation: float 20s ease-in-out infinite;
}

.shape-1 {
    width: 300px;
    height: 300px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
    background: linear-gradient(45deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
}

.shape-2 {
    width: 200px;
    height: 200px;
    top: 60%;
    right: 15%;
    animation-delay: -7s;
    background: linear-gradient(45deg, rgba(236, 72, 153, 0.1), rgba(251, 113, 133, 0.1));
}

.shape-3 {
    width: 150px;
    height: 150px;
    bottom: 20%;
    left: 20%;
    animation-delay: -14s;
    background: linear-gradient(45deg, rgba(34, 197, 94, 0.1), rgba(59, 130, 246, 0.1));
}

.shape-4 {
    width: 250px;
    height: 250px;
    top: 30%;
    right: 40%;
    animation-delay: -3s;
    background: linear-gradient(45deg, rgba(245, 158, 11, 0.1), rgba(239, 68, 68, 0.1));
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.7;
    }
    33% {
        transform: translateY(-30px) rotate(120deg);
        opacity: 0.9;
    }
    66% {
        transform: translateY(20px) rotate(240deg);
        opacity: 0.5;
    }
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: var(--container-lg);
    margin: 0 auto;
    padding: var(--space-md);
}

/* Modern Header Styles */
.app-header {
    text-align: center;
    margin-bottom: var(--space-3xl);
    padding: var(--space-2xl) 0;
    position: relative;
}

.header-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.header-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.logo-icon {
    font-size: 3rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    animation: logo-pulse 3s ease-in-out infinite;
}

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

.app-header h1 {
    font-size: var(--text-3xl);
    font-weight: 700;
    background: linear-gradient(135deg, #1e293b, #475569);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    line-height: 1.2;
}

.app-description {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto var(--space-xl);
    opacity: 0.9;
    font-weight: 400;
}

.header-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-2xl);
    margin-top: var(--space-xl);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all var(--transition-normal);
    min-width: 80px;
}

.stat-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-number {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

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

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

/* Modern Section Styles with Glassmorphism */
section {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}

section:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

section h3 {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
    text-align: center;
}

/* Modern Upload Section */
.upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-xl);
    padding: var(--space-3xl) var(--space-xl);
    text-align: center;
    transition: all var(--transition-normal);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, var(--primary-color) 30%, var(--primary-color) 70%, transparent 70%);
    background-size: 20px 20px;
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.upload-area:hover,
.upload-area:focus {
    border-color: var(--primary-color);
    background: var(--surface-hover);
    outline: none;
    box-shadow: var(--shadow-md);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: var(--text-inverse);
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

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

.upload-area.drag-over .upload-content {
    transform: scale(1.05);
}

.upload-area.drag-over h2,
.upload-area.drag-over p {
    color: var(--text-inverse);
}

.upload-area.drag-over .upload-icon {
    animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
    0%, 20%, 60%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    80% {
        transform: translateY(-5px);
    }
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.upload-icon {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-sm);
}

.upload-area h2 {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--text-primary);
}

.upload-area p {
    color: var(--text-secondary);
    font-size: var(--text-base);
}

/* Button Base Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: var(--text-base);
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
    min-height: 44px; /* Touch target size */
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Primary Button */
.select-file-btn,
.convert-btn,
.download-btn {
    background: var(--primary-color);
    color: var(--text-inverse);
}

.select-file-btn:hover:not(:disabled),
.convert-btn:hover:not(:disabled),
.download-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.select-file-btn:active:not(:disabled),
.convert-btn:active:not(:disabled),
.download-btn:active:not(:disabled) {
    background: var(--primary-active);
    transform: translateY(0);
}

/* Secondary Button */
.reset-btn,
.error-close-btn {
    background: var(--secondary-color);
    color: var(--text-inverse);
}

.reset-btn:hover:not(:disabled),
.error-close-btn:hover:not(:disabled) {
    background: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Loading Spinner */
.loading-spinner {
    animation: spin 1s linear infinite;
}

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

/* Footer */
.app-footer {
    text-align: center;
    padding: var(--space-xl) 0;
    margin-top: var(--space-2xl);
    color: var(--text-muted);
    font-size: var(--text-sm);
    border-top: 1px solid var(--border-color);
}

/* Enhanced Responsive Design */

/* Ultra-wide screens (1400px+) */
@media (min-width: 1400px) {
    .app-container {
        max-width: 1200px;
        padding: var(--space-2xl);
    }
    
    .main-content {
        gap: var(--space-3xl);
    }
    
    .format-options {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-2xl);
    }
    
    .format-option {
        min-height: 120px;
        padding: var(--space-2xl) var(--space-xl);
    }
    
    .file-details {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-xl);
    }
    
    .convert-btn {
        min-width: 280px;
        font-size: var(--text-xl);
    }
}

/* Large Desktop (1200px - 1399px) */
@media (min-width: 1200px) and (max-width: 1399px) {
    .app-container {
        max-width: var(--container-xl);
        padding: var(--space-xl);
    }
    
    .main-content {
        gap: var(--space-2xl);
    }
    
    .format-options {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-xl);
    }
    
    .file-details {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-lg);
    }
    
    .convert-btn {
        min-width: 240px;
    }
}

/* Desktop (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .app-container {
        max-width: var(--container-lg);
        padding: var(--space-lg);
    }
    
    .main-content {
        gap: var(--space-xl);
    }
    
    .format-options {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-lg);
    }
    
    .file-details {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .download-content {
        flex-direction: row;
        gap: var(--space-lg);
    }
    
    .download-content .btn {
        min-width: 180px;
        width: auto;
    }
}

/* Tablet Landscape (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .app-container {
        max-width: var(--container-md);
        padding: var(--space-lg);
    }
    
    .app-header h1 {
        font-size: var(--text-2xl);
    }
    
    .format-options {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-lg);
    }
    
    .format-option {
        min-height: 90px;
    }
    
    .file-details {
        grid-template-columns: 1fr;
    }
    
    .convert-btn {
        min-width: 220px;
        width: 100%;
        max-width: 400px;
    }
    
    .download-content {
        flex-direction: row;
        justify-content: center;
        gap: var(--space-lg);
    }
    
    .download-content .btn {
        min-width: 160px;
        width: auto;
    }
}

/* Tablet Portrait (576px - 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .app-container {
        padding: var(--space-md);
    }
    
    .app-header h1 {
        font-size: var(--text-2xl);
    }
    
    .app-description {
        font-size: var(--text-base);
    }
    
    .header-stats {
        gap: var(--space-lg);
    }
    
    .stat-item {
        min-width: 70px;
        padding: var(--space-sm);
    }
    
    .logo-icon {
        font-size: 2.5rem;
    }
    
    section {
        padding: var(--space-lg);
    }
    
    .upload-area {
        padding: var(--space-xl) var(--space-lg);
    }
    
    .upload-area h2 {
        font-size: var(--text-xl);
    }
    
    .format-options {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .format-option {
        min-height: 80px;
        padding: var(--space-lg);
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: center;
        text-align: left;
    }
    
    .format-option .format-label {
        flex-direction: row;
        gap: var(--space-md);
        align-items: center;
    }
    
    .convert-btn {
        min-width: 200px;
        width: 100%;
        max-width: 300px;
    }
    
    .file-details p {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }
}

/* Mobile Large (480px - 575px) */
@media (min-width: 480px) and (max-width: 575px) {
    .app-container {
        padding: var(--space-sm);
    }
    
    .app-header h1 {
        font-size: var(--text-xl);
    }
    
    .app-description {
        font-size: var(--text-sm);
    }
    
    .header-content {
        padding: var(--space-lg);
    }
    
    .logo-container {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .logo-icon {
        font-size: 2rem;
    }
    
    .header-stats {
        gap: var(--space-md);
        flex-wrap: wrap;
    }
    
    .stat-item {
        min-width: 60px;
        padding: var(--space-sm);
    }
    
    section {
        padding: var(--space-md);
    }
    
    .upload-area {
        padding: var(--space-lg) var(--space-md);
    }
    
    .upload-area h2 {
        font-size: var(--text-lg);
    }
    
    .format-options {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    
    .format-option {
        min-height: 70px;
        padding: var(--space-md);
        display: flex;
        align-items: center;
        justify-content: flex-start;
        text-align: left;
    }
    
    .format-option .format-label {
        flex-direction: row;
        gap: var(--space-sm);
        align-items: center;
    }
    
    .format-option .format-label::before {
        font-size: 1.5rem;
        margin-bottom: 0;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
        font-size: var(--text-base);
    }
    
    .file-details p {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }
    
    .file-preview {
        min-height: 120px;
    }
}

/* Mobile Small (320px - 479px) */
@media (max-width: 479px) {
    .app-container {
        padding: var(--space-xs);
        min-height: 100vh;
    }
    
    .app-header {
        margin-bottom: var(--space-xl);
        padding: var(--space-lg) 0;
    }
    
    .app-header h1 {
        font-size: var(--text-lg);
        line-height: 1.2;
    }
    
    .app-description {
        font-size: var(--text-sm);
    }
    
    section {
        padding: var(--space-sm);
        margin-bottom: var(--space-md);
    }
    
    section h3 {
        font-size: var(--text-lg);
        margin-bottom: var(--space-md);
    }
    
    .upload-area {
        padding: var(--space-md);
        border-width: 1px;
    }
    
    .upload-area h2 {
        font-size: var(--text-base);
    }
    
    .upload-area p {
        font-size: var(--text-sm);
    }
    
    .upload-icon {
        font-size: var(--text-2xl);
    }
    
    .format-options {
        grid-template-columns: 1fr;
        gap: var(--space-xs);
    }
    
    .format-option {
        min-height: 60px;
        padding: var(--space-sm);
        display: flex;
        align-items: center;
        justify-content: flex-start;
        text-align: left;
    }
    
    .format-option .format-label {
        flex-direction: row;
        gap: var(--space-sm);
        align-items: center;
        font-size: var(--text-base);
    }
    
    .format-option .format-label::before {
        font-size: 1.25rem;
        margin-bottom: 0;
    }
    
    .format-label small {
        font-size: var(--text-xs);
        display: none; /* Hide descriptions on very small screens */
    }
    
    .convert-btn {
        min-width: auto;
        width: 100%;
        font-size: var(--text-base);
        padding: var(--space-md) var(--space-lg);
    }
    
    .file-details p {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
        padding: var(--space-xs) 0;
    }
    
    .file-preview {
        min-height: 100px;
        padding: var(--space-md);
    }
    
    .download-content {
        gap: var(--space-sm);
    }
    
    .download-content .btn {
        width: 100%;
        font-size: var(--text-sm);
        padding: var(--space-sm) var(--space-md);
    }
    
    .error-content {
        gap: var(--space-sm);
    }
    
    .error-content p {
        font-size: var(--text-sm);
    }
    
    .status-text {
        font-size: var(--text-sm);
        min-width: auto;
        width: 100%;
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .app-header {
        margin-bottom: var(--space-lg);
        padding: var(--space-md) 0;
    }
    
    .app-header h1 {
        font-size: var(--text-xl);
    }
    
    .main-content {
        gap: var(--space-md);
    }
    
    section {
        padding: var(--space-md);
    }
    
    .upload-area {
        padding: var(--space-lg);
    }
    
    .format-option {
        min-height: 60px;
    }
    
    .format-options {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Container queries for modern browsers */
@supports (container-type: inline-size) {
    .main-content {
        container-type: inline-size;
    }
    
    @container (max-width: 600px) {
        .format-options {
            grid-template-columns: 1fr;
        }
        
        .download-content {
            flex-direction: column;
        }
    }
    
    @container (min-width: 800px) {
        .format-options {
            grid-template-columns: repeat(3, 1fr);
        }
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
    }
}

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

/* File Info Section */
.file-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.file-details {
    display: grid;
    gap: var(--space-sm);
}

.file-details p {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

.file-details p:last-child {
    border-bottom: none;
}

.file-details strong {
    color: var(--text-primary);
    font-weight: 600;
}

.file-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-lg);
    background: var(--background-color);
    border-radius: var(--radius-lg);
    min-height: 120px;
}

.file-preview img {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

/* Format Selection */
.format-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.format-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl) var(--space-lg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--surface-color);
    min-height: 100px;
    overflow: hidden;
    user-select: none;
}

.format-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 0;
}

.format-option::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all var(--transition-normal);
    z-index: 1;
}

.format-option:hover {
    border-color: var(--primary-color);
    background: var(--surface-hover);
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

.format-option:hover::before {
    opacity: 0.08;
}

.format-option:hover::after {
    width: 100px;
    height: 100px;
}

.format-option:active {
    transform: translateY(-2px) scale(1.01);
    box-shadow: var(--shadow-lg);
}

.format-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

.format-option input[type="radio"]:checked + .format-label {
    color: var(--text-inverse);
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

.format-option input[type="radio"]:checked + .format-label small {
    color: rgba(255, 255, 255, 0.9);
}

.format-option input[type="radio"]:checked + .format-label::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: var(--text-base);
    font-weight: bold;
    color: var(--text-inverse);
    background: var(--success-color);
    border: 2px solid var(--text-inverse);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: checkmark-appear 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: var(--shadow-md);
}

@keyframes checkmark-appear {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-180deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.2) rotate(-90deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.format-option:has(input[type="radio"]:checked) {
    border-color: var(--primary-color);
    background: var(--primary-color);
    box-shadow: var(--shadow-xl);
    transform: translateY(-3px) scale(1.03);
}

.format-option:has(input[type="radio"]:checked)::before {
    opacity: 1;
}

.format-option:has(input[type="radio"]:checked)::after {
    width: 120px;
    height: 120px;
    opacity: 0.6;
}

.format-label {
    position: relative;
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    transition: all var(--transition-normal);
    text-align: center;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    line-height: 1.3;
}

.format-label small {
    font-size: var(--text-sm);
    font-weight: 400;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
    line-height: 1.2;
    margin-top: var(--space-xs);
}

/* Format-specific styling with icons */
.format-option[data-format="jpeg"] .format-label::before {
    content: '📸';
    font-size: 2rem;
    margin-bottom: var(--space-xs);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.format-option[data-format="png"] .format-label::before {
    content: '🎨';
    font-size: 2rem;
    margin-bottom: var(--space-xs);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.format-option[data-format="webp"] .format-label::before {
    content: '⚡';
    font-size: 2rem;
    margin-bottom: var(--space-xs);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Enhanced focus styles for accessibility */
.format-option:focus-within {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
    border-color: var(--primary-color);
}

.format-option input[type="radio"]:focus {
    outline: none;
}

.format-option input[type="radio"]:focus + .format-label {
    transform: scale(1.02);
}

/* Disabled state */
.format-option.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(100%);
}

.format-option.disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border-color);
    background: var(--surface-color);
}

/* Pulse animation for selected state */
.format-option:has(input[type="radio"]:checked) {
    animation: selected-pulse 2s ease-in-out infinite;
}

@keyframes selected-pulse {
    0%, 100% {
        box-shadow: var(--shadow-xl);
    }
    50% {
        box-shadow: var(--shadow-xl), 0 0 0 4px rgba(59, 130, 246, 0.15);
    }
}

/* Loading state for format options */
.format-option.loading {
    pointer-events: none;
    opacity: 0.7;
}

.format-option.loading::before {
    opacity: 0.1;
    animation: loading-shimmer 1.5s ease-in-out infinite;
}

@keyframes loading-shimmer {
    0%, 100% {
        opacity: 0.1;
    }
    50% {
        opacity: 0.3;
    }
}

/* Enhanced format selection states */
.format-option.selected {
    animation: none; /* Override the pulse animation when manually selected */
}

/* Convert Section */
.convert-section {
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all var(--transition-normal);
    padding: var(--space-xl) var(--space-lg);
}

.convert-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.convert-btn {
    position: relative;
    min-width: 220px;
    min-height: 56px;
    font-size: var(--text-lg);
    font-weight: 600;
    padding: var(--space-lg) var(--space-2xl);
    transition: all var(--transition-normal);
    border: 2px solid transparent;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.convert-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.convert-btn:hover::before {
    left: 100%;
}

.convert-btn:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
    border-color: var(--border-color);
}

.convert-btn:disabled::before {
    display: none;
}

.convert-btn.enabled {
    background: var(--primary-color);
    opacity: 1;
    animation: button-ready 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.convert-btn.enabled:hover:not(.processing) {
    background: var(--primary-hover);
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-hover);
}

.convert-btn.enabled:active:not(.processing) {
    transform: translateY(0) scale(1);
    box-shadow: var(--shadow-md);
}

@keyframes button-ready {
    0% {
        transform: scale(0.9);
        opacity: 0.7;
        box-shadow: none;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
        box-shadow: var(--shadow-lg);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: var(--shadow-md);
    }
}

.convert-btn.processing {
    background: var(--primary-color);
    cursor: not-allowed;
    pointer-events: none;
    border-color: var(--primary-color);
    animation: processing-pulse 2s ease-in-out infinite;
}

@keyframes processing-pulse {
    0%, 100% {
        box-shadow: var(--shadow-md);
    }
    50% {
        box-shadow: var(--shadow-lg), 0 0 0 4px rgba(59, 130, 246, 0.2);
    }
}

.convert-btn.processing::before {
    display: none;
}

.convert-btn .btn-text {
    transition: all var(--transition-normal);
    position: relative;
    z-index: 2;
}

.convert-btn.processing .btn-text {
    opacity: 0;
    transform: scale(0.8);
}

.convert-btn .loading-spinner {
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: var(--text-xl);
    color: var(--text-inverse);
    z-index: 3;
    animation: spin 1s linear infinite;
}

.convert-btn.processing .loading-spinner {
    display: inline-block;
}

.convert-btn .progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.convert-btn.processing .progress-bar {
    animation: progress-fill 2s ease-in-out;
}

@keyframes progress-fill {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Success state for convert button */
.convert-btn.success {
    background: var(--success-color);
    border-color: var(--success-color);
    animation: success-bounce 0.6s ease-out;
}

@keyframes success-bounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.convert-btn.success .btn-text::after {
    content: ' ✓';
    animation: checkmark-fade-in 0.3s ease-out 0.2s both;
}

@keyframes checkmark-fade-in {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

/* Error state for convert button */
.convert-btn.error {
    background: var(--error-color);
    border-color: var(--error-color);
    animation: error-shake 0.6s ease-out;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

.convert-btn.error .btn-text::after {
    content: ' ✗';
    animation: error-fade-in 0.3s ease-out 0.2s both;
    color: var(--text-inverse);
}

@keyframes error-fade-in {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

/* Convert Status Section */
.convert-status {
    margin-top: var(--space-lg);
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition-normal);
}

.convert-status[style*="block"] {
    opacity: 1;
    transform: translateY(0);
}

.status-text {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-secondary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    background: var(--background-color);
    border: 1px solid var(--border-color);
    display: inline-block;
    min-width: 200px;
    transition: all var(--transition-normal);
}

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

.status-text.status-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error-color);
    color: var(--error-color);
}

/* Status text animations */
.status-text {
    animation: status-fade-in 0.3s ease-out;
}

@keyframes status-fade-in {
    0% { 
        opacity: 0; 
        transform: translateY(10px) scale(0.95); 
    }
    100% { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

/* Download Section */
.download-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    align-items: center;
}

.download-content h3 {
    color: var(--success-color);
    margin-bottom: var(--space-md);
}

.download-content .btn {
    min-width: 180px;
}

/* Error Section */
.error-section {
    background: var(--error-color);
    color: var(--text-inverse);
    border: none;
}

.error-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    align-items: center;
}

.error-content h3 {
    color: var(--text-inverse);
    margin-bottom: var(--space-sm);
}

.error-content p {
    color: var(--text-inverse);
    opacity: 0.9;
    line-height: 1.6;
}

.error-close-btn {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-inverse);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.error-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Focus Styles for Accessibility */
.upload-area:focus,
.format-option:focus-within,
.btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .file-details p {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }
    
    .format-options {
        grid-template-columns: 1fr;
    }
    
    .download-content {
        gap: var(--space-md);
    }
    
    .download-content .btn {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .app-container {
        box-shadow: none;
    }
    
    .upload-area,
    .convert-btn,
    .download-btn,
    .reset-btn {
        display: none;
    }
}