:root {
    /* Color Palette - Modern & Refined */
    --bg-main: #0a0a0f;
    --bg-card: rgba(25, 25, 35, 0.6);
    --bg-glass: rgba(15, 15, 25, 0.85);
    --bg-hover: rgba(45, 45, 65, 0.5);
    
    --primary: #a78bfa;       /* Soft Violet */
    --primary-dark: #7c3aed;
    --primary-glow: rgba(167, 139, 250, 0.4);
    --secondary: #38bdf8;     /* Soft Cyan */
    --accent: #fb7185;
    --bg: #0f0f18;
    --card-bg: rgba(25, 25, 40, 0.7);
    --text-main: #f1f5f9;
    --text-muted: #8892a8;
    --border: rgba(255, 255, 255, 0.06);
    --border-highlight: rgba(167, 139, 250, 0.2);
    --glass-bg: rgba(12, 12, 20, 0.9);
    --success: #34d399;
    --warning: #fbbf24;
    --error: #f87171;
    
    /* Typography Scale - Refined */
    --font-xs: 0.75rem;
    --font-sm: 0.8125rem;
    --font-base: 0.875rem;
    --font-md: 0.9375rem;
    --font-lg: 1rem;
    --font-xl: 1.125rem;
    --font-2xl: 1.375rem;
    --font-3xl: 1.75rem;
    
    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;
    
    /* Border Radius - Refined */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Effects */
    --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 20px -4px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.5);
    --glow-primary: 0 0 20px -4px var(--primary-glow);
    
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light Theme Variables Overlay */
body.light-theme {
    --bg-main: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.8);
    --bg-hover: rgba(226, 232, 240, 0.8);
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    
    --border: rgba(148, 163, 184, 0.2);
    --border-highlight: rgba(139, 92, 246, 0.4);
    
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

body.light-theme .ambient-light { opacity: 0.15; }
body.light-theme .ambient-light-2 { opacity: 0.1; }
body.light-theme .logo { color: var(--text-main); }
body.light-theme .nav-btn { color: var(--text-muted); }
body.light-theme .hero-content h1 { background: linear-gradient(135deg, #0f172a 0%, #334155 50%, #8b5cf6 100%); -webkit-background-clip: text; background-clip: text; }

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

/* Global Utility */
.hidden { display: none !important; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: var(--font-base);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ambient Background Lights */
.ambient-light {
    position: fixed;
    top: -20vh;
    left: 20vw;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 60%);
    filter: blur(80px);
    z-index: -1;
    animation: drift 20s infinite alternate ease-in-out;
}

.ambient-light-2 {
    position: fixed;
    bottom: -10vh;
    right: 10vw;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.1) 0%, transparent 60%);
    filter: blur(80px);
    z-index: -1;
    animation: drift 15s infinite alternate-reverse ease-in-out;
}

@keyframes drift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(15px, 25px); }
}

@media (max-width: 640px) {
    .ambient-light, .ambient-light-2 {
        filter: blur(40px); /* Lighter blur for mobile GPUs */
        opacity: 0.6;
    }
    @keyframes drift {
        0% { transform: translate(0, 0); }
        100% { transform: translate(10px, 15px); }
    }
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* Premium Navbar & Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    position: sticky;
    top: 1rem;
    z-index: 1000;
    box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.4);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-header.scrolled {
    background: rgba(15, 23, 42, 0.9);
    border-color: var(--primary-glow);
    transform: translateY(-0.5rem);
    padding: 0.75rem 1.75rem;
}

.logo-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: transform 0.3s ease;
}

.logo-link:hover {
    transform: scale(1.05);
}

/* Nav Links */
.nav-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn::after {
    content: '▾';
    margin-right: 5px;
    font-size: 0.8em;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    min-width: 220px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    z-index: 1000;
    top: 100%;
    right: 0; /* RTL alignment */
    padding: 0.5rem;
    margin-top: 0.5rem;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-content a {
    color: var(--text-main);
    padding: 10px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: 0.2s;
    margin-bottom: 2px;
}

.dropdown-content a:hover {
    background-color: rgba(139, 92, 246, 0.15);
    color: var(--primary);
    transform: translateX(-5px);
}

/* Show dropdown on hover (Desktop) */
.dropdown:hover .dropdown-content {
    display: block;
}

/* Mobile Dropdown */
@media (max-width: 900px) {
    .dropdown { display: block; width: 85%; align-self: center; } /* Match nav-link width */
    .dropdown-btn { width: 100%; text-align: right; justify-content: space-between; }
    .dropdown-content {
        position: static;
        box-shadow: none;
        background: rgba(255,255,255,0.03);
        min-width: 100%;
        display: none; /* Hidden until toggled via JS */
        margin-top: 0;
        padding-right: 1rem;
        border: none;
    }
    .dropdown.active .dropdown-content { display: block; animation: slideDown 0.3s ease; }
    
    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

/* Mobile Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 10px;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--text-muted);
    transition: all 0.3s ease;
}

/* PWA Install Button */
#install-btn:not(.hidden) {
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-full);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

@media (max-width: 900px) {
    .menu-toggle { display: flex; }
    
    .nav-links {
        position: fixed;
        top: 0; right: -100%;
        width: 75%; /* Side Drawer Style */
        max-width: 320px;
        height: 100vh;
        background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.95));
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        flex-direction: column;
        justify-content: flex-start; /* Start from top */
        padding-top: 6rem; /* Space for close button */
        gap: 1.5rem;
        transition: right 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); /* Bouncy effect */
        z-index: 1000;
        border-left: 1px solid rgba(255,255,255,0.1);
        box-shadow: -20px 0 50px rgba(0,0,0,0.5);
    }

    .nav-links.active { right: 0; }

    .nav-link {
        font-size: 1.1rem;
        padding: 0.8rem 1.5rem;
        width: 85%; /* Slightly less than full width */
        text-align: right; /* RTL alignment */
        border-radius: 12px;
        transition: all 0.2s;
        border: 1px solid transparent;
    }
    .nav-link:hover, .nav-link.active {
        background: rgba(139, 92, 246, 0.15);
        border-color: rgba(139, 92, 246, 0.3);
        transform: translateX(-5px); /* Slide left on hover */
    }

    .menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); background: white; }
    .menu-toggle.active span:nth-child(2) { opacity: 0; }
    .menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); background: white; }
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.25rem;
    color: white;
    letter-spacing: -0.02em;
}

.logo svg {
    stroke: var(--primary);
    filter: drop-shadow(0 0 5px var(--primary));
}

.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn:hover {
    color: var(--text-main);
    background: var(--bg-hover);
    transform: rotate(15deg);
}

