/* ============================================================
   ZAINIFY AI — Global Dark Premium Theme
   Clean, professional, high-end 2025-era SaaS design
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

:root {
    /* Brand Colors (Neon Vibe) */
    --primary:        #a855f7;   /* Neon Purple */
    --primary-dark:   #9333ea;
    --secondary:      #6366f1;   /* Neon Indigo */
    --accent:         #ec4899;   /* Neon Pink */

    /* Dark Theme Backgrounds */
    --bg-page:        #0B0E14;   /* Deep Dark Space */
    --bg-surface:     rgba(255, 255, 255, 0.03); /* Glass Panel */
    --bg-elevated:    rgba(255, 255, 255, 0.06);
    --bg-input:       rgba(0, 0, 0, 0.5);

    /* Text */
    --text-primary:   #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;
    --text-invert:    #0f172a;

    /* Borders */
    --border:         rgba(255, 255, 255, 0.08);
    --border-focus:   #a855f7;

    /* Status */
    --success:        #10b981;
    --success-light:  rgba(16, 185, 129, 0.15);
    --error:          #ef4444;
    --error-light:    rgba(239, 68, 68, 0.15);
    --warning:        #f59e0b;

    /* Shadows */
    --shadow-sm:   0 4px 12px rgba(0,0,0,0.5);
    --shadow-md:   0 8px 24px rgba(0,0,0,0.6);
    --shadow-lg:   0 16px 40px rgba(0,0,0,0.8);
    --shadow-xl:   0 24px 64px rgba(168, 85, 247, 0.15), 0 8px 24px rgba(0,0,0,0.8);
    --shadow-glow: 0 0 0 2px rgba(168, 85, 247, 0.3);

    /* Radius */
    --radius-sm:  8px;
    --radius:     12px;
    --radius-lg:  18px;
    --radius-xl:  24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: all 0.22s cubic-bezier(0.4,0,0.2,1);

    /* Layout */
    --max-width: 1200px;

    /* Legacy aliases (for backward compat) */
    --dark:       #0B0E14;
    --darker:     #000000;
    --light:      #f8fafc;
    --lighter:    #ffffff;
    --gray:       #94a3b8;
    --gray-light: #cbd5e1;
}

/* ── Reset ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Background Glow Effects */
body::before, body::after {
    content: ''; position: fixed; border-radius: 50%; filter: blur(120px); z-index: -1; pointer-events: none;
}
body::before {
    top: -10%; left: -10%; width: 500px; height: 500px; background: rgba(99,102,241,0.08);
}
body::after {
    bottom: -10%; right: -10%; width: 600px; height: 600px; background: rgba(168,85,247,0.08);
}

/* ── Layout Container ── */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ───────────────────────────────────────
   HERO SECTION
─────────────────────────────────────── */
.hero-section {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-xl);
    margin: 16px auto;
    padding: 80px 24px;
    text-align: center;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.05), var(--shadow-lg);
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -80px; right: -80px;
    width: 320px; height: 320px;
    background: radial-gradient(circle, rgba(168,85,247,0.2) 0%, transparent 70%);
    pointer-events: none;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: -60px; left: -60px;
    width: 240px; height: 240px;
    background: radial-gradient(circle, rgba(99,102,241,0.2) 0%, transparent 70%);
    pointer-events: none;
}

.hero-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #a855f7 50%, #6366f1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 680px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

.hero-features {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 40px;
}

.feature-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.feature-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    border-color: rgba(168, 85, 247, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    display: block;
}

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.55;
}

.hero-cta { margin-top: 40px; }

.cta-button {
    display: inline-block;
    padding: 16px 36px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-decoration: none;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 1rem;
    transition: var(--transition);
    box-shadow: 0 4px 24px rgba(168, 85, 247, 0.4);
    letter-spacing: 0.02em;
    border: 1px solid rgba(255,255,255,0.2);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(168, 85, 247, 0.6);
}

