* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans Arabic', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}
[dir="rtl"] body {
    font-family: 'Segoe UI', 'Noto Sans Arabic', 'Arial', sans-serif;
}
.container { 
    max-width: 1400px; 
    margin: 0 auto; 
    display: flex;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}
nav { 
    width: 280px;
    background: linear-gradient(180deg, #2c3e50 0%, #54789c 100%);
    color: white;
    padding: 25px;
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}
.nav-logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 20px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.nav-logo-wrapper a {
    display: block;
    padding: 0;
    border-bottom: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.nav-logo-wrapper a:hover {
    opacity: 0.9;
    transform: scale(1.02);
}
.nav-logo-wrapper img {
    max-width: 100%;
    height: auto;
    max-height: 48px;
    object-fit: contain;
}
nav a {
    color: #ecf0f1;
    text-decoration: none;
    display: block;
    padding: 8px 0;
    border-bottom: 1px solid #34495e;
}
nav a:hover {
    color: #3498db;
}
nav h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #3498db;
}
.search-box {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid #34495e;
    border-radius: 4px;
    background: #34495e;
    color: white;
    font-size: 14px;
}
.search-box::placeholder {
    color: #95a5a6;
}
.search-box:focus {
    outline: none;
    border-color: #3498db;
    background: #2c3e50;
}
nav .nav-item {
    display: block;
}
nav .nav-item.hidden {
    display: none;
}
nav .nav-section.hidden {
    display: none;
}
.content {
    flex: 1;
    padding: 40px;
    overflow-x: auto;
    background: white;
}
.content h1 {
    border-bottom: 3px solid #667eea;
    padding-bottom: 15px;
    margin-bottom: 30px;
    color: #2c3e50;
    font-size: 2.5em;
    font-weight: 700;
}
.content h2 {
    margin-top: 40px;
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.8em;
    font-weight: 600;
    border-left: 4px solid #667eea;
    padding-left: 15px;
}
[dir="rtl"] .content h2 {
    border-left: none;
    border-right: 4px solid #667eea;
    padding-left: 0;
    padding-right: 15px;
}
.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    direction: ltr;
}
[dir="rtl"] .content table {
    direction: rtl;
}
.content table th,
.content table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}
[dir="rtl"] .content table th,
[dir="rtl"] .content table td {
    text-align: right;
}
.content table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
}
.content table tr:nth-child(even) {
    background: #f9f9f9;
}
.content table tr:hover {
    background: #f0f0f0;
    transition: background 0.2s ease;
}
.content code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}
.content pre {
    background: #f4f4f4;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
}
.back-link {
    margin-bottom: 20px;
}
.back-link a {
    color: #3498db;
    text-decoration: none;
}
.back-link a:hover {
    text-decoration: underline;
}
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    .content {
        padding-top: 68px;
    }

    /* Mobile hamburger button */
    #nav-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 1002;
        width: 44px;
        height: 44px;
        padding: 0;
        border: none;
        border-radius: 8px;
        background: linear-gradient(180deg, #2c3e50 0%, #54789c 100%);
        color: white;
        cursor: pointer;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        transition: background 0.2s, transform 0.2s;
    }
    #nav-mobile-toggle:hover {
        background: linear-gradient(180deg, #34495e 0%, #5a7aa8 100%);
    }
    #nav-mobile-toggle:active {
        transform: scale(0.96);
    }
    [dir="rtl"] #nav-mobile-toggle {
        left: auto;
        right: 12px;
    }

    /* Hamburger icon (3 lines) */
    #nav-mobile-toggle .hamburger-icon {
        display: flex;
        flex-direction: column;
        gap: 5px;
        width: 22px;
    }
    #nav-mobile-toggle .hamburger-icon span {
        display: block;
        height: 2px;
        background: currentColor;
        border-radius: 1px;
        transition: opacity 0.2s, transform 0.2s;
    }
    #nav-mobile-toggle .close-icon {
        display: none;
        font-size: 28px;
        line-height: 1;
        font-weight: 300;
    }
    body.nav-open #nav-mobile-toggle .hamburger-icon {
        display: none;
    }
    body.nav-open #nav-mobile-toggle .close-icon {
        display: block;
    }

    /* Overlay */
    #nav-overlay {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 999;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        transition: opacity 0.25s ease;
    }
    body.nav-open #nav-overlay {
        display: block;
        opacity: 1;
    }

    /* Nav as sliding drawer */
    nav {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        padding: 60px 25px 25px;
        transform: translateX(-100%);
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        box-shadow: none;
    }
    [dir="rtl"] nav {
        left: auto;
        right: 0;
        transform: translateX(100%);
    }
    body.nav-open nav {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
    }
    [dir="rtl"] body.nav-open nav {
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.25);
    }

    .nav-logo-wrapper {
        padding: 0 0 16px;
        margin-bottom: 12px;
    }
    .nav-logo-wrapper img {
        max-height: 40px;
    }
}

/* Hide mobile toggle and overlay on desktop */
@media (min-width: 769px) {
    #nav-mobile-toggle,
    #nav-overlay {
        display: none !important;
    }
}
