/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

html, body {
    width: 100%;
    overflow-x: hidden;
    position: relative;
}

:root {
    /* Light mode colors - updated with more modern palette */
    --primary: #6366f1;
    /* Indigo 500 - slightly more vibrant */
    --primary-hover: #4f46e5;
    /* Indigo 600 */
    --secondary: #10b981;
    /* Emerald 500 */
    --light-bg: #f8fafc;
    /* Slate 50 */
    --dark-text: #1e293b;
    /* Slate 800 */
    --mid-text: #475569;
    /* Slate 600 */
    --light-text: #94a3b8;
    /* Slate 400 */
    --border-color: #e2e8f0;
    /* Slate 200 */
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    --card-bg: #ffffff;
    --body-bg: #f9fafb;
    --header-bg: rgba(255, 255, 255, 0.98);
    --footer-bg: linear-gradient(to right, #f8fafc, #f1f5f9);
    --slider-bg: #e2e8f0;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --badge-bg: rgba(99, 102, 241, 0.1);
    /* Updated to match new primary */
    --badge-text: var(--primary);
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --feature-card-bg: #ffffff;
    --feature-icon-bg: rgba(99, 102, 241, 0.1);
    /* Updated to match new primary */
    --newsletter-input-bg: #ffffff;
    --toggle-bg: #e2e8f0;
    --toggle-circle: #ffffff;
    --error-color: #ef4444;
    /* Red 500 for error messages */
}

[data-theme="dark"] {
    /* Dark mode colors - enhanced for better contrast and vibrance */
    --primary: #818cf8;
    /* Indigo 400 - brighter in dark mode */
    --primary-hover: #a5b4fc;
    /* Indigo 300 */
    --secondary: #34d399;
    /* Emerald 400 */
    --light-bg: #1f2937;
    /* Gray 800 */
    --dark-text: #f1f5f9;
    /* Slate 100 */
    --mid-text: #e2e8f0;
    /* Slate 200 - improved readability */
    --light-text: #cbd5e1;
    /* Slate 300 - improved readability */
    --border-color: #374151;
    /* Gray 700 */
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --card-bg: #1e293b;
    /* Slate 800 */
    --body-bg: #111827;
    /* Gray 900 */
    --header-bg: rgba(17, 24, 39, 0.98);
    --footer-bg: linear-gradient(to right, #111827, #1f2937);
    --slider-bg: #374151;
    --badge-bg: rgba(129, 140, 248, 0.2);
    /* Updated to match new primary */
    --badge-text: #a5b4fc;
    /* Indigo 300 */
    --input-bg: #1f2937;
    --input-border: #374151;
    --feature-card-bg: #1e293b;
    --feature-icon-bg: rgba(129, 140, 248, 0.2);
    /* Updated to match new primary */
    --newsletter-input-bg: #1f2937;
    --toggle-bg: #4b5563;
    --toggle-circle: #818cf8;
    /* Updated to match new primary */
    --error-color: #f87171;
    /* Red 400 for error messages in dark mode - more visible */
}

/* Theme transition class */
.theme-transition {
    transition: background-color 0.5s ease,
        color 0.5s ease,
        border-color 0.5s ease,
        box-shadow 0.5s ease;
}

.theme-transition * {
    transition: background-color 0.5s ease,
        color 0.5s ease,
        border-color 0.5s ease,
        box-shadow 0.5s ease;
}

body {
    background-color: var(--body-bg);
    color: var(--dark-text);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden; /* Prevent horizontal scrolling on mobile */
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Improve responsiveness for large screens */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero h1 {
        font-size: 4rem;
    }
}

/* Add more comprehensive breakpoints */
@media (max-width: 1200px) {
    .hero h1 {
        font-size: 3rem;
    }
    
    .features h2 {
        font-size: 2rem;
    }
    
    .feature-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 992px) {
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
    }
    
    .footer-section:last-child {
        grid-column: span 2;
    }
    
    .newsletter-form {
        max-width: 100%;
    }
    
    .social-icons {
        justify-content: center;
    }
    
    /* Improve main section layouts */
    main {
        padding: 100px 0 50px;
    }
    
    .hero {
        margin-bottom: 40px;
        padding: 30px 15px;
    }
    
    .compressor {
        padding: 30px;
        margin: 30px auto;
    }
    
    .image-comparison {
        gap: 25px;
    }
    
    .feature-card {
        padding: 30px 25px;
    }
}

/* Improve tablet view */
@media (max-width: 768px) {
    header {
        padding: 15px 0;
    }
    
    header.scrolled {
        padding: 12px 0;
    }
    
    main {
        padding: 90px 0 40px;
    }
    
    .hero h1 {
        font-size: 2.2rem;
    }

    .hero p {
        font-size: 1rem;
        padding-top: 10px;
    }
    
    .hero-badges {
        flex-wrap: wrap;
        justify-content: center;
    }

    .compressor {
        padding: 25px 20px;
        margin: 25px auto;
    }
    
    .upload-container {
        padding: 30px 15px;
    }
    
    .upload-icon {
        width: 60px;
        height: 60px;
        margin-bottom: 15px;
    }
    
    .upload-text {
        font-size: 16px;
    }

    .image-comparison {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .image-card {
        max-width: 100%;
    }
    
    .image-preview {
        min-height: 200px;
        max-height: 300px;
    }
    
    .image-preview img {
        max-height: 250px;
    }

    .stat-value {
        font-size: 2.2rem;
    }
    
    .compression-stats {
        padding: 20px 25px;
    }

    .action-buttons {
        flex-direction: column;
        gap: 15px;
        margin-top: 30px;
    }
    
    .features {
        margin-bottom: 50px;
    }
    
    .features h2 {
        margin-bottom: 40px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }
    
    .footer-section:last-child {
        grid-column: span 1;
    }
    
    .footer-title::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .footer-section:hover .footer-title::after {
        width: 50px;
    }
    
    .footer-links {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .footer-links li {
        padding-left: 0;
        text-align: center;
    }
    
    .footer-links li::before {
        display: none;
    }
    
    .social-icons {
        justify-content: center;
        flex-wrap: wrap;
    }

    .upload-btn,
    .download-btn,
    .reset-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        font-size: 15px;
    }
    
    /* Settings adjustments */
    .settings {
        padding: 20px;
    }
    
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .slider {
        width: 100%;
        margin: 10px 0;
    }
    
    #qualityValue {
        align-self: flex-end;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 25px;
        margin-top: 30px;
    }

    .newsletter-form {
        flex-direction: column;
        align-items: center;
    }
    
    .newsletter-form input {
        width: 100%;
        max-width: 300px;
        margin-bottom: 10px;
    }
    
    /* Fix loading animation for mobile */
    .loading {
        padding: 40px 0;
    }
    
    .spinner {
        width: 50px;
        height: 50px;
    }
    
    .loading-text {
        font-size: 16px;
    }
    
    .progress-bar {
        width: 90%;
    }
}

/* Improve small mobile devices */
@media (max-width: 576px) {
    .logo {
        font-size: 20px;
    }
    
    .logo-icon {
        width: 20px;
        height: 20px;
    }
    
    .hero h1 {
        font-size: 1.9rem;
    }
    
    .hero p {
        font-size: 0.95rem;
    }
    
    .badge {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .compressor {
        padding: 20px 15px;
        border-radius: 12px;
    }
    
    .upload-container {
        padding: 25px 10px;
    }
    
    .upload-icon {
        width: 50px;
        height: 50px;
    }
    
    .upload-text {
        font-size: 15px;
    }
    
    .supported-formats {
        font-size: 12px;
        padding: 5px 12px;
    }
    
    .image-header {
        padding: 12px 15px;
    }
    
    .image-title {
        font-size: 15px;
    }
    
    .image-size {
        font-size: 13px;
        padding: 3px 10px;
    }
    
    .download-btn, .reset-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .features h2 {
        font-size: 1.6rem;
    }
    
    .feature-card {
        padding: 25px 20px;
    }
    
    .feature-icon {
        width: 40px;
        height: 40px;
    }
    
    .feature-card h3 {
        font-size: 18px;
    }
    
    .feature-card p {
        font-size: 14px;
    }
}

/* Specifically address very small devices */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.7rem;
    }
    
    .hero h1::after {
        width: 50px;
        height: 5px;
    }

    .compressor {
        padding: 20px 12px;
    }

    .upload-container {
        padding: 20px 10px;
    }

    .features h2 {
        font-size: 1.5rem;
    }
    
    .features h2:after {
        width: 60px;
    }

    .footer-title {
        font-size: 1.2rem;
    }
    
    .app-badges {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .social-icons {
        gap: 10px;
    }
    
    .social-icon {
        width: 36px;
        height: 36px;
    }
    
    .newsletter h4 {
        font-size: 16px;
    }
    
    /* Improve legal page on small devices */
    .legal-nav {
        padding: 15px;
        top: 80px;
    }
    
    .legal-nav a {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .legal-section {
        padding: 20px 15px;
    }
    
    .legal-section h2 {
        font-size: 20px;
    }
    
    .legal-section h3 {
        font-size: 17px;
    }
    
    .legal-section p, .legal-section li {
        font-size: 14px;
    }
}

/* Fix specific orientation issues */
@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        padding: 20px 15px;
        margin-bottom: 30px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .image-preview {
        min-height: 150px;
    }
    
    .image-preview img {
        max-height: 150px;
    }
}

/* Add print styles for better printing */
@media print {
    header, footer, .upload-container, .action-buttons {
        display: none;
    }
    
    body, main {
        background: white;
        color: black;
        padding: 0;
        margin: 0;
    }
    
    .image-comparison {
        grid-template-columns: 1fr 1fr;
    }
    
    .image-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .legal-content {
        margin-top: 0;
    }
    
    .legal-nav {
        display: none;
    }
}

/* Fix error message for all screen sizes */
.error-message {
    color: var(--error-color);
    padding: 10px 15px;
    border-radius: 6px;
    background-color: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--error-color);
    animation: fadeIn 0.3s ease-in-out;
    margin: 15px auto 0;
    width: 100%;
    box-sizing: border-box;
    max-width: 90%;
    text-align: center;
    font-weight: 500;
    font-size: 0.875rem;
}