/* Mobile Specific Adjustments for Consistency */
@media (max-width: 640px) {
    .app-container {
        padding: 1rem;
        gap: 1.5rem;
    }
    
    .logo { font-size: 1.1rem; }
    .logo svg { width: 24px; height: 24px; }
    
    .drop-zone {
        padding: 2rem 1rem;
        border-width: 2px;
        background: linear-gradient(180deg, rgba(30, 41, 59, 0.4) 0%, rgba(15, 23, 42, 0.4) 100%);
        border-radius: 20px;
    }
    
    .drop-visual {
        margin-bottom: 1rem;
        transform: scale(0.8); /* Scale down icons for mobile */
    }

    .drop-zone h1 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
        line-height: 1.3;
    }
    .drop-zone p {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
        max-width: 280px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .badges { gap: 0.5rem; margin-bottom: 1.5rem; }
    .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.6rem;
        background: rgba(255,255,255,0.03);
    }
    
    .cta-btn {
        width: fit-content !important;
        min-width: 0 !important;
        display: inline-flex !important;
        margin: 0.5rem auto 0 auto !important; /* Center it */
        padding: 0.5rem 1.2rem !important;
        font-size: 0.85rem !important;
        box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2) !important;
    }
    
    .cta-btn svg { width: 18px; height: 18px; } /* Smaller icon */

    .settings-panel {
        width: 95%;
        padding: 1.5rem;
        max-height: 85vh;
        overflow-y: auto;
    }
    
    /* Mobile Footer Redesign */
    .app-footer {
        padding: 2rem 1.5rem;
        background: linear-gradient(180deg, rgba(30, 41, 59, 0.2) 0%, rgba(15, 23, 42, 0.4) 100%);
        border-top: 1px solid var(--border);
        margin-top: 2rem;
        border-radius: 24px 24px 0 0;
    }
    
    .footer-links {
        flex-wrap: wrap;
        gap: 0.8rem;
    }
    
    .footer-links a {
        background: rgba(255, 255, 255, 0.03);
        padding: 0.5rem 1rem;
        border-radius: 50px;
        font-size: 0.85rem;
        border: 1px solid transparent;
    }
    
    .footer-links .sep { display: none; } /* Hide separators on mobile */
}

/* Main Main */
.main-card {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 2rem 0;
}

.hero-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 50%, #8b5cf6 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text; /* Standard property */
    -webkit-text-fill-color: transparent;
    animation: gradientFlow 5s ease infinite;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hero-desc {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto 3rem auto;
}

/* Drop Zone & Drag Over State */
.hero-section#drop-zone {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hero-section.drag-over {
    transform: scale(1.02);
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    border-radius: 24px; /* Ensure rounded corners if background visible */
}

/* Toast Notification - Premium */
.toast {
    position: fixed; bottom: 30px; left: 50%;
    transform: translate(-50%, 100px);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 12px 24px;
    border-radius: 100px;
    font-weight: 500;
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
    z-index: 200;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex; align-items: center; gap: 12px;
}
.toast::before {
    content: 'ⓘ';
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px;
    background: var(--primary); color: white;
    border-radius: 50%; font-size: 12px; font-weight: bold;
}
.toast.success::before { content: '✓'; background: var(--success); }
.toast.error::before { content: '✕'; background: var(--accent); }

/* Format Card Grid & Descriptions */
.format-cards {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap; /* Ensure side-by-side wrapping */
    margin-top: 1.5rem;
}

.format-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 1.5rem;
    flex: 1 1 140px; /* Grow and shrink, min-width 140px */
    max-width: 180px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative; overflow: hidden;
    backdrop-filter: blur(10px);
}

.format-card .fmt-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    line-height: 1.4;
    font-weight: 400;
}

/* Settings Panel Header Icon */
.panel-header h3 { 
    font-size: 1.5rem; color: white; margin: 0; font-weight: 700;
    background: linear-gradient(to right, white, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text; 
    -webkit-text-fill-color: transparent;
    display: flex; align-items: center; gap: 10px;
}
.panel-header h3::before {
    content: '';
    width: 24px; height: 24px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.1a2 2 0 0 1-1-1.72v-.51a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z'%3E%3C/path%3E%3Ccircle cx='12' cy='12' r='3'%3E%3C/circle%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.toast.show { transform: translate(-50%, 0); opacity: 1; }

.format-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 10px 30px -10px rgba(139, 92, 246, 0.3);
}

.format-card:active {
    transform: scale(0.95);
}

.format-card .icon-box {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem auto;
    color: var(--primary);
    transition: transform 0.3s ease;
}

.format-card:hover .icon-box {
    transform: rotate(10deg) scale(1.1);
    background: var(--primary);
    color: white;
}

.format-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.format-card span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .hero-content h1 { font-size: 1.8rem; }
    
    /* Horizontal Scroll for Cards on Mobile (App-like feel) */
    .format-cards { 
        flex-direction: row; 
        flex-wrap: nowrap;
        overflow-x: auto; 
        scroll-snap-type: x mandatory;
        justify-content: flex-start;
        padding-bottom: 20px;
        padding-left: 1rem; padding-right: 1rem; /* Bumper */
        margin-left: -1rem; margin-right: -1rem; /* Full width edge-to-edge effect */
        -webkit-overflow-scrolling: touch;
        gap: 1rem;
    }
    
    /* Hide scrollbar but keep functionality */
    .format-cards::-webkit-scrollbar { display: none; }
    
    .format-card { 
        min-width: 75%; /* Show one main card */
        max-width: 75%;
        scroll-snap-align: center;
        margin: 0;
        display: flex; 
        flex-direction: column; 
        align-items: center; 
        padding: 1.5rem; 
        text-align: center; 
        border: 1px solid rgba(255,255,255,0.08);
        background: rgba(30, 41, 59, 0.6);
    }
    
    .format-card .icon-box { margin: 0 auto 1rem auto; width: 50px; height: 50px; }
    .format-card h3, .format-card span { text-align: center; width: auto; }
}

/* Badges */
.badges {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 0.5rem 1.25rem;
    border-radius: 100px;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
}

.badge:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.badge svg { stroke-width: 2.5; }

/* Main CTA Group */
.cta-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.cta-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s var(--ease-out);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 160px;
    justify-content: center;
}

.cta-webp {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-color: transparent;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.25);
}
.cta-png:hover, .cta-jpg:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.3); }

.cta-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.4);
}
.cta-btn:active { transform: translateY(0); }

.btn-tag {
    font-size: 0.75rem;
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    color: var(--text-muted);
}
.cta-webp .btn-tag { color: white; background: rgba(0,0,0,0.2); }

/* Active State for buttons */
.cta-btn.active {
    background: white;
    color: var(--primary);
    border-color: white;
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}
.cta-btn.active .btn-tag {
    background: var(--primary);
    color: white;
}

@media (max-width: 640px) {
    .cta-group { flex-direction: column; gap: 0.8rem; width: 100%; max-width: 300px; margin: 0 auto; }
    .cta-btn { width: 100%; padding: 1rem; }
}

/* Settings Panel (Modal) - Premium Glass Design */
.panel-overlay {
    position: fixed; inset: 0;
    background: rgba(3, 7, 18, 0.6);
    backdrop-filter: blur(8px);
    z-index: 100; opacity: 0;
    pointer-events: none; transition: opacity 0.3s;
}
.panel-overlay:not(.hidden) { opacity: 1; pointer-events: auto; }

.settings-panel {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -40%) scale(0.95);
    width: 90%; max-width: 450px;
    background: rgba(30, 41, 59, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.05);
    border-radius: 24px;
    padding: 2rem;
    z-index: 101; opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    
    /* Mobile First (Single Column default) */
    display: flex;
    flex-direction: column;
    max-height: 90vh; /* Prevent overflow on small screens */
    overflow-y: auto;
}

@media (min-width: 640px) {
    .settings-panel {
        max-width: 650px; /* Wider on desktop */
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 1.5rem; /* Gap between columns */
        align-items: start;
        overflow-y: visible; /* Usually fine on desktop */
    }
    
    /* Header spans full width */
    .panel-header {
        grid-column: span 2;
        margin-bottom: 2rem;
    }

    /* Force wide rows to span full width (for Watermark/Resize groups) */
    .wide-row {
        grid-column: span 2;
    }
}

