/* 
   Image Master Pro - Modern SaaS Design System
   Teal Gradient + Glassmorphism + Soft Shadows
*/

:root {
    /* Color Palette */
    --primary: #14b8a6;
    --primary-dark: #0d9488;
    --primary-light: #2dd4bf;
    --accent: #06b6d4;
    --surface-bg: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);

    /* Category Colors */
    --cat-convert: #f59e0b;
    --cat-edit: #8b5cf6;
    --cat-optimize: #10b981;
    --cat-generate: #ef4444;
    --cat-adjust: #3b82f6;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-teal: 0 10px 25px -5px rgba(20, 184, 166, 0.2);

    /* Transitions */
    --ease-fast: 150ms ease;
    --ease-base: 250ms ease;
    --ease-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] {
    --surface-bg: #0a0f1e;
    --card-bg: #0f172a;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #1e293b;
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(30, 41, 59, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--surface-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color var(--ease-base), color var(--ease-base);
}

h1,
h2,
h3,
h4,
.logo {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Scroll Progress */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--surface-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Navbar */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 1000;
    display: flex;
    align-items: center;
    transition: all var(--ease-base);
}

#navbar.scrolled {
    height: 64px;
    box-shadow: var(--shadow-md);
}

.nav-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color var(--ease-fast);
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--ease-base);
    border: none;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: var(--shadow-teal);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px -5px rgba(20, 184, 166, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--border);
}

.btn-pill {
    border-radius: 9999px;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Hero Section */
#hero {
    position: relative;
    padding-top: 140px;
    padding-bottom: 80px;
    min-height: 90vh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-bg-anim {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
    overflow: hidden;
}

.hero-bg-anim::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background-image: radial-gradient(circle at 50% 50%, var(--primary-light) 0%, transparent 20%);
    opacity: 0.15;
    filter: blur(100px);
    animation: drift 20s infinite linear;
}

@keyframes drift {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.hero-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 4rem;
    align-items: center;
}

.hero-content h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge-pill {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2rem;
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 600px;
}

.trust-badges {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    font-size: 0.875rem;
    color: var(--primary-dark);
    font-weight: 600;
}

.hero-btns {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Stats Bar */
#stats-bar {
    padding: 3rem 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.stats-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.stat-item {
    text-align: center;
}

.stat-num {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.stat-sep {
    width: 1px;
    height: 40px;
    background: var(--border);
}

/* Tools Grid */
#tools {
    padding: 100px 0;
}

.section-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 4rem;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: all var(--ease-fast);
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.tool-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    padding: 2rem;
    transition: all var(--ease-base);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.tool-icon {
    width: 56px;
    height: 56px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    transition: transform var(--spring);
}

.tool-card:hover .tool-icon {
    transform: rotate(10deg) scale(1.1);
}

.tool-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.tool-card p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.cat-badge {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    text-transform: uppercase;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 2rem;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn var(--ease-base) forwards;
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 2rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    opacity: 0;
}

.modal-overlay.active .modal-content {
    animation: modalSpring var(--spring) forwards;
}

@keyframes modalSpring {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

#modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Tool UI Elements */
.upload-area {
    border: 2px dashed var(--primary-light);
    border-radius: 1.5rem;
    padding: 4rem 2rem;
    text-align: center;
    transition: all var(--ease-base);
    background: rgba(20, 184, 166, 0.02);
    cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
    background: rgba(20, 184, 166, 0.08);
    border-color: var(--primary);
}

.workspace-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
}

.preview-container {
    background: #f1f5f9;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .preview-container {
    background: #1e293b;
}

canvas {
    max-width: 100%;
    max-height: 100%;
    box-shadow: var(--shadow-lg);
}

.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.875rem;
    font-weight: 600;
}

input[type="range"] {
    accent-color: var(--primary);
}

/* Toast System */
#toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--card-bg);
    border-left: 4px solid var(--primary);
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.3s forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hero-btns {
        justify-content: center;
    }

    .workspace-layout {
        grid-template-columns: 1fr;
    }

    .nav-links {
        display: none;
    }
}

@media (max-width: 640px) {
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        display: grid;
        gap: 2rem;
    }

    .stat-sep {
        display: none;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }
}

/* Meta Pages (About, Privacy, Contact) */
.meta-page {
    padding: 1rem 0;
}

.meta-page h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.meta-page h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}

.meta-page .lead {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.info-card {
    background: var(--surface-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.stack-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2rem;
}

.stack-item {
    background: var(--glass-bg);
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--glass-border);
}

.policy-section {
    margin-bottom: 2rem;
}

.alert-info {
    background: rgba(20, 184, 166, 0.1);
    color: var(--primary-dark);
    padding: 1rem;
    border-radius: 0.75rem;
    border-left: 4px solid var(--primary);
    margin-top: 2rem;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.contact-method {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.contact-method .icon {
    font-size: 1.5rem;
}

.contact-form-sim {
    background: var(--surface-bg);
    padding: 2rem;
    border-radius: 1.5rem;
    border: 1px solid var(--border);
}

@media (max-width: 768px) {

    .grid-2,
    .contact-grid {
        grid-template-columns: 1fr;
    }
}

/* Batch Mode Layout */
.batch-mode-layout {
    display: grid;
    grid-template-columns: 240px 1fr 300px;
    gap: 1.5rem;
    height: 600px;
}

.batch-sidebar {
    background: var(--surface-bg);
    border-radius: 1rem;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.batch-header {
    padding: 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    background: rgba(var(--primary-rgb), 0.05);
}

.batch-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.batch-thumb {
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    background: #000;
    aspect-ratio: 1;
}

.batch-thumb.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.2);
}

.batch-thumb canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
}

.batch-thumb.active canvas {
    opacity: 1;
}

.batch-thumb .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.batch-thumb:hover .remove-btn {
    opacity: 1;
}

.batch-actions {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.mt-2 {
    margin-top: 0.5rem;
}

@media (max-width: 1200px) {
    .batch-mode-layout {
        grid-template-columns: 200px 1fr;
    }

    .batch-mode-layout .controls-panel {
        grid-column: span 2;
    }
}