/* ============================================
   WebPify - Enhanced Image Converter
   Premium Modern CSS Design System
   ============================================ */

/* ============================================
   CSS Variables (Design Tokens)
   ============================================ */
:root {
    /* Primary Colors - Premium Purple/Violet */
    --primary-50: #faf5ff;
    --primary-100: #f3e8ff;
    --primary-200: #e9d5ff;
    --primary-300: #d8b4fe;
    --primary-400: #c084fc;
    --primary-500: #a855f7;
    --primary-600: #9333ea;
    --primary-700: #7c3aed;
    --primary-800: #6b21a8;
    --primary-900: #581c87;

    /* Accent - Cyan/Teal */
    --accent-400: #22d3ee;
    --accent-500: #06b6d4;
    --accent-600: #0891b2;

    /* Success/Error */
    --success-500: #22c55e;
    --error-500: #ef4444;

    /* Neutrals */
    --gray-50: #fafafa;
    --gray-100: #f4f4f5;
    --gray-200: #e4e4e7;
    --gray-300: #d4d4d8;
    --gray-400: #a1a1aa;
    --gray-500: #71717a;
    --gray-600: #52525b;
    --gray-700: #3f3f46;
    --gray-800: #27272a;
    --gray-900: #18181b;
    --gray-950: #09090b;

    /* Background */
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-tertiary: #18181f;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);

    /* Text */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #a855f7 0%, #06b6d4 100%);
    --gradient-hero: radial-gradient(ellipse at 50% 0%, rgba(168, 85, 247, 0.15) 0%, transparent 50%);
    --gradient-card: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    --gradient-glow: radial-gradient(circle, rgba(168, 85, 247, 0.4) 0%, transparent 70%);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 60px rgba(168, 85, 247, 0.3);
    --shadow-glow-sm: 0 0 30px rgba(168, 85, 247, 0.2);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Container */
    --container-max: 1200px;
    --container-padding: 24px;
}

/* ============================================
   Reset & Base
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input,
select {
    font-family: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ============================================
   Container
   ============================================ */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* ============================================
   Typography
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md), var(--shadow-glow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
    border-radius: var(--radius-xl);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   Header
   ============================================ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 16px 0;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 800;
    transition: transform var(--transition-fast);
}

.logo:hover {
    transform: scale(1.02);
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    display: block;
}