/* Header styles - enhanced with glass effect */
header {
    background-color: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    padding: 18px 0;
    /* Slightly more padding */
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    transition: var(--transition);
    border-bottom: 1px solid rgba(226, 232, 240, 0.1);
    /* Subtle border */
}

header.scrolled {
    padding: 14px 0;
}

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

.logo {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: color 0.3s ease;
}

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

.logo-icon {
    margin-right: 10px;
    animation: float 3s ease-in-out infinite;
    transition: transform 0.3s ease;
}

.logo:hover .logo-icon {
    transform: scale(1.1) translateY(-4px);
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-6px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* Theme Toggle - modernized */
.theme-toggle {
    position: relative;
}

#themeToggle {
    background-color: var(--toggle-bg);
    border: none;
    width: 52px;
    /* Slightly wider */
    height: 26px;
    /* Slightly taller */
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    transition: var(--transition);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    outline: none;
    /* Remove focus outline */
}

#themeToggle:focus {
    box-shadow: 0 0 0 2px var(--primary-hover);
}

#themeToggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background-color: var(--toggle-circle);
    border-radius: 50%;
    transition: transform 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] #themeToggle::after {
    transform: translateX(26px);
}

.sun-icon,
.moon-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    transition: opacity 0.3s ease;
}

.sun-icon {
    left: 6px;
    opacity: 1;
    color: #f59e0b;
}