.settings-panel:not(.hidden) {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1; pointer-events: auto;
}

.panel-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 2rem; padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.panel-header h3 { 
    font-size: 1.5rem; color: white; margin: 0; font-weight: 700;
    background: linear-gradient(to right, white, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text; 
    -webkit-text-fill-color: transparent;
}

.close-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid transparent;
    color: var(--text-muted);
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: 0.2s;
}
.close-btn:hover { background: rgba(255,255,255,0.1); color: white; transform: rotate(90deg); }

.setting-row { margin-bottom: 1.5rem; }
.setting-row label {
    display: flex; justify-content: space-between; align-items: center;
    color: var(--text-main); margin-bottom: 0.8rem; font-weight: 500; font-size: 0.95rem;
}

/* Custom Checkbox */
input[type=checkbox] {
    appearance: none;
    -webkit-appearance: none;
    width: 44px; height: 24px;
    background: rgba(255,255,255,0.1);
    border-radius: 100px;
    position: relative; cursor: pointer;
    transition: 0.3s;
    border: 1px solid rgba(255,255,255,0.05);
}
input[type=checkbox]::after {
    content: ''; position: absolute;
    top: 2px; left: 2px;
    width: 18px; height: 18px;
    background: white;
    border-radius: 50%;
    transition: 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input[type=checkbox]:checked { background: var(--primary); border-color: var(--primary); }
input[type=checkbox]:checked::after { transform: translateX(20px); }

.sub-settings {
    background: rgba(15, 23, 42, 0.5);
    padding: 1.25rem;
    border-radius: 16px;
    display: grid; gap: 1rem;
    border: 1px solid rgba(255,255,255,0.05);
    transition: 0.3s;
    margin-top: 0.5rem;
}
.sub-settings.disabled { opacity: 0.5; pointer-events: none; filter: grayscale(1); }

/* Inputs styling */
input[type=range] {
    appearance: none;
    -webkit-appearance: none; 
    width: 100%; height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 100px; outline: none;
}
input[type=range]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 20px; height: 20px;
    background: var(--primary);
    border-radius: 50%; cursor: pointer;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
    border: 2px solid #fff;
    transition: transform 0.1s;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.1); }

input[type=text], input[type=number], select {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    color: white; width: 100%;
    font-size: 0.9rem; outline: none;
    transition: 0.2s;
}
input[type=text]:focus, input[type=number]:focus, select:focus {
    border-color: var(--primary);
    background: rgba(0,0,0,0.5);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

/* .floating-controls removed (redundant) */
/* .action-bar removed (redundant) */
.action-bar.hidden { display: none; }

.status-text {
    display: flex; flex-direction: column; gap: 4px;
    font-weight: 600; font-size: 0.95rem;
}
.progress-bar {
    width: 15rem; height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 100px;
    overflow: hidden;
}
.fill { background: var(--success); height: 100%; width: 0; transition: width 0.3s; }

.cancel-btn {
    background: transparent; color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.6rem 1.25rem;
    border-radius: 100px;
    font-weight: 600; cursor: pointer;
    transition: 0.2s; margin-left: 10px;
}
.cancel-btn:hover { background: rgba(244, 63, 94, 0.1); color: var(--accent); border-color: var(--accent); }

.main-action-btn {
    background: var(--text-main);
    color: #000;
    border: none;
    padding: 0.4rem 1.2rem; /* Further reduced */
    border-radius: 100px;
    font-weight: 600; /* Slightly lighter weight */
    font-size: 0.9rem; /* Smaller font */
    display: flex; align-items: center; gap: 8px;
    cursor: pointer;
    transition: 0.2s;
}
.main-action-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(255,255,255,0.2); }
.main-action-btn:disabled { opacity: 0.7; transform: none; cursor: wait; }

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    transition: 0.3s var(--ease-out);
    animation: fadeScale 0.4s var(--ease-out);
    display: flex; flex-direction: column;
}

.result-card.pending {
    border-style: dashed;
    opacity: 0.8;
}

.result-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    background: var(--bg-hover);
}

.img-preview {
    width: 100%;
    height: 180px;
    object-fit: contain;
    background: #020617; /* Darker bg for image contrast */
    border-bottom: 1px solid var(--border);
    padding: 10px;
}

.card-content {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.card-info {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.85rem; color: var(--text-muted);
}
.card-info span:first-child { 
    font-weight: 600; color: var(--text-main); 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px;
}

.stat-tag {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8rem;
}
.stat-tag.wait { background: rgba(148, 163, 184, 0.1); color: var(--text-muted); }

.card-actions {
    display: flex; gap: 0.5rem; margin-top: auto;
}

.btn-sm {
    flex: 1;
    border: none;
    padding: 0.6rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}

.btn-dl { background: rgba(255,255,255,0.1); color: white; }
.btn-dl:hover { background: white; color: black; }

.btn-del { flex: 0 0 40px; background: rgba(244, 63, 94, 0.1); color: var(--accent); }
.btn-del:hover { background: var(--accent); color: white; }


/* Info Section */
.info-section {
    margin: 4rem auto;
    width: 100%;
    max-width: 1000px;
    padding: 0 1.5rem;
}
.info-card {
    background: linear-gradient(135deg, rgba(30,41,59,0.5), rgba(15,23,42,0.5));
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-align: center;
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}
.feature-item {
    padding: 2rem;
    background: rgba(30, 41, 59, 0.2);
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: 0.3s;
}
.feature-item:hover {
    background: rgba(30, 41, 59, 0.4);
    border-color: var(--primary);
    transform: translateY(-5px);
}
.f-icon {
    width: 60px; height: 60px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

/* Tools Showcase Section */
.tools-showcase {
    margin: 4rem 0;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.tool-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 2rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.tool-card:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2), 0 0 15px rgba(139, 92, 246, 0.2);
}

.t-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.tool-card h3 {
    color: white;
    font-size: 1.4rem;
    margin: 0;
}

.tool-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

.tool-link {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
}

.tool-link::after {
    content: '←'; /* Reverse arrow for RTL */
    transition: transform 0.3s;
}

.tool-card:hover .tool-link::after {
    transform: translateX(-5px);
}

/* SEO Content & Articles - Premium Cards */
.seo-articles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
}

.seo-box {
    background: rgba(30, 41, 59, 0.3);
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: 20px;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
}

.seo-box::before {
    content: '';
    position: absolute; top: 0; left: 0; width: 4px; height: 100%;
    background: var(--primary);
    opacity: 0.5;
}

.seo-box:hover {
    background: rgba(30, 41, 59, 0.5);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.3);
    border-color: var(--primary);
}

.seo-box h3 {
    font-size: 1.2rem;
    color: white;
    margin-bottom: 1rem;
    display: flex; align-items: center; gap: 10px;
}

.seo-box p {
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 0.95rem;
}

/* Footer - Premium Dark Design */
.app-footer {
    margin-top: 6rem;
    padding: 4rem 2rem 1.5rem;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.6));
    border-top: 1px solid var(--border);
    position: relative;
    color: var(--text-muted);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    text-align: right; /* RTL alignment */
}

.footer-col h3 {
    color: white; font-size: 1.2rem; margin-bottom: 1.5rem;
    position: relative; display: inline-block;
}
.footer-col h3::after {
    content: ''; position: absolute; bottom: -8px; right: 0;
    width: 40px; height: 3px; background: var(--primary);
    border-radius: 10px;
}

