/* Nosaya Global Design System - Premium SaaS */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* Primary Colors - Purple/Violet */
    --primary-50: #f5edff;
    --primary-100: #eadbfa;
    --primary-200: #d6b8ff;
    --primary-300: #b985fc;
    --primary-400: #a25cf5;
    --primary-500: #8a2be2;
    --primary-600: #7000FF; /* Target Primary */
    --primary-700: #5500c2;
    --primary-800: #3f0094;
    --primary-900: #290061;
    
    /* Secondary Colors - Orange/Coral */
    --secondary-50: #fff4ed;
    --secondary-100: #ffe3d1;
    --secondary-200: #ffcba3;
    --secondary-300: #ffb175;
    --secondary-400: #ff9847;
    --secondary-500: #FF7F50; /* Target Secondary */
    --secondary-600: #e6663c;
    --secondary-700: #bf4d28;
    --secondary-800: #993717;
    --secondary-900: #73220b;
    
    /* Success Colors - Green */
    --success-50: #f0fdf4;
    --success-100: #dcfce7;
    --success-500: #05CD99;
    --success-600: #04B184;
    
    /* Warning Colors - Yellow/Orange */
    --warning-50: #fffbeb;
    --warning-100: #fef3c7;
    --warning-500: #FFCE20;
    --warning-600: #E5B91C;
    
    /* Error Colors - Soft Red */
    --error-50: #fef2f2;
    --error-100: #fee2e2;
    --error-500: #EE5D50;
    --error-600: #dc2626;
    
    /* Neutral Colors - Slate/Gray */
    --neutral-50: #f8fafc;
    --neutral-100: #f1f5f9;
    --neutral-200: #e2e8f0;
    --neutral-300: #cbd5e1;
    --neutral-400: #94a3b8;
    --neutral-500: #64748b;
    --neutral-600: #475569;
    --neutral-700: #334155;
    --neutral-800: #1e293b;
    --neutral-900: #0f172a;
    
    /* Semantic Colors */
    --background: #F8F9FD; /* Very light gray */
    --surface: #FFFFFF; /* White cards */
    --surface-alt: #FAFBFC;
    --border: #Eef0f6; /* Very subtle border */
    --text-primary: #000000; /* Black */
    --text-secondary: #64748B; /* Muted slate */
    --text-tertiary: #94A3B8;
    --text-inverse: #ffffff;

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-bg-strong: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.25);
    --glass-shadow: 0 8px 32px rgba(112, 0, 255, 0.06);
    --glass-blur: 16px;

    /* Brand Gradients */
    --gradient-primary: linear-gradient(135deg, #8a2be2, #7000FF);
    --gradient-accent: linear-gradient(135deg, #7000FF, #FF7F50);
    --gradient-warm: linear-gradient(135deg, #FF7F50, #FFCE20);
    --gradient-cool: linear-gradient(135deg, #7000FF, #05CD99);
    --gradient-surface: linear-gradient(135deg, rgba(112,0,255,0.02), rgba(255,127,80,0.02));
    --gradient-hero: linear-gradient(135deg, #f5edff 0%, #fff4ed 50%, #f0fdf4 100%);

    /* Glow Shadows */
    --shadow-glow-primary: 0 0 20px rgba(112, 0, 255, 0.15), 0 0 40px rgba(112, 0, 255, 0.05);
    --shadow-glow-success: 0 0 20px rgba(5, 205, 153, 0.2), 0 0 40px rgba(5, 205, 153, 0.06);
    --shadow-glow-warning: 0 0 20px rgba(255, 206, 32, 0.2), 0 0 40px rgba(255, 206, 32, 0.06);
    --shadow-glow-error: 0 0 20px rgba(238, 93, 80, 0.2), 0 0 40px rgba(238, 93, 80, 0.06);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 18px; /* Premium SaaS card radius */
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Typography */
    --font-family-base: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-heading: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    --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;

    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* Soft Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(112, 0, 255, 0.03);
    --shadow-md: 0 4px 12px -2px rgba(112, 0, 255, 0.05), 0 2px 4px -2px rgba(112, 0, 255, 0.03);
    --shadow-lg: 0 12px 24px -4px rgba(112, 0, 255, 0.07), 0 4px 8px -4px rgba(112, 0, 255, 0.04);
    --shadow-xl: 0 20px 32px -4px rgba(112, 0, 255, 0.09), 0 8px 16px -4px rgba(112, 0, 255, 0.05);
    
    /* Hover Shadows */
    --shadow-hover: 0 16px 32px -4px rgba(101, 0, 255, 0.1), 0 8px 16px -4px rgba(101, 0, 255, 0.05);
    
    /* 3D Shadows */
    --shadow-3d-sm: 0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-3d-md: 0 8px 16px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);
    --shadow-3d-lg: 0 16px 32px rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.1);
    --shadow-3d-xl: 0 24px 48px rgba(0, 0, 0, 0.18), 0 12px 24px rgba(0, 0, 0, 0.12);
    
    /* 3D Perspective */
    --perspective-sm: 500px;
    --perspective-md: 1000px;
    --perspective-lg: 1500px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    --transition-bounce: 350ms cubic-bezier(0.175, 0.885, 0.32, 1.1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Z-index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --header-height: 72px;
    --bottom-nav-height: 64px;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(112, 0, 255, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(255, 127, 80, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(5, 205, 153, 0.02) 0%, transparent 50%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    perspective: 1000px;
    transform-style: preserve-3d;
    pointer-events: auto;
}

/* RTL Support */
[dir="rtl"] body {
    text-align: right;
}

[dir="rtl"] .app-container {
    direction: rtl;
}

/* RTL specific fixes for common components */
[dir="rtl"] .btn {
    flex-direction: row-reverse;
}

[dir="rtl"] .input-group {
    flex-direction: row-reverse;
}

[dir="rtl"] .search-bar {
    flex-direction: row-reverse;
}

[dir="rtl"] .search-bar .icon {
    margin-right: 0;
    margin-left: var(--spacing-sm);
}

[dir="rtl"] .header-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .sidebar-link,
[dir="rtl"] .sidebar-footer-link {
    flex-direction: row-reverse;
}

[dir="rtl"] .sidebar-link .icon,
[dir="rtl"] .sidebar-footer-link .icon {
    margin-right: 0;
    margin-left: var(--spacing-md);
}

[dir="rtl"] .bottom-nav {
    flex-direction: row-reverse;
}

[dir="rtl"] .card {
    text-align: right;
}

[dir="rtl"] .form-input,
[dir="rtl"] .form-select,
[dir="rtl"] .form-textarea {
    text-align: right;
}

[dir="rtl"] .toast {
    flex-direction: row-reverse;
}

[dir="rtl"] .toast-icon {
    margin-right: 0;
    margin-left: var(--spacing-md);
}

/* RTL background adjustments - reverse gradient positions */
[dir="rtl"] body {
    background-image:
        radial-gradient(ellipse at 80% 0%, rgba(112, 0, 255, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 100%, rgba(255, 127, 80, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(5, 205, 153, 0.02) 0%, transparent 50%);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-heading);
    font-weight: var(--font-semibold);
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
}

a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-700);
}

/* Lists */
ul, ol {
    margin-bottom: var(--spacing-md);
    padding-left: var(--spacing-lg);
}

li {
    margin-bottom: var(--spacing-xs);
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Forms */
input,
textarea,
select,
button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* Focus States */
:focus-visible {
    outline: 2px solid var(--primary-400);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background-color: var(--primary-100);
    color: var(--primary-900);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-300), var(--primary-400));
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary-400), var(--primary-500));
}

/* Utility Classes */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-light { font-weight: var(--font-light); }
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-inverse { color: var(--text-inverse); }
.text-brand { color: var(--primary-600); }

/* Spacing utils */
.mt-0 { margin-top: 0; }
.mt-xs { margin-top: var(--spacing-xs); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-xs { margin-bottom: var(--spacing-xs); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.hidden { display: none !important; }

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

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

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

@keyframes float3d {
    0%, 100% {
        transform: translateY(0) rotateX(0deg) rotateY(0deg);
    }
    50% {
        transform: translateY(-10px) rotateX(2deg) rotateY(2deg);
    }
}

@keyframes tilt3d {
    0% {
        transform: perspective(1000px) rotateX(0deg) rotateY(0deg);
    }
    25% {
        transform: perspective(1000px) rotateX(2deg) rotateY(2deg);
    }
    50% {
        transform: perspective(1000px) rotateX(0deg) rotateY(4deg);
    }
    75% {
        transform: perspective(1000px) rotateX(-2deg) rotateY(2deg);
    }
    100% {
        transform: perspective(1000px) rotateX(0deg) rotateY(0deg);
    }
}

@keyframes slideIn3d {
    from {
        opacity: 0;
        transform: perspective(1000px) translateZ(-100px) rotateX(-10deg);
    }
    to {
        opacity: 1;
        transform: perspective(1000px) translateZ(0) rotateX(0deg);
    }
}

.animate-slideIn3d {
    animation: slideIn3d 0.6s ease-out forwards;
}

@keyframes pulse3d {
    0%, 100% {
        transform: scale(1) translateZ(0);
        box-shadow: 0 0 0 0 rgba(101, 0, 255, 0.4);
    }
    50% {
        transform: scale(1.05) translateZ(20px);
        box-shadow: 0 0 20px 10px rgba(101, 0, 255, 0.2);
    }
}

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

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(112, 0, 255, 0.15); }
    50% { box-shadow: 0 0 24px rgba(112, 0, 255, 0.3), 0 0 48px rgba(112, 0, 255, 0.1); }
}

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

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

@keyframes borderGlow {
    0%, 100% { border-color: rgba(112, 0, 255, 0.1); }
    50% { border-color: rgba(112, 0, 255, 0.3); }
}

@keyframes spinSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.animate-fadeIn {
    animation: fadeIn var(--transition-base) ease-in-out forwards;
}

.animate-slideUp {
    animation: slideUp var(--transition-base) ease-out forwards;
}

.animate-scaleIn {
    animation: scaleIn var(--transition-slow) ease-out forwards;
}

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

.animate-tilt3d {
    animation: tilt3d 8s ease-in-out infinite;
}

.animate-slideIn3d {
    animation: slideIn3d var(--transition-slow) ease-out forwards;
}

.animate-pulse3d {
    animation: pulse3d 2s ease-in-out infinite;
}

.animate-shimmer {
    animation: shimmer 2s linear infinite;
}

.animate-glow {
    animation: glowPulse 2s ease-in-out infinite;
}

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

/* Gradient text utility */
.text-gradient {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* Glass utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Mobile Performance Optimizations */
@media (max-width: 767px) {
    /* Disable complex 3D animations on mobile */
    .animate-float3d,
    .animate-tilt3d,
    .animate-pulse3d,
    .animate-slideIn3d {
        animation: none !important;
    }

    /* Simplify background animations */
    .hero::before,
    .hero::after,
    .features::before,
    .goals-habits::before,
    .gamification::before,
    .statistics::before,
    .how-it-works::before,
    .cta::before {
        animation: none !important;
        opacity: 0.5;
    }

    /* Disable gradient shift animation on mobile */
    .hero,
    .cta {
        animation: none !important;
        background-size: cover;
    }

    /* Optimize scrolling performance */
    body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: none;
    }

    /* Reduce shadow complexity */
    .card,
    .btn,
    .navbar,
    .sidebar {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }

    /* Disable shimmer and glow animations */
    .animate-shimmer,
    .animate-glow {
        animation: none !important;
    }

    /* Optimize glass effect for mobile */
    .glass {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }
}

/* RTL Support for Arabic and other RTL languages */
[dir="rtl"] {
    /* Flip text alignment */
    .text-left { text-align: right; }
    .text-right { text-align: left; }
    
    /* Flip margins and padding */
    .ml-auto, .margin-left-auto { margin-left: 0; margin-right: auto; }
    .mr-auto, .margin-right-auto { margin-right: 0; margin-left: auto; }
    
    /* Flip flex direction when needed */
    .flex-row { flex-direction: row; }
    
    /* Handle icons and symbols */
    .fa-chevron-left::before { content: "\f054"; } /* Change left to right */
    .fa-chevron-right::before { content: "\f053"; } /* Change right to left */
    
    /* Flip specific layout elements */
    .sidebar {
        right: 0;
        left: auto;
    }
    
    .main-content {
        margin-right: var(--sidebar-width);
        margin-left: 0;
    }
    
    /* Flip navigation items */
    .nav-item {
        margin-left: 0;
        margin-right: var(--spacing-sm);
    }
    
    /* Handle form elements */
    input[type="checkbox"],
    input[type="radio"] {
        margin-left: var(--spacing-sm);
        margin-right: 0;
    }
    
    /* Handle list bullets */
    ul, ol {
        padding-left: 0;
        padding-right: var(--spacing-lg);
    }
    
    /* Handle table alignment */
    th, td {
        text-align: right;
    }
    
    /* Handle scrollbars in RTL */
    ::-webkit-scrollbar {
        direction: rtl;
    }
}

/* Arabic font support */
[lang="ar"] {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Language selector styling */
.language-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    font-family: var(--font-family-base);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-right: var(--spacing-sm);
}

.language-select:hover {
    border-color: var(--primary-300);
    background: var(--surface-alt);
}

.language-select:focus {
    outline: 2px solid var(--primary-400);
    outline-offset: 2px;
}

[dir="rtl"] .language-select {
    margin-right: 0;
    margin-left: var(--spacing-sm);
}