.moon-icon {
    right: 6px;
    opacity: 0.5;
    color: #f1f5f9;
}

[data-theme="dark"] .sun-icon {
    opacity: 0.5;
}

[data-theme="dark"] .moon-icon {
    opacity: 1;
}

/* Main content */
main {
    padding: 120px 0 60px;
    min-height: calc(100vh - 200px);
}

.hero {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 60px;
    padding: 40px 20px;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.5s ease;
}

.hero::before {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1), transparent 70%);
    border-radius: 50%;
    top: -100px;
    right: -50px;
    z-index: -1;
    animation: pulse 10s ease-in-out infinite;
}

.hero::after {
    content: '';
    position: absolute;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1), transparent 70%);
    border-radius: 50%;
    bottom: -70px;
    left: -30px;
    z-index: -1;
    animation: pulse 8s ease-in-out infinite 1s;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
    position: relative;
}

.hero h1::after {
    content: '';
    position: absolute;
    width: 60px;
    height: 6px;
    background: linear-gradient(90deg, var(--primary), transparent);
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 3px;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.hero p {
    font-size: 1.25rem;
    color: var(--mid-text);
    margin-bottom: 30px;
    line-height: 1.6;
    padding-top: 15px;
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-top: 30px;
}

.badge {
    background-color: var(--badge-bg);
    color: var(--badge-text);
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.badge:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.15);
}

.badge svg {
    width: 16px;
    height: 16px;
}

