/* 
 * PREMIUM SAAS DESIGN SYSTEM
 * Supports LTR & RTL via Logical Properties
 */

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

:root {
    /* Color Palette - Deep Blue & Emerald */
    --color-primary: #0f172a;       /* Slate 900 */
    --color-primary-light: #1e293b; /* Slate 800 */
    --color-accent: #10b981;        /* Emerald 500 */
    --color-accent-hover: #059669;  /* Emerald 600 */
    
    --color-bg: #f8fafc;            /* Slate 50 */
    --color-surface: #ffffff;
    --color-text-main: #1e293b;
    --color-text-muted: #64748b;    /* Slate 500 */
    --color-border: #e2e8f0;        /* Slate 200 */
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;
    
    --font-en: 'Inter', sans-serif;
    --font-ar: 'Cairo', sans-serif;
    
    /* Default direction variables */
    --direction: ltr;
}

[dir="rtl"] {
    --direction: rtl;
    --font-family-base: var(--font-ar);
}

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

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

body {
    font-family: var(--font-family-base);
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.6;
    transition: font-family 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { text-decoration: none; color: inherit; transition: color 0.2s; }
ul { list-style: none; }
button { font-family: inherit; }

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: 1.5rem;
    width: 100%;
}

.section { padding-block: 4rem; }

.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }

/* Typography */
h1, h2, h3 { font-weight: 700; line-height: 1.2; color: var(--color-primary); }
h1 { font-size: 3rem; margin-bottom: 1.5rem; }
h2 { font-size: 2.25rem; margin-bottom: 1rem; }
p { color: var(--color-text-muted); margin-bottom: 1rem; }

.text-center { text-align: center; }
.text-accent { color: var(--color-accent); font-weight: 600; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--color-accent);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}
.btn-primary:hover { background-color: var(--color-accent-hover); transform: translateY(-1px); }

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-primary);
}
.btn-outline:hover { border-color: var(--color-primary); background-color: white; }

.btn-lg { padding: 1rem 2rem; font-size: 1.125rem; }

/* Navbar */
header {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding-block: 1rem;
}

.logo { font-size: 1.5rem; font-weight: 700; color: var(--color-primary); display: flex; align-items: center; gap: 0.5rem; }
.logo svg { width: 32px; height: 32px; color: var(--color-accent); }

.nav-links { display: flex; gap: 2rem; }
.nav-links a { font-weight: 500; color: var(--color-text-muted); }
.nav-links a:hover { color: var(--color-accent); }

/* Language Switcher */
.lang-switch {
    background: none;
    border: 1px solid var(--color-border);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-primary);
}
.lang-switch:hover { background-color: var(--color-bg); }

/* Hero Section */
.hero {
    min-height: 80vh;
    display: flex;
    align-items: center;
    background: rgb(248,250,252);
    background: radial-gradient(circle at top right, #f1f5f9 0%, transparent 40%);
}

.hero-content { max-width: 600px; }

/* Feature Cards (Trust) */
.features-grid { margin-top: 4rem; }
.feature-card {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    transition: transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-accent);
}
.feature-icon {
    width: 48px;
    height: 48px;
    background-color: #ecfdf5; /* emerald 50 */
    color: var(--color-accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

/* Pricing Cards */
.pricing-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    border: 1px solid var(--color-border);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.pricing-card.recommended {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-xl);
    transform: scale(1.02);
}
.badge-rec {
    position: absolute;
    top: 0;
    right: 0; /* LTR default position will be handled by logic if needed, or simple absolute */
    background: var(--color-accent);
    color: white;
    padding: 0.25rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-bottom-left-radius: var(--radius-md);
}
[dir="rtl"] .badge-rec { right: auto; left: 0; border-bottom-left-radius: 0; border-bottom-right-radius: var(--radius-md); }

.price-tag { font-size: 2.5rem; font-weight: 700; color: var(--color-primary); margin-block: 1rem; }
.price-period { font-size: 1rem; color: var(--color-text-muted); font-weight: 400; }
.plan-features { margin-block: 2rem; flex-grow: 1; }
.plan-features li { margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.75rem; }
.check-icon { color: var(--color-accent); flex-shrink: 0; }

/* Forms */
.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--color-primary); }
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}
.form-error { color: #ef4444; font-size: 0.875rem; margin-top: 0.25rem; display: none; }
.form-group.error .form-input { border-color: #ef4444; }
.form-group.error .form-error { display: block; }

/* Stepper */
.stepper { display: flex; justify-content: space-between; margin-bottom: 3rem; position: relative; }
.stepper::before {
    content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 2px;
    background: var(--color-border); z-index: 1; transform: translateY(-50%);
}
.step-item {
    position: relative; z-index: 2; background: var(--color-bg); padding-inline: 1rem;
    display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
}
.step-circle {
    width: 40px; height: 40px; background: white; border: 2px solid var(--color-border);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 600; color: var(--color-text-muted); transition: all 0.3s;
}
.step-item.active .step-circle {
    border-color: var(--color-accent); background: var(--color-accent); color: white;
}
.step-label { font-size: 0.875rem; font-weight: 500; color: var(--color-text-muted); }
.step-item.active .step-label { color: var(--color-primary); font-weight: 600; }

/* Invoices (Confirm Page) */
.invoice-box {
    background: white; border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 2rem;
}
.invoice-row { display: flex; justify-content: space-between; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px dashed var(--color-border); }
.invoice-row.total { border-bottom: none; border-top: 2px solid var(--color-primary); padding-top: 1rem; font-size: 1.25rem; font-weight: 700; color: var(--color-primary); }

/* Animation Utility */
.fade-in { animation: fadeIn 0.5s ease-out forwards; opacity: 0; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Toast */
.toast-container {
    position: fixed; bottom: 2rem; right: 2rem; z-index: 1000;
    display: flex; flex-direction: column; gap: 1rem;
}
[dir="rtl"] .toast-container { right: auto; left: 2rem; }
.toast {
    background: white; padding: 1rem 1.5rem; border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg); border-left: 4px solid var(--color-accent);
    display: flex; align-items: center; gap: 1rem; font-weight: 500;
    animation: slideUp 0.3s ease-out;
}
[dir="rtl"] .toast { border-left: none; border-right: 4px solid var(--color-accent); }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