.brand-col p { line-height: 1.8; opacity: 0.8; font-size: 0.9rem; margin-top: 1rem; }

.f-links { display: flex; flex-direction: column; gap: 0.8rem; }
.f-links a {
    color: var(--text-muted); text-decoration: none;
    transition: 0.2s; font-size: 0.95rem;
    display: flex; align-items: center; gap: 8px;
}
.f-links a:hover { color: var(--primary); transform: translateX(-5px); }
.f-links a::before { content: '›'; font-size: 1.2rem; line-height: 0; opacity: 0.5; }

.footer-bottom {
    margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    text-align: center;
    font-size: 0.85rem; opacity: 0.6;
}

/* Scroll to Top Button */
.scroll-top-btn {
    position: fixed; bottom: 30px; right: 30px;
    width: 45px; height: 45px;
    background: var(--primary);
    color: white;
    border: none; border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 90;
    opacity: 0; visibility: hidden; transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.scroll-top-btn.visible {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.scroll-top-btn:hover {
    background: white; color: var(--primary);
    transform: translateY(-5px);
}
@keyframes fadeScale {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.toast {
    position: fixed; bottom: 30px; left: 50%;
    transform: translate(-50%, 100px);
    background: rgba(3, 7, 18, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-highlight);
    color: white;
    padding: 12px 24px;
    border-radius: 100px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 200;
    transition: transform 0.4s var(--ease-out);
    display: flex; align-items: center; gap: 12px;
}
.toast.show { transform: translate(-50%, 0); }

/* Mobile */
/* Mobile Footer & Action Bar fixes */
@media (max-width: 640px) {
    .action-bar {
        bottom: 0.5rem;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
        width: 100%;
        border-radius: 12px;
    }
    
    .status-text {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-bottom: 0.25rem;
        font-size: 0.85rem;
    }
    
    .progress-bar { width: 100%; margin-top: 0.5rem; }
    
    .actions-group {
        width: 100%;
        flex-direction: column; /* Stacked: Action top, Cancel bottom */
        gap: 0.5rem;
    }
    
    .main-action-btn { 
        width: 100%; 
        justify-content: center; 
        padding: 0.75rem; 
        font-size: 0.95rem; 
    }
    .cancel-btn { 
        width: 100%; 
        margin: 0; 
        text-align: center; 
        border: 1px solid var(--border); 
        padding: 0.5rem; 
        color: var(--accent);
        font-size: 0.9rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Horizontal Card for Mobile - Clean & Compact */
    .result-card {
        flex-direction: row;
        height: auto;
        min-height: 110px;
        align-items: stretch;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
    
    .img-preview {
        width: 110px;
        height: auto;
        min-height: 100%;
        object-fit: cover;
        border-bottom: none;
        border-left: 1px solid var(--border); /* RTL Divider */
    }
    
    .card-content {
        padding: 0.8rem;
        gap: 0.5rem;
        justify-content: center;
    }
    
    .card-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    
    .card-info span:first-child {
        font-size: 0.95rem;
        max-width: 100%;
        white-space: normal; /* Allow wrap */
        line-height: 1.4;
    }
    
    .card-actions {
        margin-top: 0.5rem;
        width: 100%;
        gap: 0.4rem;
        flex-wrap: wrap; /* Allow buttons to wrap to next line if needed */
    }
    
    .btn-sm {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.8rem;
        flex: 1 1 auto; /* Allow growing but not shrinking too much */
        min-width: 0;
    }
    
    .card-actions .btn-text {
        padding: 0 !important;
        font-size: 0.75rem !important;
        display: inline !important;
        white-space: nowrap;
    }
    
    .btn-del {
        flex: 0 0 36px !important;
        height: 36px !important;
        padding: 0 !important;
        flex-shrink: 0;
        margin: 0 !important;
    }
}

/* In-App Browser Warning Banner */
.inapp-browser-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: bannerSlideDown 0.4s var(--ease-out);
}

@keyframes bannerSlideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

@keyframes bannerSlideUp {
    from { transform: translateY(0); }
    to { transform: translateY(-100%); }
}

.banner-closing {
    animation: bannerSlideUp 0.3s var(--ease-out) forwards !important;
}

.inapp-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 800px;
    margin: 0 auto;
}

.inapp-icon {
    flex-shrink: 0;
    padding-top: 2px;
}

.inapp-text {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.5;
}

.inapp-text strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 8px;
    font-weight: 800;
}

.inapp-text p {
    margin: 0 0 8px 0;
    opacity: 0.95;
}

.inapp-text ol {
    margin: 0;
    padding-right: 20px;
    padding-left: 0;
}

.inapp-text li {
    margin-bottom: 4px;
}

.inapp-close {
    flex-shrink: 0;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 12px;
    width: 36px;
    height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}
.inapp-close svg { color: white; }
.inapp-close:hover { background: rgba(255,255,255,0.3); }

.inapp-copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 12px auto 0;
    padding: 10px 24px;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 100px;
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    width: fit-content;
}

.inapp-copy-btn:hover {
    background: rgba(255,255,255,0.25);
    border-color: white;

}

/* Body Adjustments */
body.has-inapp-banner {
    padding-top: 180px;
}

@media (max-width: 640px) {
    .inapp-browser-banner {
        padding: 12px;
    }
    
    .inapp-text {
        font-size: 0.85rem;
    }
    
    .inapp-text strong {
        font-size: 1rem;
    }
    
    body.has-inapp-banner {
        padding-top: 240px; /* Adjusted for better visibility */
    }
}

/* PWA Install Button Styles */
#install-btn:not(.hidden) {
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid var(--border-highlight);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(139, 92, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}
/* Common Section Headers */
.section-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 3rem;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Professional Blog Section */
.blog-section {
    margin: 4rem 0;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.blog-card {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: 20px;
    transition: all 0.3s var(--ease-out);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.blog-card:hover {
    transform: translateY(-5px);
    background: rgba(30, 41, 59, 0.6);
    border-color: var(--primary-glow);
    box-shadow: 0 10px 30px -10px rgba(139, 92, 246, 0.2);
}

.blog-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.blog-card h3 {
    color: var(--text-main);
    font-size: 1.25rem;
    font-weight: 700;
}

.blog-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin: 0;
}

.faq-section {
    margin: 6rem auto 4rem;
}

.faq-section h3 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.faq-item {
    background: rgba(30, 41, 59, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-q {
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
    user-select: none;
}
.faq-q:hover { background: rgba(255,255,255,0.03); }

.faq-a {
    max-height: 0;
    overflow: hidden;
    padding: 0 1.5rem;
    transition: all 0.4s var(--ease-out);
    background: rgba(0,0,0,0.15);
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.8;
}

.faq-item.open {
    border-color: var(--border-highlight);
    background: rgba(30, 41, 59, 0.4);
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.3);
}

.faq-item.open .faq-a {
    max-height: 300px;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

.faq-item.open .arrow { 
    transform: rotate(180deg); 
    color: var(--primary);
}
.arrow { 
    transition: 0.4s var(--ease-out); 
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    opacity: 0.7;
}



/* Footer Social Links */
.footer-social {
    display: flex;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.social-link {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.3s var(--ease-out);
}

.social-link:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 5px 15px var(--primary-glow);
}

.social-link svg {
    width: 20px;
    height: 20px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Quick Settings Bar */
.quick-settings {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(25px);
    border: 1px solid var(--border-highlight);
    border-radius: 24px;
    padding: 1.5rem 1.75rem;
    text-align: right;
    box-shadow: 0 15px 50px -15px rgba(0,0,0,0.4);
    width: 100%;
    margin-bottom: 10px; /* Space between settings and action bar */
}

.qs-prompt {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
    color: var(--primary);
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.qs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
}

.qs-item label {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.qs-sub-group {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    transition: 0.3s opacity;
}

.qs-sub-group.disabled, .qs-sub-group-pro.disabled {
    opacity: 0.2;
    pointer-events: none;
    filter: grayscale(1);
}

/* Professional Watermark Layout */
.qs-sub-group-pro {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
    transition: 0.3s all;
}

.pro-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    transition: 0.2s;
}
.pro-input:focus { border-color: var(--primary); outline: none; }

.pro-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.pro-select {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    padding: 8px 12px;
    font-size: 0.85rem;
    cursor: pointer;
}

.color-picker-wrapper {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
    background: var(--bg-card);
}

.color-picker-wrapper input[type="color"] {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 60px;
    height: 60px;
    cursor: pointer;
    border: none;
    padding: 0;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .qs-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .quick-settings { padding: 1.25rem; }
}

/* Comparison Modal & Slider */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: all 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.1);
}

.comparison-container {
    width: 90%;
    max-width: 1000px;
    background: #0f172a;
    border: 1px solid var(--border-highlight);
    border-radius: 24px;
    padding: 2rem;
    position: relative;
    box-shadow: 0 50px 100px -20px rgba(0,0,0,0.8);
}

.modal-close {
    position: absolute;
    top: 1.5rem; left: 1.5rem;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 100;
}
.modal-close:hover { background: #f43f5e; }

.comparison-slider {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
    border-radius: 16px;
    background: #1e293b;
    user-select: none;
    touch-action: none;
    margin-top: 2rem;
}

.img-wrapper {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}

.img-wrapper img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
}

.img-wrapper.modified {
    width: 50%;
    z-index: 2;
    overflow: hidden;
    border-left: 2px solid var(--primary);
}

.img-label {
    position: absolute;
    bottom: 20px;
    padding: 8px 16px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    color: white;
    font-size: 0.85rem;
    border-radius: 8px;
    font-weight: 600;
}
.original .img-label { left: 20px; }
.modified .img-label { right: 20px; }

.slider-handle {
    position: absolute;
    top: 0; bottom: 0;
    left: 50%;
    width: 4px;
    background: var(--primary);
    transform: translateX(-50%);
    cursor: ew-resize;
    z-index: 10;
}

.handle-circle {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 48px; height: 48px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 20px var(--primary-glow);
}

.comparison-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}

.comparison-stats div {
    font-size: 1rem;
    font-weight: 600;
}

#comp-stats-save { color: #10b981; }

@media (max-width: 768px) {
    .comparison-slider { height: 350px; }
    .comparison-stats { gap: 1rem; flex-direction: column; align-items: center; }
}

.btn-compare {
    background: rgba(139, 92, 246, 0.15) !important;
    color: var(--primary) !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
}
.btn-compare:hover {
    background: var(--primary) !important;
    color: white !important;
}

/* ===================================
   TOOL PAGES MOBILE RESPONSIVENESS
   =================================== */

/* Common Tool Page Styles */
.tool-container,
.editor-container,
.compress-container,
.palette-container,
.pdf-container,
.remove-bg-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Upload Area */
.upload-area,
.drop-zone {
    padding: 3rem 1.5rem;
    text-align: center;
}

/* Workspace */
.workspace {
    padding: 1.5rem;
}

/* Controls */
.controls,
.control-panel {
    padding: 1rem;
}

/* Mobile Styles for Tool Pages */
@media (max-width: 768px) {
    /* Tool Container */
    .tool-container,
    .editor-container,
    .compress-container,
    .palette-container,
    .pdf-container,
    .remove-bg-container {
        padding: 1rem;
        min-height: auto;
    }

    /* Upload Area Mobile */
    .upload-area,
    .drop-zone {
        padding: 2rem 1rem;
        border-radius: 16px;
    }

    .upload-area h3,
    .drop-zone h3 {
        font-size: 1.1rem;
    }

    .upload-icon {
        width: 48px;
        height: 48px;
    }

    /* Workspace Mobile */
    .workspace {
        padding: 1rem;
        border-radius: 16px;
    }

    /* Image Preview */
    .preview-compare {
        flex-direction: column;
        gap: 1rem;
    }

    .img-col {
        min-width: 100%;
    }

    .img-preview {
        max-height: 200px;
    }

    /* Controls Mobile */
    .controls,
    .control-panel {
        padding: 1rem;
        border-radius: 12px;
    }

    .controls .slider-container,
    .control-panel .slider-container {
        flex-direction: column;
        gap: 0.5rem;
    }



    /* Palette Grid Mobile */
    .palette-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }

    .color-card {
        padding: 0.75rem;
    }

    .color-preview {
        height: 60px;
    }

    /* Image Editor Mobile */
    .img-container {
        max-height: 40vh;
    }

    .toolbar {
        padding: 0.75rem;
        gap: 8px;
    }

    .tool-btn {
        width: 40px;
        height: 40px;
    }

    .tool-btn.btn-text,
    .save-btn {
        padding: 0 1rem;
        font-size: 0.9rem;
    }

    /* PDF Preview Grid Mobile */
    .preview-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }

    .preview-card {
        padding: 0.5rem;
    }

    .preview-card img {
        max-height: 100px;
    }

    /* Action Bar Mobile */
    .action-bar {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
    }

    /* Remove BG Specific */
    .compare-container {
        flex-direction: column;
        gap: 1rem;
    }

    .compare-panel {
        min-height: 200px;
    }

    /* Footer in Tools */
    .app-footer .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }

    .footer-col {
        text-align: center;
    }

    .f-links {
        justify-content: center;
    }

    .footer-social {
        justify-content: center;
    }
}