/* Compressor section */
.compressor {
    background-color: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    margin: 40px auto;
    padding: 40px;
    max-width: 900px;
    position: relative;
    transition: var(--transition);
    transform: translateY(0);
    opacity: 0;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.compressor:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    transform: translateY(-5px);
}

.upload-container {
    background-color: var(--light-bg);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1;
    overflow: hidden;
}

.upload-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 10px;
}

.upload-container:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.1);
}

.upload-container:hover::before {
    opacity: 0.02;
}

.upload-container.highlight {
    border-color: var(--primary);
    background-color: rgba(99, 102, 241, 0.05);
    transform: scale(1.01);
}

.upload-icon {
    width: 70px;
    height: 70px;
    color: var(--primary);
    margin-bottom: 20px;
    opacity: 0.9;
    transition: all 0.3s ease;
    animation: float 4s ease-in-out infinite;
}

.upload-container:hover .upload-icon {
    transform: scale(1.1);
    opacity: 1;
}

.upload-text {
    font-size: 18px;
    font-weight: 500;
    color: var(--dark-text);
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.supported-formats {
    font-size: 14px;
    color: var(--light-text);
    margin-bottom: 20px;
    padding: 6px 16px;
    background-color: rgba(99, 102, 241, 0.08);
    border-radius: 20px;
    display: inline-block;
    transition: all 0.3s ease;
}

#fileInput {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.upload-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 12px 30px 12px 30px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-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: all 0.5s ease;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(99, 102, 241, 0.4);
    background-color: var(--primary-hover);
}

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

/* Results section */
.results {
    display: none;
    padding: 20px 0;
    transition: all 0.5s ease;
    opacity: 0;
    transform: translateY(20px);
}

.results.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.results-header {
    text-align: center;
    margin-bottom: 40px;
}

.results-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--primary);
    position: relative;
    display: inline-block;
}

.results-header h2:after {
    content: '';
    position: absolute;
    width: 40%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), transparent);
    bottom: -8px;
    left: 30%;
    border-radius: 2px;
}

.results-header p {
    color: var(--mid-text);
    font-size: 16px;
}

.image-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.image-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    transform: translateZ(0);
    position: relative;
    height: 100%;
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.image-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: rgba(99, 102, 241, 0.05);
    border-bottom: 1px solid var(--border-color);
}

.image-title {
    font-weight: 600;
    color: var(--dark-text);
    font-size: 16px;
}

.image-size {
    background-color: var(--badge-bg);
    color: var(--badge-text);
    font-size: 14px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.image-preview {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    max-height: 350px;
    background-color: var(--body-bg);
    position: relative;
    overflow: hidden;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

.image-preview img:hover {
    transform: scale(1.03);
}

.compression-stats {
    background: linear-gradient(135deg, var(--primary), rgba(99, 102, 241, 0.7));
    color: white;
    border-radius: 12px;
    padding: 25px 30px;
    text-align: center;
    margin-bottom: 40px;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.compression-stats:hover {
    transform: translateY(-5px);
}

.stat-value {
    font-size: 46px;
    font-weight: 800;
    margin-bottom: 5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    background: linear-gradient(120deg, #ffffff, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

.stat-label {
    font-size: 16px;
    font-weight: 500;
    opacity: 0.9;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Settings */
.settings {
    background-color: var(--light-bg);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.setting-item label {
    font-weight: 500;
    color: var(--dark-text);
    font-size: 16px;
}

.slider {
    -webkit-appearance: none;
    width: 60%;
    height: 8px;
    border-radius: 5px;
    background: var(--slider-bg);
    outline: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

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

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

#qualityValue {
    font-weight: 600;
    color: var(--primary);
    width: 50px;
    text-align: right;
}

.action-buttons {
    display: flex;
    gap: 20px;
    margin-top: 40px;
}

.download-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
}

.download-btn svg {
    margin-right: 10px;
}

.download-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: all 0.5s ease;
}

.download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.4);
}

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

.reset-btn {
    background-color: var(--light-bg);
    color: var(--dark-text);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.reset-btn:hover {
    background-color: var(--body-bg);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

/* Loading animation */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 0;
    text-align: center;
}

.loading.active {
    display: flex;
    animation: fadeIn 0.5s ease;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-left-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    animation: spin 1.2s linear infinite;
    margin-bottom: 20px;
    position: relative;
}

.spinner::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background-color: var(--primary);
    border-radius: 50%;
    top: -7px;
    left: calc(50% - 7px);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.8);
}

.loading-text {
    font-size: 18px;
    font-weight: 500;
    color: var(--dark-text);
    margin-bottom: 20px;
}

.progress-bar {
    width: 80%;
    max-width: 400px;
    height: 8px;
    background-color: var(--slider-bg);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin-top: 10px;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    border-radius: 4px;
    width: 0;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

/* Features Section */
.features {
    margin-bottom: 80px;
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 1s ease-out 0.8s forwards;
}

.features h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 50px;
    position: relative;
    display: inline-block;
}

.features h2:after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    border-radius: 2px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 50px;
    perspective: 1000px;
}

.feature-card {
    background-color: var(--feature-card-bg);
    border-radius: 12px;
    padding: 35px 30px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    z-index: 1;
    transform: translateZ(0);
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), transparent);
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: -1;
    border-radius: 12px;
}

