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

:root {
    --primary-rgb: 0, 180, 200;
    --primary-color: rgb(var(--primary-rgb));
    --primary-hover: #0097a8;
    --primary-light: rgba(var(--primary-rgb), 0.1);
    --primary-subtle: rgba(var(--primary-rgb), 0.08);
    --accent-teal: #14b8a6;
    --accent-blue: #3b82f6;
    --accent-gold: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --color-success: var(--accent-teal);
    --color-info: var(--accent-blue);
    --color-warning: var(--accent-gold);
    --color-danger: var(--accent-red);
    --bg-body: #f5f7fa;
    --bg-surface-rgb: 255, 255, 255;
    --bg-surface: rgb(var(--bg-surface-rgb));
    --bg-sidebar: #ffffff;
    --bg-sidebar-active: rgba(var(--primary-rgb), 0.1);
    --bg-input: #ffffff;
    --text-main: #0d1b2a;
    --text-secondary: #475569;
    --text-muted: #8fa7b5;
    --text-inverse: #ffffff;
    --border-color: #e2e8f0;
    --border-input: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-blur: blur(16px);
    --status-success-bg: #dcfce7;
    --status-success-text: #166534;
    --status-info-bg: #dbeafe;
    --status-info-text: #1e40af;
    --status-warning-bg: #fefce8;
    --status-warning-text: #854d0e;
    --status-neutral-bg: #f1f5f9;
    --status-neutral-text: #475569;
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 280px;
    --top-bar-height: 64px;
}

[data-theme="dark"] {
    --bg-body: #0b1220;
    --bg-surface-rgb: 22, 34, 53;
    --bg-surface: #162235;
    --bg-sidebar: #0b1220;
    --bg-sidebar-active: rgba(255, 255, 255, 0.05);
    --bg-input: #162235;
    --text-main: #f5f7fa;
    --text-secondary: #a1a1aa;
    --text-muted: #8fa7b5;
    --text-inverse: #0b1220;
    --border-color: #2a3342;
    --border-input: #2a3342;
    --primary-light: rgba(var(--primary-rgb), 0.2);
    --primary-subtle: rgba(var(--primary-rgb), 0.15);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --glass-bg: rgba(22, 34, 53, 0.9);
    --glass-border: rgba(255, 255, 255, 0.08);
    --status-success-bg: rgba(20, 184, 166, 0.15);
    --status-success-text: #2dd4bf;
    --status-info-bg: rgba(59, 130, 246, 0.15);
    --status-info-text: #60a5fa;
    --status-warning-bg: rgba(245, 158, 11, 0.15);
    --status-warning-text: #fbbf24;
    --status-danger-bg: rgba(239, 68, 68, 0.15);
    --status-danger-text: #f87171;
    --status-neutral-bg: rgba(148, 163, 184, 0.15);
    --status-neutral-text: #cbd5e1;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--top-bar-height);
}

html[lang="ar"] {
    font-family: 'Alexandria', sans-serif;
}

html[lang="en"] {
    font-family: 'Outfit', sans-serif;
}

body {
    font-family: inherit;
    background: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform var(--transition-base);
    overflow-y: auto;
}

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

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }

.sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: contain;
}

.sidebar-brand .logo-dark {
    display: none;
}

[data-theme="dark"] .sidebar-brand .logo-light {
    display: none;
}

[data-theme="dark"] .sidebar-brand .logo-dark {
    display: block;
}

.sidebar-brand span {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
}

.sidebar .nav {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    list-style: none;
    margin: 0;
}

.sidebar > .nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar-section-group .nav {
    flex: 0 0 auto;
    padding: 0;
}

.sidebar .nav-item {
    padding: 0 12px;
    margin-bottom: 2px;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
    cursor: pointer;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 16px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.sidebar .nav-link:hover {
    background: var(--primary-subtle);
    color: var(--primary-color);
}

.sidebar .nav-link:hover i {
    color: var(--primary-color);
}

[dir="rtl"] .sidebar .nav-link:hover {
    padding-right: 20px;
}

.sidebar .nav-link.active {
    background: var(--primary-subtle);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 0 4px 4px 0;
}

[dir="rtl"] .sidebar .nav-link.active::before {
    left: auto;
    right: -12px;
    border-radius: 4px 0 0 4px;
}

.sidebar .nav-link.active i {
    color: var(--primary-color);
}

.sidebar-section-toggle {
    padding: 0 12px;
    margin-top: 8px;
}

.sidebar-section-toggle:first-of-type {
    margin-top: 0;
}

.sidebar-section-toggle .sidebar-section-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.sidebar-section-toggle.has-active .sidebar-section-label {
    color: var(--primary-color);
}

.sidebar-section-toggle .sidebar-section-label:hover {
    color: var(--text-secondary);
    background: var(--primary-subtle);
}

.sidebar-chevron {
    font-size: 10px;
    transition: transform var(--transition-fast);
}

.collapsed .sidebar-chevron {
    transform: rotate(-90deg);
}

[dir="rtl"] .collapsed .sidebar-chevron {
    transform: rotate(90deg);
}

.sidebar-section-group {
    overflow: hidden;
    max-height: 500px;
    transition: max-height var(--transition-base);
}

.sidebar-section-group.collapsed {
    max-height: 0;
}

.sidebar-section-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar .sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar .sidebar-footer .version {
    font-size: 12px;
    color: var(--text-muted);
}

.main-content-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

[dir="rtl"] .main-content-wrapper {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

.top-bar {
    height: var(--top-bar-height);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 999;
    gap: 16px;
}

.top-bar .page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.top-bar-actions {
    margin-left: auto;
}

[dir="rtl"] .top-bar-actions {
    margin-left: 0;
    margin-right: auto;
}

.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--primary-subtle);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.theme-toggle-btn:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.theme-toggle-btn i {
    font-size: 16px;
}

.theme-toggle-btn.lang-btn {
    min-width: 48px;
    justify-content: center;
    font-weight: 700;
}

.theme-toggle-btn.lang-btn.active-lang {
    display: none;
}

.content-container {
    flex: 1;
    padding: 24px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.doc-header {
    margin-bottom: 32px;
}

.doc-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.doc-header p {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.doc-section {
    margin-bottom: 40px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: box-shadow var(--transition-base);
}

.doc-section:hover {
    box-shadow: var(--shadow-md);
}

.doc-section-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
}

.doc-section-header:hover {
    background: var(--primary-subtle);
}

.doc-section-header .section-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-inverse);
    flex-shrink: 0;
}