/* ───────────────────────────────────────
   STATS SECTION
─────────────────────────────────────── */
.stats-section {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    margin: 24px auto;
    padding: 40px 20px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.stat-item { padding: 12px; }

.stat-number {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ───────────────────────────────────────
   TOOLS SECTION
─────────────────────────────────────── */
.tools-section {
    padding: 60px 20px;
    max-width: var(--max-width);
    margin: 0 auto;
}

.tools-heading {
    text-align: center;
    margin-bottom: 32px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.tools-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 24px;
}

.tool-card {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

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

.tool-card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px);
    border-color: rgba(168, 85, 247, 0.3);
    background: rgba(255,255,255,0.05);
}

.tool-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.tool-card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.tool-link {
    display: inline-block;
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-decoration: none;
    border-radius: var(--radius-full);
    font-weight: 700;
    transition: var(--transition);
    font-size: 0.95rem;
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.3);
    border: 1px solid rgba(255,255,255,0.2);
}

.tool-link:hover {
    box-shadow: 0 6px 24px rgba(168, 85, 247, 0.5);
    transform: translateY(-2px);
}

.tool-link.locked {
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: pointer;
    box-shadow: none;
    border-color: var(--border);
}

.tool-link.locked::after { content: ' 🔒'; }

/* ── Image Comparison Slider ── */
.comparison-slider {
    position: relative;
    width: 100%;
    height: 220px;
    margin: 24px 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.comparison-after {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; z-index: 1;
}
.comparison-after img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.comparison-before {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; overflow: hidden; z-index: 2;
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
}
.comparison-before img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.comparison-slider-handle {
    position: absolute; left: 50%; top: 0; bottom: 0;
    width: 3px; background: var(--primary); cursor: ew-resize;
    transform: translateX(-50%); z-index: 10;
}
.comparison-slider-handle::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    width: 42px; height: 42px; background: rgba(168, 85, 247, 0.8);
    backdrop-filter: blur(4px); border: 2px solid white; border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: var(--shadow-lg);
}
.comparison-slider-handle::before {
    content: '↔'; position: absolute; top: 50%; left: 50%;
    color: white; font-size: 16px; font-weight: 800;
    transform: translate(-50%, -50%); z-index: 11;
}
.comparison-label {
    position: absolute; top: 12px;
    padding: 6px 14px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.1);
    color: white; font-size: 11px; font-weight: 700;
    border-radius: var(--radius-full); z-index: 9;
    letter-spacing: 0.05em; text-transform: uppercase;
}
.comparison-label-before { left: 12px; }
.comparison-label-after  { right: 12px; }

/* ───────────────────────────────────────
   TEMPLATES SECTION
─────────────────────────────────────── */
.templates-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px 20px;
}

.templates-heading {
    text-align: center;
    margin-bottom: 12px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 800;
    color: var(--text-primary);
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 24px;
}

.card {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    animation: fadeUp 0.4s ease-out;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(168, 85, 247, 0.4);
    background: rgba(255,255,255,0.06);
}

.card img {
    width: 100%; height: 200px; object-fit: cover;
    background: var(--bg-input);
}

.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.card .meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.card .meta span {
    background: var(--bg-elevated);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.card .description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    flex-grow: 1;
    line-height: 1.6;
}

.card button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.2);
}

.card button:hover {
    box-shadow: 0 6px 24px rgba(168, 85, 247, 0.4);
    transform: translateY(-2px);
}

.card button.locked {
    background: var(--bg-input);
    color: var(--text-muted);
    box-shadow: none;
    border-color: var(--border);
}
.card button.locked::after { content: ' 🔒'; }

/* ── Filter Bar ── */
.filter-bar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: var(--radius-xl);
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.filter-bar select,
.filter-bar input {
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
    font-family: inherit;
}

.filter-bar select:focus,
.filter-bar input:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    background: rgba(0,0,0,0.8);
}

.filter-bar button {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.filter-bar button:hover { opacity: 0.9; transform: translateY(-1px); }

.filter-bar a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
}

/* ── No Results ── */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    grid-column: 1 / -1;
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    border: 1px dashed rgba(255,255,255,0.2);
}
.no-results h3 { color: var(--text-secondary); margin-bottom: 8px; }