.feature-card:hover {
    transform: translateY(-10px) translateZ(10px);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.1);
}

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

.feature-icon {
    width: 50px;
    height: 50px;
    background-color: var(--feature-icon-bg);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: var(--primary);
    transition: all 0.3s ease;
    transform: translateZ(20px);
}

.feature-card:hover .feature-icon {
    transform: scale(1.15) translateZ(30px);
    color: var(--primary-hover);
}

.feature-card h3 {
    font-size: 20px;
    margin-bottom: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.feature-card p {
    color: var(--mid-text);
    font-size: 15px;
    line-height: 1.7;
    transition: all 0.3s ease;
}

/* Footer styles */
footer {
    background: var(--footer-bg);
    padding: 80px 0 20px;
    position: relative;
    overflow: hidden;
    border-top: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 1000' opacity='0.04'%3E%3Cpath d='M0,0v1000h1000V0H0z M487.6,990.3C217.5,975.8,15.5,773.5,10.2,487.8l0,0.2c-2.2-104.7,25.3-204.3,75.8-285.9 c102.6-157.3,282.5-257.2,480.2-240c277.3,24.5,486.9,268.7,424.2,551.1C930.7,763.6,757.1,1004.9,487.6,990.3z'/%3E%3C/svg%3E") no-repeat center center;
    background-size: cover;
    opacity: 0.04;
    z-index: 0;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 2fr;
    gap: 60px;
    position: relative;
    z-index: 1;
}

.footer-section {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.5s ease;
}

.footer-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--dark-text);
    position: relative;
    display: inline-block;
}

.footer-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 30px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.footer-section:hover .footer-title::after {
    width: 50px;
}

.footer-section p {
    color: var(--mid-text);
    margin-bottom: 20px;
    line-height: 1.7;
}

.app-badges {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.app-badge {
    background-color: var(--badge-bg);
    color: var(--badge-text);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
    position: relative;
    padding-left: 20px;
    transition: all 0.3s ease;
}

.footer-links li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background-color: var(--primary);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.footer-links li:hover {
    transform: translateX(5px);
}

.footer-links li:hover::before {
    background-color: var(--primary-hover);
    box-shadow: 0 0 8px var(--primary);
}

.footer-links a {
    color: var(--mid-text);
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 15px;
}

.footer-links a:hover {
    color: var(--primary);
}

.social-icons {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.social-icon {
    width: 40px;
    height: 40px;
    background-color: var(--badge-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    text-decoration: none;
    position: relative;
    transition: all 0.3s ease;
    border: 1px solid rgba(99, 102, 241, 0.2);
    overflow: hidden;
}

.social-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    border-radius: 50%;
    transform: scale(0);
    transition: all 0.3s ease;
    z-index: -1;
}

.social-icon svg {
    transition: all 0.3s ease;
    z-index: 1;
}

.social-icon:hover {
    color: white;
    transform: translateY(-5px);
}

.social-icon:hover::before {
    transform: scale(1);
}

.social-icon:hover svg {
    transform: scale(1.2);
}

/* Enhanced Newsletter */
.newsletter {
    margin-top: 30px;
}

.newsletter h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--dark-text);
}

.newsletter-form {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.newsletter-form input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--input-border);
    border-radius: 30px;
    background-color: var(--newsletter-input-bg);
    color: var(--dark-text);
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

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

.newsletter-form button {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 12px 20px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.newsletter-form button::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: all 0.5s ease;
}

.newsletter-form button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