.doc-section-header .section-icon.blue { background: var(--primary-color); }
.doc-section-header .section-icon.teal { background: var(--accent-teal); }
.doc-section-header .section-icon.gold { background: var(--accent-gold); }
.doc-section-header .section-icon.red { background: var(--accent-red); }
.doc-section-header .section-icon.purple { background: var(--accent-purple); }

.doc-section-header .section-title {
    flex: 1;
}

.doc-section-header .section-title h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.doc-section-header .section-title .section-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.doc-section-header .section-chevron {
    font-size: 14px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.doc-section-header.collapsed .section-chevron {
    transform: rotate(-90deg);
}

[dir="rtl"] .doc-section-header.collapsed .section-chevron {
    transform: rotate(90deg);
}

.doc-section-body {
    padding: 24px;
    overflow: hidden;
    transition: max-height var(--transition-base);
}

.doc-section-body.collapsed {
    max-height: 0;
    padding: 0 24px;
}

.doc-section-body p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.doc-section-body h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.doc-section-body h3:first-child {
    margin-top: 0;
}

.doc-section-body ul {
    padding-left: 20px;
    margin-bottom: 16px;
}

[dir="rtl"] .doc-section-body ul {
    padding-left: 0;
    padding-right: 20px;
}

.doc-section-body ul li {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.doc-section-body ul li strong {
    color: var(--text-main);
}

.scenario-card {
    background: var(--primary-subtle);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    transition: background var(--transition-fast);
}

.scenario-card:hover {
    background: var(--primary-light);
}

.scenario-card:last-child {
    margin-bottom: 0;
}

.scenario-card .scenario-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 6px;
}

.scenario-card .scenario-label i {
    font-size: 14px;
}

.scenario-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

.scenario-card ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

[dir="rtl"] .scenario-card ul {
    padding-left: 0;
    padding-right: 20px;
}

.scenario-card li {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 6px;
}

.scenario-card li:last-child {
    margin-bottom: 0;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.feature-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-body);
    border: 1px solid var(--border-color);
}

.feature-tag i {
    color: var(--color-success);
    font-size: 12px;
}

.table-of-contents {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 32px;
}

.table-of-contents h3 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
    border: none;
    padding: 0;
}

.table-of-contents ul {
    list-style: none;
    padding: 0 !important;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 4px;
}

.table-of-contents ul li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.table-of-contents ul li a:hover {
    background: var(--primary-subtle);
    color: var(--primary-color);
}

.table-of-contents ul li a i {
    font-size: 12px;
    color: var(--text-muted);
    width: 16px;
}

footer.doc-footer {
    text-align: center;
    padding: 24px;
    border-top: 1px solid var(--border-color);
    margin-top: 16px;
}

footer.doc-footer p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.sidebar-toggler {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}

@media (max-width: 991px) {
    .sidebar-toggler {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    [dir="rtl"] .sidebar {
        transform: translateX(100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content-wrapper {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .content-container {
        padding: 16px;
    }

    .doc-section-header {
        padding: 16px;
    }

    .doc-section-body {
        padding: 16px;
    }

    .table-of-contents ul {
        grid-template-columns: 1fr;
    }

    .feature-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 576px) {
    .top-bar {
        padding: 0 12px;
        gap: 8px;
    }

    .top-bar .page-title {
        font-size: 15px;
    }

    .content-container {
        padding: 12px;
    }

    .doc-section-header .section-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .doc-section-header .section-title h2 {
        font-size: 15px;
    }
}

.lang-hide {
    display: none !important;
}

kbd {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-family: inherit;
    color: var(--text-secondary);
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 1px 0 var(--border-color);
}

.badge-doc {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-doc.success { background: var(--status-success-bg); color: var(--status-success-text); }
.badge-doc.info { background: var(--status-info-bg); color: var(--status-info-text); }
.badge-doc.warning { background: var(--status-warning-bg); color: var(--status-warning-text); }

.flow-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 16px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 16px;
}

.flow-diagram .flow-step {
    padding: 8px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.flow-diagram .flow-step.active-step {
    background: var(--primary-color);
    color: var(--text-inverse);
    border-color: var(--primary-color);
}

.flow-diagram .flow-arrow {
    color: var(--text-muted);
    font-size: 14px;
}
