@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Tajawal:wght@400;500;700;800&display=swap');

:root {
    --font-latin: 'Inter', system-ui, -apple-system, sans-serif;
    --font-arabic: 'Tajawal', 'Cairo', sans-serif;

    --start: left;
    --end: right;

    /* Core layout */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2.5rem;

    --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);
}

:root,
[data-theme="light"] {
    color-scheme: light;

    /* Light Theme - Clean & Professional */
    --bg: #f8fafc; /* Slate 50 */
    --bg-elevated: #ffffff;
    --surface: #ffffff;
    --surface-2: #f1f5f9; /* Slate 100 */

    --text: #0f172a; /* Slate 900 */
    --text-muted: #64748b; /* Slate 500 */
    --text-inverse: #ffffff;

    /* Electric Cyan Brand */
    --primary: #009ABF;
    --primary-rgb: 0, 154, 191;
    --primary-hover: #0082A3;
    --primary-soft: rgba(0, 154, 191, 0.1);

    /* Gold Accent - retained but subtle */
    --accent: #b8860b;
    --accent-rgb: 184, 134, 11;
    --accent-soft: rgba(184, 134, 11, 0.1);

    --border: #e2e8f0; /* Slate 200 */
    --border-strong: #cbd5e1; /* Slate 300 */

    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-strong: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);

    --link: var(--primary);
    --focus-ring: rgba(0, 154, 191, 0.4);
}

[data-theme="dark"] {
    color-scheme: dark;

    /* Dark Theme - "Legal Tech" (True Black + Deep Slate) */
    --bg: #020617; /* Slate 950 - True Blackish */
    --bg-elevated: #0f172a; /* Slate 900 */
    --surface: #1e293b; /* Slate 800 */
    --surface-2: #334155; /* Slate 700 */

    --text: #f8fafc; /* Slate 50 */
    --text-muted: #94a3b8; /* Slate 400 */
    --text-inverse: #020617;

    --primary: #00b4d8; /* Brighter Cyan for Dark Mode */
    --primary-rgb: 0, 180, 216;
    --primary-hover: #48cae4;
    --primary-soft: rgba(0, 180, 216, 0.15);

    --accent: #fbbf24; /* Amber 400 */
    --accent-rgb: 251, 191, 36;
    --accent-soft: rgba(251, 191, 36, 0.15);

    --border: #1e293b; /* Slate 800 */
    --border-strong: #334155; /* Slate 700 */

    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-strong: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3);

    --link: #38bdf8; /* Sky 400 */
    --focus-ring: rgba(56, 189, 248, 0.5);
}

[dir="rtl"] {
    --start: right;
    --end: left;
}

/* Legacy variable bridge & Gradients */
:root {
    --color-bg: var(--bg);
    --color-bg-topnav: var(--bg-elevated);
    --color-bg-content: var(--surface);
    --color-surface: var(--surface);
    --color-surface-alt: var(--surface-2);
    --color-card: var(--surface);
    --color-card-alt: var(--surface-2);

    --color-contrast: var(--text);
    --color-muted: var(--text-muted);
    --color-soft: var(--text-muted);
    --color-border: var(--border);
    --color-border-subtle: var(--border-strong);

    --color-primary: var(--primary);
    --color-primary-strong: var(--primary-hover);
    --color-primary-light: var(--primary-soft);
    --color-secondary: var(--accent);
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #0ea5e9;

    --card-radius: var(--radius-md);
    --card-radius-lg: var(--radius-lg);
    --card-padding: var(--space-lg);
    --card-border: var(--border);
    --card-border-subtle: var(--border-strong);
    --card-text: var(--text);
    --card-text-muted: var(--text-muted);
    --card-bg: var(--surface);
    --card-shadow: var(--shadow-card);
    --card-shadow-hover: var(--shadow-strong);

    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    --gradient-surface: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);

    --color-footer-bg: #0f172a;
    --color-footer-text: #f8fafc;
    --color-footer-divider: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] {
    --color-footer-bg: #020617;
}

* {
    box-sizing: border-box;
    transition: background-color var(--transition-base), color var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

html {
    scroll-behavior: smooth;
}

body.public-body {
    background-color: var(--bg);
    /* Subtle mesh gradient for depth */
    background-image:
        radial-gradient(circle at 0% 0%, rgba(var(--primary-rgb), 0.08), transparent 40%),
        radial-gradient(circle at 100% 0%, rgba(var(--accent-rgb), 0.05), transparent 30%);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-latin);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html[dir="rtl"] body.public-body {
    font-family: var(--font-arabic);
}

/* Typography Polish */
h1, h2, h3, h4, h5, h6 {
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

small, .small {
    font-size: 0.875rem;
}

/* Correction for text visibility in Light Mode */
p, li, small, .text-muted {
    color: inherit;
}

.text-muted {
    color: var(--text-muted) !important;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
}

/* Utility Classes */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