.newsletter-form button:hover::before {
    left: 100%;
}

.newsletter-privacy {
    font-size: 13px;
    color: var(--light-text);
}

.copyright {
    text-align: center;
    padding-top: 30px;
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
    color: var(--light-text);
    font-size: 14px;
}

/* Additional animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Transitions for dark/light mode */
.fade-transition {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Improved Tablet Responsiveness for the Footer */
@media (max-width: 992px) {
    footer {
        padding: 60px 0 20px;
    }
    
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
    }
    
    .footer-section:last-child {
        grid-column: span 2;
        margin-top: 20px;
    }
    
    .social-icons {
        justify-content: flex-start;
    }
    
    .newsletter-form {
        max-width: 100%;
        flex-wrap: nowrap;
    }
}

/* Mobile Responsiveness for the Footer */
@media (max-width: 768px) {
    footer {
        padding: 50px 0 20px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }
    
    .footer-section:last-child {
        grid-column: span 1;
        margin-top: 0;
    }
    
    .footer-title {
        display: block;
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }
    
    .footer-title::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .footer-section:hover .footer-title::after {
        width: 50px;
    }
    
    .app-badges {
        justify-content: center;
    }
    
    .footer-links {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .footer-links li {
        padding-left: 0;
        text-align: center;
        margin-bottom: 15px;
    }
    
    .footer-links li::before {
        display: none;
    }
    
    .social-icons {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .newsletter-form {
        flex-direction: column;
        align-items: center;
    }
    
    .newsletter-form input {
        width: 100%;
        max-width: 300px;
        margin-bottom: 15px;
    }
    
    .newsletter-form button {
        width: auto;
        min-width: 140px;
        justify-content: center;
    }
    
    .copyright {
        margin-top: 40px;
        padding-top: 20px;
    }
}

/* Small Mobile Phones */
@media (max-width: 576px) {
    footer {
        padding: 40px 0 20px;
    }
    
    .footer-section {
        padding: 0 10px;
    }
    
    .footer-title {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .footer-title::after {
        height: 2px;
        width: 25px;
        bottom: -6px;
    }
    
    .app-badges {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .social-icons {
        gap: 12px;
    }
    
    .social-icon {
        width: 36px;
        height: 36px;
    }
    
    .social-icon svg {
        width: 16px;
        height: 16px;
    }
    
    .newsletter h4 {
        font-size: 16px;
    }
    
    .newsletter-form input {
        padding: 10px 15px;
        font-size: 13px;
        max-width: 250px;
    }
    
    .newsletter-form button {
        padding: 10px 15px;
        font-size: 13px;
        min-width: 120px;
    }
    
    .newsletter-privacy {
        font-size: 12px;
        max-width: 250px;
        margin: 0 auto;
    }
    
    .copyright {
        font-size: 12px;
        margin-top: 30px;
    }
}

/* Very Small Mobile Devices */
@media (max-width: 360px) {
    .footer-section p {
        font-size: 14px;
    }
    
    .app-badge {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .social-icons {
        gap: 10px;
    }
    
    .social-icon {
        width: 32px;
        height: 32px;
    }
    
    .newsletter-form input {
        max-width: 220px;
    }
    
    .footer-links a {
        font-size: 14px;
    }
}

/* Extra class for touch devices */
.touch-device .upload-btn,
.touch-device .download-btn,
.touch-device .reset-btn,
.touch-device .social-icon {
    /* Increase tap target size on touch devices */
    min-height: 44px;
}

/* Fix scrolling issues on iOS */
@supports (-webkit-touch-callout: none) {
    body {
        /* Hack to make body take up full height on iOS Safari */
        min-height: -webkit-fill-available;
    }
}

/* Fix for iOS input zoom */
@media screen and (max-width: 576px) {
    input[type="email"] {
        font-size: 16px; /* Prevent iOS zoom on input focus */
    }
    
    .newsletter-form button {
        height: auto;
        min-height: 42px;
    }
}

/* Fix any remaining overflow issues */
@media (max-width: 576px) {
    .container {
        padding: 0 15px;
    }
}

/* Fix footer on small devices */
@media (max-width: 360px) {
    footer {
        overflow-x: hidden;
        padding-left: 5px;
        padding-right: 5px;
    }
    
    .footer-section {
        padding: 0 5px;
        width: 100%;
    }
    
    .social-icons {
        flex-wrap: wrap;
        justify-content: center;
    }
}