.nav {
    display: flex;
    gap: 32px;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 15px;
    transition: color var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

@media (max-width: 768px) {
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: var(--bg-secondary);
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .nav.active {
        display: flex;
    }

    .nav-link {
        padding: 16px 24px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .mobile-menu-btn {
        display: flex;
    }

    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 120px 0 80px;
    position: relative;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: var(--gradient-hero);
    pointer-events: none;
}

.hero-bg::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: var(--gradient-glow);
    filter: blur(100px);
    opacity: 0.5;
}

.hero-content {
    position: relative;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    animation: fadeInUp 0.8s ease-out;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.badge-dot {
    width: 8px;
    height: 8px;
    background: var(--success-500);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.hero-title {
    font-size: clamp(36px, 6vw, 72px);
    font-weight: 800;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.hero-title-sub {
    display: block;
    font-size: clamp(24px, 4vw, 42px);
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 8px;
}

.hero-description {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

.hero-cta {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-top: 64px;
    padding-top: 48px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 36px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
}

@media (max-width: 640px) {
    .hero {
        padding: 100px 0 60px;
    }

    .hero-stats {
        gap: 24px;
    }

    .stat-value {
        font-size: 28px;
    }
}

/* ============================================
   Section Headers
   ============================================ */
.section-header {
    text-align: center;
    margin-bottom: 64px;
}

.section-badge {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.section-title {
    font-size: clamp(28px, 4vw, 44px);
    margin-bottom: 16px;
}

.section-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   Converter Section
   ============================================ */
.converter-section {
    padding: 80px 0 120px;
}

/* Upload Area */
.upload-area {
    max-width: 800px;
    margin: 0 auto;
    padding: 64px 32px;
    background: var(--gradient-card);
    border: 2px dashed rgba(168, 85, 247, 0.3);
    border-radius: var(--radius-2xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-500);
    background: rgba(168, 85, 247, 0.05);
    box-shadow: var(--shadow-glow-sm);
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    margin-bottom: 24px;
    color: var(--primary-400);
    animation: float 3s ease-in-out infinite;
}

.upload-title {
    font-size: 24px;
    margin-bottom: 8px;
}

.upload-subtitle {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.upload-formats {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.format-badge {
    padding: 6px 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ============================================
   Editor Panel
   ============================================ */
.editor-panel {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-2xl);
    overflow: visible;
}

/* Toolbar - Sticky */
.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-wrap: wrap;
    gap: 12px;
    position: sticky;
    top: 65px;
    /* Below fixed header */
    z-index: 100;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

.toolbar-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    flex: 1;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.btn-icon:hover:not(:disabled) {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.tab-btn.active {
    color: var(--text-primary);
    background: var(--primary-600);
}

.tab-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Hide text on small screens, show only icons */
@media (max-width: 600px) {
    .tab-btn {
        padding: 10px 12px;
        font-size: 0;
    }

    .tab-btn svg {
        width: 20px;
        height: 20px;
    }

    .editor-toolbar {
        padding: 10px 16px;
        top: 60px;
    }

    #newImageBtn span {
        display: none;
    }

    #newImageBtn {
        padding: 10px 12px;
    }
}

/* Editor Content */
.editor-content {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    padding: 24px;
}

@media (max-width: 900px) {
    .editor-content {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .control-panels {
        order: -1;
        /* Show controls before preview on mobile */
    }
}

/* Preview Area */
.preview-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.preview-container {
    position: relative;
    background: repeating-conic-gradient(var(--gray-800) 0% 25%,
            var(--gray-900) 0% 50%) 50% / 20px 20px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.preview-container.drag-over {
    border-color: var(--primary-500);
    box-shadow: var(--shadow-glow-sm);
    background: repeating-conic-gradient(var(--gray-700) 0% 25%,
            var(--gray-800) 0% 50%) 50% / 20px 20px;
}

.preview-container canvas {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
}

.image-info {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.image-info .info-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.image-info .info-group span {
    padding: 4px 10px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.image-info .info-label {
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent !important;
    padding: 0 !important;
}

.image-info .info-separator {
    color: var(--primary-400);
    font-size: 16px;
    font-weight: bold;
}

.image-info .info-group.edited span:not(.info-label) {
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: var(--primary-300);
}

@media (max-width: 600px) {
    .image-info {
        flex-direction: column;
        gap: 8px;
    }

    .image-info .info-separator {
        transform: rotate(90deg);
    }
}

/* Control Panels */
.control-panels {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-panel {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xl);
    padding: 24px;
}

.panel-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.panel-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Format Grid */
.format-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 24px;
}

.format-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 8px;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.format-btn:hover {
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.format-btn.active {
    background: var(--primary-600);
    color: white;
    border-color: var(--primary-500);
}

.format-icon {
    font-size: 20px;
}

@media (max-width: 500px) {
    .format-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Quality Control */
.quality-control {
    margin-top: 16px;
}

.control-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 500;
}

.quality-value {
    color: var(--primary-400);
    font-weight: 700;
}

/* Slider */
.slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--gray-700);
    border-radius: var(--radius-full);
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Resize Panel */
.resize-inputs {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 20px;
}

.input-group {
    flex: 1;
    min-width: 0;
}

.input-group label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.input-with-unit {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    overflow: hidden;
    width: 100%;
}

.input-with-unit input {
    flex: 1;
    min-width: 0;
    padding: 12px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    width: 100%;
}

.input-with-unit input::-webkit-outer-spin-button,
.input-with-unit input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-with-unit input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.input-with-unit .unit {
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 13px;
    flex-shrink: 0;
}

.link-btn {
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    transition: all var(--transition-fast);
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 0;
}

.link-btn:hover {
    color: var(--text-primary);
}

.link-btn.active {
    color: var(--primary-400);
    border-color: var(--primary-500);
}

@media (max-width: 400px) {
    .resize-inputs {
        flex-wrap: wrap;
    }

    .resize-inputs .input-group {
        flex: 1 1 40%;
    }

    .resize-inputs .link-btn {
        order: -1;
        align-self: center;
        flex: 0 0 100%;
        display: flex;
        justify-content: center;
        margin-bottom: 8px;
    }
}

/* Presets */
.resize-presets,
.crop-presets,
.quality-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.preset-label {
    width: 100%;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.preset-btn {
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.preset-btn:hover {
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.preset-btn.active {
    background: var(--primary-600);
    color: white;
}

/* Edit Controls */
.edit-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.edit-slider label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.edit-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.edit-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.edit-btn:hover {
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.edit-btn:active {
    background: var(--primary-600);
    color: white;
}

.edit-actions,
.crop-actions {
    display: flex;
    gap: 12px;
}

.edit-actions .btn,
.crop-actions .btn {
    flex: 1;
}

/* Text Panel Controls */
.text-input-group {
    margin-bottom: 16px;
}

.text-input-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.text-field {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.text-field:focus {
    border-color: var(--primary-500);
    outline: none;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

.text-controls-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.text-control {
    flex: 1;
}

.text-control label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.font-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
}

.input-with-unit.compact {
    height: 40px;
}

.input-with-unit.compact input {
    padding: 8px 10px;
    font-size: 14px;
}

.input-with-unit.compact .unit {
    padding: 8px 10px;
    font-size: 12px;
}

.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
}

.color-picker-wrap input[type="color"] {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    background: none;
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: var(--radius-sm);
}

.color-picker-wrap span {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.text-style-btns {
    display: flex;
    gap: 6px;
}

.style-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.style-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.style-btn.active {
    background: var(--primary-600);
    color: white;
    border-color: var(--primary-500);
}

.text-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.text-actions .btn {
    flex: 1;
    min-width: 120px;
    white-space: nowrap;
}

/* Text Overlay on Canvas */
.text-overlay-box {
    position: absolute;
    cursor: move;
    user-select: none;
    border: 2px dashed transparent;
    padding: 4px 8px;
    transition: border-color 0.15s;
    z-index: 10;
}

.text-overlay-box:hover,
.text-overlay-box.active {
    border-color: var(--primary-500);
}

.text-overlay-box .resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--primary-500);
    border: 2px solid white;
    border-radius: 50%;
    cursor: se-resize;
    bottom: -6px;
    right: -6px;
    opacity: 0;
    transition: opacity 0.15s;
}

.text-overlay-box:hover .resize-handle,
.text-overlay-box.active .resize-handle {
    opacity: 1;
}

.text-overlay-box .delete-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-overlay-box:hover .delete-btn,
.text-overlay-box.active .delete-btn {
    opacity: 1;
}

/* Editing state */
.text-overlay-box.editing {
    border-color: var(--success-500);
    border-style: solid;
}

.text-overlay-box.editing span {
    cursor: text;
    min-width: 20px;
    display: inline-block;
}


/* Compress Panel */
.compression-info {
    margin-bottom: 24px;
}

.size-compare {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.size-item {
    text-align: center;
}

.size-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.size-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.size-value.highlight {
    color: var(--success-500);
}

.size-arrow {
    font-size: 20px;
    color: var(--text-muted);
}

.savings-bar {
    height: 8px;
    background: var(--gray-700);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 8px;
}

.savings-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    width: 0%;
    transition: width var(--transition-normal);
}

.savings-text {
    font-size: 13px;
    color: var(--success-500);
    text-align: center;
}

/* Crop Overlay */
.crop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.crop-box {
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    border: 2px solid white;
    background: transparent;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    cursor: move;
}

.crop-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.crop-handle.nw {
    top: -8px;
    left: -8px;
    cursor: nw-resize;
}

.crop-handle.ne {
    top: -8px;
    right: -8px;
    cursor: ne-resize;
}

.crop-handle.sw {
    bottom: -8px;
    left: -8px;
    cursor: sw-resize;
}

.crop-handle.se {
    bottom: -8px;
    right: -8px;
    cursor: se-resize;
}

/* Mobile touch improvements for crop */
.crop-box {
    touch-action: none;
}

@media (max-width: 768px) {
    .crop-handle {
        width: 32px;
        height: 32px;
    }

    .crop-handle.nw {
        top: -16px;
        left: -16px;
    }

    .crop-handle.ne {
        top: -16px;
        right: -16px;
    }

    .crop-handle.sw {
        bottom: -16px;
        left: -16px;
    }

    .crop-handle.se {
        bottom: -16px;
        right: -16px;
    }
}

/* Download Bar */
.download-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--bg-tertiary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    flex-wrap: wrap;
    gap: 16px;
}

.output-info {
    font-size: 14px;
    color: var(--text-secondary);
}

.output-info strong {
    color: var(--primary-400);
}

/* ============================================
   Features Section
   ============================================ */
.features-section {
    padding: 100px 0;
    background: var(--bg-secondary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.feature-card {
    padding: 32px;
    background: var(--gradient-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xl);
    transition: all var(--transition-normal);
}

.feature-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 40px;
    margin-bottom: 20px;
}

.feature-card h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ============================================
   How It Works Section
   ============================================ */
.how-section {
    padding: 100px 0;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
}

.step-card {
    text-align: center;
    padding: 40px 24px;
    background: var(--gradient-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xl);
    position: relative;
}

.step-number {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}

.step-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.step-card h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

.step-card p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============================================
   FAQ Section
   ============================================ */
.faq-section {
    padding: 100px 0;
    background: var(--bg-secondary);
}

.faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
    transition: color var(--transition-fast);
}

.faq-question:hover {
    color: var(--primary-400);
}

.faq-icon {
    font-size: 24px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
    color: var(--primary-400);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.faq-item.active .faq-answer {
    max-height: 300px;
}

.faq-answer p {
    padding-bottom: 24px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ============================================
   CTA Section
   ============================================ */
.cta-section {
    padding: 80px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: var(--gradient-glow);
    filter: blur(120px);
    opacity: 0.3;
}

.cta-content {
    position: relative;
}

.cta-content h2 {
    font-size: clamp(28px, 4vw, 40px);
    margin-bottom: 16px;
}

.cta-content p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    padding: 60px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    text-align: center;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 14px;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--text-primary);
}

.footer-copyright {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.8;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   Utilities
   ============================================ */
[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

::selection {
    background: var(--primary-500);
    color: white;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-600);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}