/* ═══════════════════════════════════════════════════════════
   PIX — Design System v1.0
   Social Media Design Generation Platform
   ═══════════════════════════════════════════════════════════ */

/* ─── Google Fonts ─── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Tajawal:wght@300;400;500;700;800;900&display=swap');

/* ═══════════ ROOT VARIABLES ═══════════ */
:root {
    /* ─── Brand Colors ─── */
    --brand-primary: #00D4FF;
    --brand-secondary: #7C3AED;
    --brand-accent: #FF006E;
    --brand-success: #00E676;
    --brand-warning: #FFD600;
    --brand-error: #FF1744;

    /* ─── Brand Gradient ─── */
    --gradient-brand: linear-gradient(135deg, #00D4FF 0%, #7C3AED 50%, #FF006E 100%);
    --gradient-brand-subtle: linear-gradient(135deg, rgba(0,212,255,0.15) 0%, rgba(124,58,237,0.15) 50%, rgba(255,0,110,0.15) 100%);
    --gradient-brand-text: linear-gradient(135deg, #00D4FF 0%, #7C3AED 60%, #FF006E 100%);
    --gradient-glow: radial-gradient(ellipse at center, rgba(0,212,255,0.08) 0%, transparent 70%);
    --gradient-glow-purple: radial-gradient(ellipse at center, rgba(124,58,237,0.08) 0%, transparent 70%);

    /* ─── Background Colors ─── */
    --bg-primary: #050510;
    --bg-secondary: #0A0A1F;
    --bg-tertiary: #0F0F2A;
    --bg-card: rgba(15, 15, 42, 0.6);
    --bg-card-hover: rgba(20, 20, 55, 0.8);
    --bg-elevated: rgba(20, 20, 50, 0.9);
    --bg-input: rgba(10, 10, 30, 0.8);
    --bg-overlay: rgba(5, 5, 16, 0.85);

    /* ─── Text Colors ─── */
    --text-primary: #F0F0FF;
    --text-secondary: #9090B0;
    --text-tertiary: #606080;
    --text-inverse: #050510;
    --text-brand: var(--brand-primary);

    /* ─── Border Colors ─── */
    --border-primary: rgba(255,255,255,0.06);
    --border-secondary: rgba(255,255,255,0.1);
    --border-brand: rgba(0,212,255,0.3);
    --border-hover: rgba(0,212,255,0.5);

    /* ─── Typography ─── */
    --font-ar: 'Tajawal', 'Segoe UI', sans-serif;
    --font-en: 'Inter', 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;
    --text-6xl: 3.75rem;
    --text-7xl: 4.5rem;

    --leading-tight: 1.2;
    --leading-snug: 1.35;
    --leading-normal: 1.5;
    --leading-relaxed: 1.7;

    --tracking-tight: -0.02em;
    --tracking-normal: 0;
    --tracking-wide: 0.02em;

    /* ─── Spacing ─── */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-14: 3.5rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;
    --space-32: 8rem;

    /* ─── Border Radius ─── */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-2xl: 28px;
    --radius-full: 9999px;

    /* ─── Shadows ─── */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 20px rgba(0,212,255,0.2);
    --shadow-glow-strong: 0 0 40px rgba(0,212,255,0.3);
    --shadow-glow-purple: 0 0 30px rgba(124,58,237,0.25);

    /* ─── Transitions ─── */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ─── Z-Index ─── */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-toast: 500;

    /* ─── Container ─── */
    --container-max: 1200px;
    --container-lg: 1400px;
}


/* ═══════════ RESET & BASE ═══════════ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-ar);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* RTL Support */
[dir="rtl"] body {
    font-family: var(--font-ar);
}

[dir="ltr"] body {
    font-family: var(--font-en);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    outline: none;
}

ul, ol {
    list-style: none;
}

::selection {
    background: rgba(0,212,255,0.3);
    color: var(--text-primary);
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}


/* ═══════════ LAYOUT ═══════════ */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-lg {
    max-width: var(--container-lg);
}

.section {
    padding: var(--space-24) 0;
    position: relative;
}


/* ═══════════ TYPOGRAPHY ═══════════ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 800;
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
}

.gradient-text {
    background: var(--gradient-brand-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-14);
}

.section-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-5);
    background: var(--gradient-brand-subtle);
    border: 1px solid var(--border-brand);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--brand-primary);
    margin-bottom: var(--space-6);
}

.section-title {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-4);
}

.section-subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: var(--leading-relaxed);
}


/* ═══════════ BUTTONS ═══════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-weight: 600;
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    border: 1px solid transparent;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover::before {
    opacity: 1;
}

/* Primary Button */
.btn-primary {
    background: var(--gradient-brand);
    color: var(--text-inverse);
    box-shadow: var(--shadow-glow);
}

.btn-primary::before {
    background: rgba(255,255,255,0.15);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-strong);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-secondary);
    backdrop-filter: blur(10px);
}

.btn-secondary::before {
    background: rgba(255,255,255,0.05);
}

.btn-secondary:hover {
    border-color: var(--border-brand);
    box-shadow: var(--shadow-glow);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
    border-radius: var(--radius-xl);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}


/* ═══════════ CARDS ═══════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    backdrop-filter: blur(20px);
    transition: all var(--transition-base);
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-secondary);
}

.card-glow {
    position: relative;
}

.card-glow::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: var(--gradient-brand);
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-slow);
    filter: blur(8px);
}

.card-glow:hover::after {
    opacity: 0.4;
}


/* ═══════════ INPUTS ═══════════ */
.input-group {
    margin-bottom: var(--space-5);
}

.input-group label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-input);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-base);
    transition: all var(--transition-fast);
}

.input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(0,212,255,0.15);
}

.input::placeholder {
    color: var(--text-tertiary);
}

textarea.input {
    resize: vertical;
    min-height: 100px;
    line-height: var(--leading-relaxed);
}


/* ═══════════ BADGES ═══════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
}

.badge-brand {
    background: rgba(0,212,255,0.15);
    color: var(--brand-primary);
    border: 1px solid rgba(0,212,255,0.3);
}

.badge-success {
    background: rgba(0,230,118,0.15);
    color: var(--brand-success);
}

.badge-warning {
    background: rgba(255,214,0,0.15);
    color: var(--brand-warning);
}

.badge-error {
    background: rgba(255,23,68,0.15);
    color: var(--brand-error);
}

.badge-processing {
    background: rgba(124,58,237,0.15);
    color: var(--brand-secondary);
}


/* ═══════════ SPINNER ═══════════ */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-secondary);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}


/* ═══════════ ANIMATIONS ═══════════ */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(0,212,255,0.2); }
    50% { box-shadow: 0 0 40px rgba(0,212,255,0.4); }
}

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

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Animation Utility Classes */
.animate-fade-in {
    animation: fadeIn 0.6s ease both;
}

.animate-fade-up {
    opacity: 0;
    animation: fadeInUp 0.7s ease both;
}

.animate-scale-in {
    animation: scaleIn 0.5s ease both;
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

/* Animation Delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }
.delay-7 { animation-delay: 0.7s; }
.delay-8 { animation-delay: 0.8s; }


/* ═══════════ UTILITIES ═══════════ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}


/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 768px) {
    :root {
        --text-5xl: 2.25rem;
        --text-4xl: 1.875rem;
        --text-3xl: 1.5rem;
        --text-2xl: 1.25rem;
    }

    .container {
        padding: 0 var(--space-4);
    }

    .section {
        padding: var(--space-16) 0;
    }
}

@media (max-width: 480px) {
    :root {
        --text-5xl: 1.875rem;
        --text-4xl: 1.5rem;
    }
}