/* Extra Small Devices (below 480px) */
@media (max-width: 480px) {
    .tool-container,
    .editor-container,
    .compress-container,
    .palette-container,
    .pdf-container,
    .remove-bg-container {
        padding: 0.75rem;
    }

    .upload-area,
    .drop-zone {
        padding: 1.5rem 0.75rem;
    }

    .section-title {
        font-size: 1.3rem !important;
    }

    .palette-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .preview-grid {
        grid-template-columns: 1fr !important;
    }

    .toolbar {
        flex-wrap: wrap;
        justify-content: center;
    }


}

/* ===================================
   UNIFIED BUTTON SYSTEM
   =================================== */

/* Base Button Styles */
button,
.btn,
.cta-btn,
.main-action-btn,
.btn-primary,
.btn-secondary,
.nav-btn,
.tool-btn {
    font-family: 'Cairo', system-ui, sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

/* Primary Action Button */
.main-action-btn,
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: white;
    padding: 14px 28px;
    border-radius: 14px;
    font-size: 1rem;
    min-height: 52px;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.35);
}

.main-action-btn:hover,
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.45);
}

.main-action-btn:active,
.btn-primary:active {
    transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    min-height: 48px;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Icon Button (nav-btn, tool-btn) */
.nav-btn,
.tool-btn {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.nav-btn:hover,
.tool-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* Text Button with Icon */
.btn-text,
.tool-btn.btn-text {
    width: auto;
    padding: 12px 20px;
    font-size: 0.95rem;
}

/* ===================================
   TYPOGRAPHY IMPROVEMENTS
   =================================== */

/* Section Titles */
.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Subtitles / Descriptions */
.section-desc,
.secondary-text {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
    text-align: center;
    max-width: 600px;
    margin: 0 auto 2rem auto;
}

/* Labels */
label,
.label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: block;
}

/* ===================================
   SPACING & LAYOUT IMPROVEMENTS
   =================================== */

/* Consistent Section Spacing */
section,
.tool-section {
    padding: 2rem 0;
}

/* Card Spacing */
.card,
.info-card,
.feature-item {
    padding: 1.5rem;
    border-radius: 16px;
}

/* Input Fields */
input[type="text"],
input[type="url"],
input[type="email"],
input[type="tel"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: 'Cairo', system-ui, sans-serif;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-main);
    transition: all 0.25s ease;
    min-height: 52px;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

/* Slider Styling */
input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

/* ===================================
   MOBILE BUTTON & SPACING FIXES
   =================================== */

@media (max-width: 768px) {
    /* Larger Touch Targets */
    .main-action-btn,
    .btn-primary {
        padding: 16px 24px;
        font-size: 1rem;
        min-height: 56px;
        width: 100%;
    }

    .btn-secondary {
        padding: 14px 20px;
        min-height: 52px;
        width: 100%;
    }

    .nav-btn,
    .tool-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    /* Typography Mobile */
    .section-title {
        font-size: 1.4rem;
    }

    .section-desc,
    .secondary-text {
        font-size: 0.95rem;
    }

    /* Input Fields Mobile */
    input[type="text"],
    input[type="url"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    textarea,
    select {
        padding: 12px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 50px;
    }

    /* Spacing Mobile */
    section,
    .tool-section {
        padding: 1.5rem 0;
    }

    .card,
    .info-card,
    .feature-item {
        padding: 1.25rem;
    }

    /* Gap Adjustments */
    .cta-group {
        gap: 0.75rem;
    }

    .badges {
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .main-action-btn,
    .btn-primary {
        padding: 14px 20px;
        font-size: 0.95rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .card,
    .info-card {
        padding: 1rem;
    }
}

/* ===================================
   UPLOAD ICON STYLING (Used across tool pages)
   =================================== */

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem auto;
    color: var(--primary);
    opacity: 0.8;
    display: block;
    transition: all 0.3s var(--ease-out);
}

.upload-area:hover .upload-icon {
    opacity: 1;
    transform: scale(1.1);
    color: var(--primary);
}

@media (max-width: 640px) {
    .upload-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 1rem;
    }
}

/* ===================================
   IMPROVED FORMAT CARDS MOBILE
   =================================== */

@media (max-width: 640px) {
    .format-cards {
        scroll-behavior: smooth;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .format-cards::-webkit-scrollbar {
        display: none;
    }
    
    /* Prevent body overflow from horizontal scroll */
    .hero-section {
        overflow-x: hidden;
    }
}

/* ===================================
   MOBILE HEADER IMPROVEMENTS
   =================================== */

@media (max-width: 768px) {
    .app-header {
        padding: 0.75rem 1rem;
        top: 0.5rem;
        margin: 0 0.5rem;
        width: calc(100% - 1rem);
    }
    
    .logo {
        font-size: 1rem;
    }
    
    .logo img {
        width: 24px;
        height: 24px;
    }
}

/* ===================================
   COMPREHENSIVE TOOL PAGES MOBILE FIX
   =================================== */

/* Tool Page Buttons - Consistent Styling */
.tool-page-btn,
.tools-panel .tool-btn,
.workspace .nav-btn,
.workspace .cta-btn {
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.25s ease;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
}

/* Tools Panel Mobile */
@media (max-width: 768px) {
    .tools-panel {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .tools-panel > div {
        width: 100%;
    }
    
    .tools-panel .tool-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Color Options */
    .color-opts {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    /* Image Boxes - Results Container */
    .results-container {
        gap: 1rem;
    }
    
    .img-box {
        min-height: 200px;
        border-radius: 12px;
    }
    
    .box-label {
        font-size: 0.75rem;
        padding: 3px 10px;
    }
    
    /* Workspace */
    .workspace {
        padding: 1rem;
        border-radius: 16px;
    }
    
    /* Preview Compare */
    .preview-compare {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .img-col {
        min-width: 100%;
    }
    
    .img-preview {
        max-height: 200px;
        border-radius: 10px;
    }
    
    /* Controls */
    .controls {
        padding: 1rem;
        border-radius: 12px;
    }
    
    /* Action Buttons Container */
    .workspace > div:last-child,
    #results-area > div:last-child {
        flex-direction: column;
        gap: 0.75rem !important;
    }
    
    .workspace > div:last-child button,
    #results-area > div:last-child button,
    .compress-container button,
    .editor-container button,
    .palette-container button,
    .pdf-container button,
    .remove-bg-container button {
        width: 100%;
        padding: 14px 20px;
        font-size: 1rem;
    }
    
    /* Upload Area Mobile */
    .upload-area {
        padding: 2.5rem 1rem;
    }
    
    .upload-area h3 {
        font-size: 1.1rem;
    }
    

    
    /* Settings Grid */
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    /* Magic/Manual Tool Buttons */
    .tools-panel > div:first-child {
        display: flex;
        gap: 8px;
        width: 100%;
    }
    
    .tools-panel > div:first-child .tool-btn {
        flex: 1;
    }
    
    /* Slider Controls */
    #magic-controls,
    #manual-controls {
        min-width: 100% !important;
    }
    
    /* Model Notice */
    .model-notice {
        font-size: 0.8rem;
        padding: 0.75rem;
        margin-top: 1rem;
    }
    
    /* Editor Toolbar */
    .toolbar {
        padding: 0.75rem;
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .toolbar .tool-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }
    
    .toolbar .save-btn {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    /* Image Container */
    .img-container {
        max-height: 50vh;
    }
    
    /* PDF Preview Grid */
    .preview-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .img-card {
        padding: 4px;
    }
    
    .img-card img {
        height: 100px;
    }
    
    .img-number {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }
    
    /* Palette Grid */
    .palette-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }
    
    .color-preview {
        height: 80px;
    }
    
    .color-info {
        padding: 0.75rem;
    }
    
    .hex-code {
        font-size: 0.95rem;
    }
}

/* Extra Small Devices */
@media (max-width: 480px) {
    .upload-area {
        padding: 2rem 0.75rem;
    }
    
    .tools-panel {
        padding: 0.75rem;
    }
    
    .workspace {
        padding: 0.75rem;
    }
    
    .toolbar .tool-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
    
    .preview-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .img-card img {
        height: 80px;
    }
    

    
    /* Even smaller font for notices */
    .model-notice {
        font-size: 0.75rem;
    }
}

/* ===================================
   REFINED DESIGN SYSTEM - ELEGANT & COMPACT
   =================================== */

/* Refined Section Titles */
.section-title {
    font-size: var(--font-2xl) !important;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-md);
}

/* Refined Section Descriptions */
.section-desc,
.secondary-text,
main > p {
    font-size: var(--font-sm) !important;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: var(--space-lg);
}

/* Refined Buttons - Compact & Elegant */
.main-action-btn,
.btn-primary,
.download-btn {
    padding: 10px 20px !important;
    font-size: var(--font-sm) !important;
    font-weight: 600;
    border-radius: var(--radius-md) !important;
    min-height: 40px !important;
    box-shadow: var(--shadow-sm);
}

.btn-secondary,
.nav-btn,
.tool-btn {
    padding: 8px 14px !important;
    font-size: var(--font-xs) !important;
    border-radius: var(--radius-sm) !important;
    min-height: 36px !important;
}

/* Refined Icon Buttons */
.nav-btn,
.tool-btn:not(.btn-text) {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
}

/* Refined Upload Area */
.upload-area {
    padding: 2rem 1.5rem !important;
    border-radius: var(--radius-lg) !important;
    border-width: 1.5px !important;
}

.upload-area h3 {
    font-size: var(--font-md) !important;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.upload-icon {
    width: 48px !important;
    height: 48px !important;
    margin-bottom: var(--space-md) !important;
    opacity: 0.7;
}

/* Refined Workspace */
.workspace {
    padding: var(--space-lg) !important;
    border-radius: var(--radius-lg) !important;
}

/* Refined Controls */
.controls,
.tools-panel {
    padding: var(--space-md) !important;
    border-radius: var(--radius-md) !important;
    gap: var(--space-sm) !important;
}

/* Refined Labels */
label,
.label {
    font-size: var(--font-xs) !important;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

/* Refined Inputs */
input[type="text"],
input[type="url"],
input[type="email"],
input[type="tel"],
input[type="password"],
textarea,
select,
.custom-input,
.custom-select {
    padding: 10px 12px !important;
    font-size: 14px !important;
    min-height: 40px !important;
    border-radius: var(--radius-sm) !important;
}

/* Refined Cards */
.card,
.info-card,
.feature-item {
    padding: var(--space-lg) !important;
    border-radius: var(--radius-md) !important;
}

/* ===================================
   MOBILE REFINEMENTS (375px viewport)
   =================================== */

@media (max-width: 768px) {
    /* Smaller base font */
    html {
        font-size: 15px;
    }
    
    /* Compact Header */
    .app-header {
        padding: 0.5rem 0.75rem !important;
        border-radius: var(--radius-lg) !important;
        top: 0.5rem;
        margin: 0 0.5rem;
        width: calc(100% - 1rem);
    }
    
    .logo {
        font-size: var(--font-md) !important;
        gap: 0.5rem !important;
    }
    
    .logo img {
        width: 22px !important;
        height: 22px !important;
    }
    
    /* Compact Menu Toggle */
    .menu-toggle span {
        width: 18px;
        height: 1.5px;
    }
    
    /* Refined Section Titles - Mobile */
    .section-title {
        font-size: var(--font-xl) !important;
    }
    
    /* Refined Buttons - Mobile Compact */
    .main-action-btn,
    .btn-primary,
    .download-btn {
        padding: 10px 16px !important;
        font-size: var(--font-sm) !important;
        min-height: 38px !important;
        width: 100%;
    }
    
    .btn-secondary {
        padding: 8px 12px !important;
        font-size: var(--font-xs) !important;
        min-height: 34px !important;
    }
    
    /* Compact Tool Buttons */
    .tool-btn:not(.btn-text) {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
    }
    
    .tool-btn.btn-text,
    .save-btn {
        padding: 8px 14px !important;
        font-size: var(--font-xs) !important;
    }
    
    /* Compact Upload Area */
    .upload-area {
        padding: 1.5rem 1rem !important;
    }
    
    .upload-area h3 {
        font-size: var(--font-sm) !important;
    }
    
    .upload-icon {
        width: 40px !important;
        height: 40px !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Compact Workspace */
    .workspace {
        padding: 0.75rem !important;
    }
    
    /* Compact Controls */
    .controls,
    .tools-panel {
        padding: 0.75rem !important;
    }
    
    /* Size Labels/Badges */
    .size-badge {
        font-size: var(--font-xs) !important;
        padding: 2px 8px !important;
    }
    
    /* Preview Images */
    .img-preview {
        max-height: 160px !important;
        border-radius: var(--radius-sm) !important;
    }
    
    /* Tabs */
    .tab-btn {
        padding: 6px 12px !important;
        font-size: var(--font-xs) !important;
        border-radius: var(--radius-sm) !important;
    }
    

    
    /* Settings Grid */
    .settings-grid {
        gap: 8px !important;
    }
    
    .color-picker {
        padding: 8px !important;
        border-radius: var(--radius-sm) !important;
    }
    
    input[type="color"] {
        width: 28px !important;
        height: 28px !important;
    }
    
    /* Footer Compact */
    .app-footer {
        padding: 1.5rem 1rem !important;
    }
    
    .footer-grid {
        gap: 1.25rem !important;
    }
    
    .footer-col h3 {
        font-size: var(--font-sm) !important;
        margin-bottom: 0.5rem !important;
    }
    
    .footer-col p,
    .f-links a {
        font-size: var(--font-xs) !important;
    }
    
    .footer-bottom {
        font-size: var(--font-xs) !important;
        padding-top: 1rem !important;
        margin-top: 1rem !important;
    }
    
    /* Notices */
    .model-notice {
        font-size: var(--font-xs) !important;
        padding: 0.5rem 0.75rem !important;
    }
    
    /* Results Container */
    .results-container {
        gap: 0.75rem !important;
    }
    
    .img-box {
        min-height: 150px !important;
    }
    
    .box-label {
        font-size: 0.65rem !important;
        padding: 2px 8px !important;
    }
    
    /* Savings Badge */
    .savings-badge {
        font-size: var(--font-xs) !important;
    }
    
    /* Mobile Navigation Drawer */
    .nav-links {
        padding-top: 4rem !important;
        gap: 0.75rem !important;
    }
    
    .nav-link {
        font-size: var(--font-sm) !important;
        padding: 0.6rem 1rem !important;
    }
    
    /* Toolbar */
    .toolbar {
        padding: 0.5rem !important;
        gap: 4px !important;
    }
}

/* Extra Small Devices (320px-375px) */
@media (max-width: 375px) {
    html {
        font-size: 14px;
    }
    
    .section-title {
        font-size: var(--font-lg) !important;
    }
    
    .upload-area {
        padding: 1.25rem 0.75rem !important;
    }
    
    .upload-icon {
        width: 36px !important;
        height: 36px !important;
    }
    
    .main-action-btn,
    .btn-primary {
        padding: 8px 14px !important;
        font-size: var(--font-xs) !important;
        min-height: 36px !important;
    }
    

}

/* ------------------------------------------------------------- 
   PREMIUM GLASS UI REBUILD (2026) 
   ------------------------------------------------------------- */

/* Main Container */
.glass-panel {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 2rem 1rem !important;
    max-width: 900px;
    margin: 0 auto;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Typography */
.animate-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-desc {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.7);
    max-width: 600px;
    margin: 0 auto 3rem auto;
    line-height: 1.6;
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s backwards;
}

/* Drop Zone Container */
.drop-zone-container.glass-morphism {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 2rem;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    animation: zoomIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s backwards;
}
.drop-zone-container.drag-over {
    border-color: var(--primary);
    background: rgba(124, 58, 237, 0.1);
    transform: scale(1.02);
}

/* Format Selection */
.format-selection {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

/* Glass Buttons */
.glass-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    padding: 1.5rem;
    width: 140px;
    height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-10px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 40px -5px rgba(0,0,0,0.3);
}

/* Icon Glows */
.icon-glow {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    color: rgba(255,255,255,0.8);
    transition: 0.3s;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

.glass-btn:hover .icon-glow {
    transform: scale(1.1);
    color: #fff;
}
.glass-btn:hover .webp-glow { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; box-shadow: 0 0 30px rgba(139, 92, 246, 0.4); }
.glass-btn:hover .png-glow { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; box-shadow: 0 0 30px rgba(56, 189, 248, 0.4); }
.glass-btn:hover .jpg-glow { background: rgba(251, 146, 60, 0.2); color: #fdba74; box-shadow: 0 0 30px rgba(251, 146, 60, 0.4); }

.fmt-name { font-size: 1.25rem; font-weight: 700; color: white; margin-bottom: 4px; }
.fmt-tag { font-size: 0.8rem; color: rgba(255,255,255,0.5); font-weight: 500; }

.drop-hint { margin-top: 1rem; color: rgba(255,255,255,0.4); font-size: 0.9rem; }

/* Floating Controls - REFINED (Now Embedded) */
.floating-controls {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    z-index: 10 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 0;
    margin-top: 2rem;
    animation: zoomIn 0.4s ease;
}
/* مركز التحكم الموحد - Unified Control Center */
.floating-controls {
    width: 100%;
    max-width: 700px;
    margin: 2rem auto;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 28px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.6);
    animation: zoomIn 0.4s var(--ease-out);
    position: relative;
    z-index: 10;
}
.floating-controls.hidden { display: none !important; }

.glass-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
}
.glass-settings.hidden { display: none; }

.qs-row { display: flex; align-items: center; gap: 1rem; }
.qs-row label { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }
.qs-row input[type="range"] { 
    width: 120px; 
    height: 4px;
    background: rgba(255,255,255,0.1);
}

.check-label { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    cursor: pointer; 
    color: white; 
    font-weight: 600; 
    font-size: 0.9rem;
    background: rgba(255,255,255,0.05);
    padding: 6px 14px;
    border-radius: 12px;
    transition: 0.2s;
}
.check-label:hover { background: rgba(255,255,255,0.1); }

.mini-input { 
    background: rgba(0,0,0,0.3); 
    border: 1px solid rgba(255,255,255,0.1); 
    color: white; 
    border-radius: 8px; 
    padding: 6px 10px; 
    width: 70px; 
    text-align: center;
    font-size: 0.85rem;
    outline: none;
    transition: 0.2s;
}
.mini-input:focus { border-color: var(--primary); background: rgba(0,0,0,0.5); }

/* New Action Bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    animation: fadeIn 0.4s ease;
}

.status-box { display: flex; align-items: center; gap: 1rem; }
.progress-ring { position: relative; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.ring-svg { transform: rotate(-90deg); }
.ring-circle-bg { stroke: rgba(255,255,255,0.05); }
.ring-circle-fg { 
    stroke: var(--success); 
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease;
}

.status-text { display: flex; flex-direction: column; line-height: 1.3; }
#status-msg { font-weight: 700; color: white; font-size: 1rem; letter-spacing: -0.01em; }
#file-count { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

.action-buttons { display: flex; align-items: center; gap: 12px; }

.glass-btn-sm {
    background: rgba(255,255,255,0.05); 
    border: 1px solid rgba(255,255,255,0.1); 
    color: rgba(255,255,255,0.7);
    padding: 0.7rem 1.4rem; 
    border-radius: 16px; 
    font-weight: 700; 
    cursor: pointer; 
    transition: 0.2s;
    font-size: 0.9rem;
}
.glass-btn-sm:hover { 
    background: rgba(255,255,255,0.1); 
    color: white; 
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

.main-action-btn {
    background: white; 
    color: black; 
    border: none;
    padding: 0.75rem 1.75rem; 
    border-radius: 18px;
    font-weight: 800; 
    display: flex; 
    align-items: center; 
    gap: 10px;
    cursor: pointer; 
    box-shadow: 0 10px 20px -5px rgba(255,255,255,0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 0.95rem;
}
.main-action-btn:hover { 
    transform: scale(1.03) translateY(-2px); 
    box-shadow: 0 15px 25px -5px rgba(255,255,255,0.3);
}
.main-action-btn svg { stroke-width: 3; }

/* Mobile Optimizations */
@media (max-width: 600px) {
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        position: relative;
        margin: 0;
        padding: 0;
    }

    .floating-controls {
        padding: 0.75rem;
        border-radius: 16px;
        width: 95%;
        margin: 0.75rem auto;
        gap: 0.6rem;
        box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.4);
        animation: fadeIn 0.3s ease;
        box-sizing: border-box;
    }
    
    .glass-settings {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding-bottom: 0.6rem;
    }
    
    .qs-row {
        justify-content: space-between;
        gap: 0.4rem;
    }
    
    .qs-row label { font-size: 0.75rem; }
    
    .qs-row input[type="range"] {
        flex: 1;
        max-width: 90px;
        height: 2px;
    }

    .check-label {
        padding: 2px 6px;
        font-size: 0.8rem;
        border-radius: 6px;
    }

    .mini-input {
        padding: 2px 4px;
        width: 48px;
        font-size: 0.75rem;
    }
    
    .action-bar {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
        padding: 0;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        width: 100% !important;
        box-sizing: border-box;
    }
    
    .status-box {
        justify-content: center;
        text-align: center;
        gap: 0.4rem;
        width: 100%;
        margin-bottom: 0.2rem;
    }

    .progress-ring { width: 28px; height: 28px; }

    .status-text #status-msg { font-size: 0.8rem; font-weight: 600; }
    .status-text #file-count { font-size: 0.65rem; }
    
    .action-buttons {
        display: flex;
        flex-direction: row;
        gap: 6px;
        width: 100%;
        justify-content: center;
    }
    
    /* Reset inherited padding from .btn-text at 2306 */
    .action-buttons .btn-text {
        padding: 0 !important;
        display: inline !important;
        height: auto !important;
        white-space: nowrap !important;
        font-size: 0.82rem !important;
    }

    .glass-btn-sm {
        padding: 0.4rem 0.6rem !important;
        border-radius: 10px;
        font-size: 0.8rem;
        white-space: nowrap;
        flex: 1;
        max-width: 80px;
    }
    
    .main-action-btn {
        padding: 0.5rem 0.85rem !important;
        border-radius: 12px;
        flex: 2;
        min-height: 40px !important;
        max-width: 180px;
        justify-content: center;
        height: 40px !important; /* Force reasonable height */
    }

    .main-action-btn svg { width: 14px; height: 14px; }

    /* Performance & Stability */
    .ambient-light { display: none !important; }
}

/* Hard fix for layout shifts and text wrapping on tiny screens */
@media (max-width: 350px) {
    .btn-text { font-size: 0.75rem !important; }
    .status-text #status-msg { font-size: 0.75rem; }
}

/* Action Buttons Container - Responsive (Fix for detailed view) */
.action-buttons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 2rem;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .action-buttons-container {
        flex-direction: column;
        width: 100%;
        gap: 12px;
        padding: 0 1rem;
    }

    /* Force buttons to be centered and reasonable width on mobile */
    .action-buttons-container .cta-btn,
    .action-buttons-container .main-action-btn {
        width: 100% !important; /* Full width for better UX */
        max-width: 300px; /* But not too wide on tablets */
        margin: 0 auto !important;
        justify-content: center;
        display: flex !important;
    }
}
