:root {
  --bg: #0b0f19;
  --panel: rgba(17, 24, 39, 0.7);
  --panel-border: rgba(255, 255, 255, 0.08);
  --sidebar-bg: rgba(9, 13, 23, 0.95);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #2563eb;
  --accent-glow: rgba(37, 99, 235, 0.25);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  background-image: 
    radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: #60a5fa;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #93c5fd;
}

code {
  font-family: var(--font-mono);
  background: rgba(31, 41, 55, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
  color: #38bdf8;
}

pre {
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.2rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: #e2e8f0;
  font-size: 0.95em;
}

/* Page Layout */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background-color: var(--sidebar-bg);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  z-index: 100;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--panel-border);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #60a5fa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-grow: 1;
}

.nav-links a {
  display: flex;
  align-items: center;
  padding: 0.625rem 0.75rem;
  border-radius: 6px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.nav-links a:hover, .nav-links a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-links a.active {
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.3);
  color: #60a5fa;
}

.lang-selector {
  display: flex;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--panel-border);
}

.lang-btn {
  flex: 1;
  background: #1f2937;
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  text-align: center;
  font-weight: 600;
  transition: all 0.2s ease;
}

.lang-btn.active, .lang-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Main Content Area */
main {
  padding: 2.5rem clamp(1.5rem, 5vw, 4rem);
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

/* Header & Typography */
h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 0.5rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

p {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 1.05rem;
}

ul, ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

li {
  margin-bottom: 0.5rem;
}

/* Panels / Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.4);
}

.card h3 {
  margin-top: 0;
  color: #fff;
}

.card p {
  margin-bottom: 0;
  font-size: 0.95rem;
}

/* Callouts / Alerts */
.callout {
  background: rgba(37, 99, 235, 0.08);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.callout.good {
  background: rgba(16, 185, 129, 0.08);
  border-left-color: var(--success);
}

.callout.warn {
  background: rgba(245, 158, 11, 0.08);
  border-left-color: var(--warning);
}

.callout.danger {
  background: rgba(239, 68, 68, 0.08);
  border-left-color: var(--danger);
}

.callout h4 {
  color: #fff;
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.callout p {
  margin-bottom: 0;
  color: var(--text-primary);
  font-size: 0.95rem;
}

/* Table Design */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  margin: 1.5rem 0;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 0.85rem 1rem;
}

th {
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 2px solid var(--panel-border);
}

td {
  border-bottom: 1px solid var(--panel-border);
  color: var(--text-secondary);
  font-size: 0.95rem;
  vertical-align: top;
}

tr:last-child td {
  border-bottom: none;
}

/* Portal Page / Landing styles */
.portal-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 85vh;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.portal-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  background: linear-gradient(135deg, #60a5fa, #34d399, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
}

.portal-desc {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin-bottom: 3rem;
}

.portal-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  width: 100%;
}

.portal-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

.portal-card:hover {
  transform: translateY(-5px);
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 25px 30px -5px rgba(37, 99, 235, 0.15);
}

.portal-card h3 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.portal-card p {
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.portal-btn {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  display: inline-block;
  transition: background 0.2s ease;
}

.portal-card:hover .portal-btn {
  background: #1d4ed8;
}

/* PREMIUM UNREAL ENGINE 5 BLUEPRINT GRAPH CANVAS BACKDROP */
.bp-canvas {
  background-color: #151515;
  background-image: 
    radial-gradient(circle, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 16px 16px, 80px 80px, 80px 80px;
  border: 2px solid #282828;
  border-radius: 10px;
  padding: 2.5rem 1.5rem;
  margin: 2rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 4px 20px rgba(0,0,0,0.8), 0 10px 30px rgba(0,0,0,0.5);
  position: relative;
}

.bp-canvas::before {
  content: 'BLUEPRINT PREVIEW';
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.25);
  font-family: var(--font-sans);
  font-weight: 800;
  letter-spacing: 0.1em;
}

/* PREMIUM UNREAL ENGINE 5 BLUEPRINT NODE STYLING */
.bp-node {
  background: rgba(26, 26, 26, 0.95);
  border: 1.5px solid #101010;
  border-radius: 5px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.05);
  font-family: var(--font-sans);
  width: 100%;
  max-width: 460px;
  min-width: 340px;
  overflow: hidden;
  user-select: none;
  font-size: 11px;
}

.bp-header {
  display: flex;
  align-items: center;
  padding: 6px 10px 8px;
  position: relative;
  border-bottom: 2px solid rgba(0, 0, 0, 0.4);
}

/* Header Colors matching Unreal Engine standards */
.bp-header.function {
  background: linear-gradient(to right, #203f64, #122237);
  border-top: 2px solid #3d7acc;
}

.bp-header.pure-function {
  background: linear-gradient(to right, #1f4f37, #0b1c14);
  border-top: 2px solid #2ecc71;
}

.bp-header.event {
  background: linear-gradient(to right, #8c2a22, #47130f);
  border-top: 2px solid #e74c3c;
}

.bp-header.getter {
  background: linear-gradient(to right, #385732, #182815);
  border-top: 2px solid #2ecc71;
}

.bp-header-icon {
  margin-right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bp-header-icon svg {
  width: 16px;
  height: 16px;
  fill: #fff;
  opacity: 0.85;
}

.bp-title-container {
  display: flex;
  flex-direction: column;
}

.bp-class {
  font-size: 8.5px;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 1.5px;
}

.bp-title {
  font-size: 13px;
  color: #fff;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.bp-body {
  padding: 8px 0;
  background: rgba(18, 18, 18, 0.98);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bp-row {
  display: flex;
  justify-content: space-between;
  min-height: 20px;
  padding: 1px 10px;
}

.bp-inputs, .bp-outputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 48%;
}

.bp-inputs {
  align-items: flex-start;
}

.bp-outputs {
  align-items: flex-end;
}

.bp-pin {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 16px;
}

.bp-pin.output {
  flex-direction: row-reverse;
}

.bp-pin-label {
  color: #cbd5e0;
  font-weight: 500;
}

/* REALISTIC PENTAGON EXEC PIN FOR UNREAL ENGINE */
.bp-pin-icon.exec {
  width: 11px;
  height: 10px;
  background-color: transparent;
  border: 1.5px solid #fff;
  clip-path: polygon(0% 0%, 55% 0%, 100% 50%, 55% 100%, 0% 100%);
  display: inline-block;
  transition: background-color 0.1s ease;
}

.bp-pin-icon.exec.connected {
  background-color: #fff;
}

/* VALUE PINS (CIRCLES) */
.bp-pin-icon.val {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  display: inline-block;
  background-color: transparent;
}

.bp-pin-icon.val.connected {
  background-color: currentColor !important;
}

/* Colors matching Unreal Engine 5 Variable Types */
.bp-pin-icon.val.bool { color: #ff0044; border-color: #ff0044; }
.bp-pin-icon.val.float { color: #a1f500; border-color: #a1f500; }
.bp-pin-icon.val.integer { color: #00ea90; border-color: #00ea90; }
.bp-pin-icon.val.string { color: #ff00ff; border-color: #ff00ff; }
.bp-pin-icon.val.text { color: #e06060; border-color: #e06060; }
.bp-pin-icon.val.object { color: #0084ff; border-color: #0084ff; }
.bp-pin-icon.val.struct { color: #00d2ff; border-color: #00d2ff; }
.bp-pin-icon.val.delegate { color: #ff3c00; border-color: #ff3c00; }

.bp-pin-icon.val.bool.connected { background-color: #ff0044; }
.bp-pin-icon.val.float.connected { background-color: #a1f500; }
.bp-pin-icon.val.integer.connected { background-color: #00ea90; }
.bp-pin-icon.val.string.connected { background-color: #ff00ff; }
.bp-pin-icon.val.text.connected { background-color: #e06060; }
.bp-pin-icon.val.object.connected { background-color: #0084ff; }
.bp-pin-icon.val.struct.connected { background-color: #00d2ff; }
.bp-pin-icon.val.delegate.connected { background-color: #ff3c00; }

/* Interactive Flow Step Diagram */
.bp-flow-diagram {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.bp-flow-step {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-weight: 700;
  text-align: center;
  flex: 1;
  min-width: 120px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
  border-left: 3px solid var(--accent);
}

.bp-flow-arrow {
  color: var(--accent);
  font-weight: 800;
  font-size: 1.5rem;
}

/* RTL Specific Styles (for Arabic site) */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .sidebar {
  border-right: none;
  border-left: 1px solid var(--panel-border);
}

[dir="rtl"] .callout {
  border-left: none;
  border-right: 4px solid var(--accent);
  border-radius: 8px 0 0 8px;
}

[dir="rtl"] .callout.good { border-right-color: var(--success); }
[dir="rtl"] .callout.warn { border-right-color: var(--warning); }
[dir="rtl"] .callout.danger { border-right-color: var(--danger); }

[dir="rtl"] .bp-inputs {
  align-items: flex-start;
}

[dir="rtl"] .bp-header-icon {
  margin-right: 0;
  margin-left: 8px;
}

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

/* Responsive Grid Adjustments */
@media (max-width: 868px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    height: auto;
    border-bottom: 1px solid var(--panel-border);
  }
  .portal-choices {
    grid-template-columns: 1fr;
  }
  .bp-node {
    min-width: 100%;
  }
}