/* ───────────────────────────────────────
   IMAGE VIEWER MODAL
─────────────────────────────────────── */
.image-viewer-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(12px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; opacity: 0; visibility: hidden;
    transition: var(--transition);
}
.image-viewer-modal.active { opacity: 1; visibility: visible; }
.image-viewer-content {
    position: relative; max-width: 95%; max-height: 95%;
    display: flex; align-items: center; justify-content: center;
}
.image-viewer-content img {
    max-width: 100%; max-height: 90vh; object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 80px rgba(0,0,0,0.8);
    border: 1px solid rgba(255,255,255,0.1);
}
.image-viewer-close {
    position: absolute; top: 24px; right: 24px;
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: white;
    font-size: 1.5rem; width: 48px; height: 48px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    z-index: 1001; backdrop-filter: blur(8px); transition: var(--transition);
}
.image-viewer-close:hover { background: rgba(239, 68, 68, 0.4); }
.image-viewer-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: white;
    font-size: 1.8rem; width: 56px; height: 56px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    z-index: 1001; transition: var(--transition); backdrop-filter: blur(8px);
}
.image-viewer-nav:hover { background: rgba(255,255,255,0.2); }
.image-viewer-prev { left: 24px; }
.image-viewer-next { right: 24px; }
.image-viewer-info {
    position: absolute; bottom: 24px; left: 0; right: 0;
    text-align: center; color: white;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.1);
    padding: 14px; border-radius: var(--radius-lg); margin: 0 24px; z-index: 1001;
}

/* ───────────────────────────────────────
   LOGIN/REGISTER MODAL
─────────────────────────────────────── */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(12px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; opacity: 0; visibility: hidden; transition: var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg-page);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xl);
    padding: 32px 28px;
    width: 92%; max-width: 440px;
    max-height: 92vh; overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,0.8), inset 0 1px 1px rgba(255,255,255,0.05);
    transform: translateY(24px) scale(0.98);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }

.modal-close {
    position: absolute; top: 16px; right: 16px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    color: var(--text-secondary); font-size: 1.2rem;
    width: 36px; height: 36px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.modal-close:hover { background: rgba(239,68,68,0.2); color: var(--error); border-color: rgba(239,68,68,0.4); }

.modal-tabs {
    display: flex; margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
}
.modal-tab {
    padding: 12px 24px;
    background: none; border: none; border-bottom: 2px solid transparent;
    color: var(--text-muted); cursor: pointer; font-weight: 600;
    transition: var(--transition); margin-bottom: -2px;
    font-family: inherit; font-size: 0.95rem;
}
.modal-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.modal-form { display: none; }
.modal-form.active { display: block; animation: fadeUp 0.3s ease-out; }

.modal-form .form-group { margin-bottom: 16px; }
.modal-form label {
    display: block; margin-bottom: 6px;
    color: var(--text-secondary); font-size: 0.9rem; font-weight: 600;
}
.modal-form input {
    width: 100%; padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.95rem; transition: var(--transition);
    outline: none; font-family: inherit;
}
.modal-form input:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    background: rgba(0,0,0,0.8);
}
.modal-form button {
    width: 100%; padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white; border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius); font-weight: 700;
    cursor: pointer; margin-top: 12px;
    font-size: 1rem; transition: var(--transition);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
    font-family: inherit;
}
.modal-form button:hover { box-shadow: 0 6px 28px rgba(168, 85, 247, 0.5); transform: translateY(-1px); }

.modal-error {
    background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--error);
    padding: 12px 16px; border-radius: var(--radius);
    margin-bottom: 16px; font-size: 0.9rem; text-align: center; font-weight: 500;
}

/* ───────────────────────────────────────
   ANIMATIONS
─────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

/* ───────────────────────────────────────
   SCROLLBAR
─────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-page); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ───────────────────────────────────────
   RESPONSIVE — TABLET
─────────────────────────────────────── */
@media (min-width: 640px) {
    .hero-features { grid-template-columns: repeat(3, 1fr); }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .tools-grid { grid-template-columns: repeat(2, 1fr); }
    .grid { grid-template-columns: repeat(2, 1fr); }
    .filter-bar { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
    .filter-bar select, .filter-bar input { flex: 1; min-width: 160px; }
}

@media (min-width: 1024px) {
    .hero-section { padding: 100px 60px; }
    .grid { grid-template-columns: repeat(3, 1fr); }
    .tools-grid { grid-template-columns: repeat(4, 1fr); }
}