/* --- General Styles --- */
body {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif; /* Using Vazirmatn with fallbacks */
    line-height: 1.7;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    color: #333;
    direction: rtl; /* Right-to-left direction */
}

header {
    background-color: #007bff; /* Blue theme */
    color: #fff;
    padding: 1.5rem 1rem;
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    margin: 0;
    font-size: 1.8rem;
}

main {
    max-width: 900px; /* Limit content width */
    margin: 0 auto; /* Center content */
    padding: 0 1rem 2rem 1rem; /* Add padding */
}

section {
    background-color: #fff;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

h2 {
    color: #0056b3; /* Darker blue for headings */
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
    margin-top: 0;
    margin-bottom: 1rem;
}

h3 {
    color: #17a2b8; /* Teal for subheadings */
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}

/* --- Code Styling --- */
code {
    font-family: 'Vazirmatn Mono', Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; /* Monospace Vazir or fallbacks */
    background-color: #e9ecef; /* Light grey background */
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
    color: #c7254e; /* Pinkish color for inline code */
    direction: ltr; /* Keep code LTR even in RTL page */
    display: inline-block; /* Ensure background covers correctly */
}

pre {
    background-color: #282c34; /* Dark background for code blocks */
    color: #abb2bf; /* Light grey text color */
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto; /* Enable horizontal scrolling for long lines */
    direction: ltr; /* Ensure code block itself is LTR */
    text-align: left; /* Align text inside code block to left */
    white-space: pre; /* Preserve whitespace */
    font-size: 0.9em; /* Slightly smaller font for code */
    line-height: 1.5;
}

pre code {
    background-color: transparent; /* Override inline code background */
    padding: 0;
    color: inherit; /* Inherit color from pre */
    font-size: inherit;
    direction: ltr; /* Ensure code inside pre is LTR */
}

/* --- Lists --- */
ul, ol {
    padding-right: 2rem; /* Indentation for RTL */
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.5rem;
}

ul ul, ol ol, ul ol, ol ul {
     margin-top: 0.5rem;
}

/* --- Links --- */
a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* --- Footer --- */
footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    font-size: 0.9em;
    color: #6c757d; /* Grey color */
    border-top: 1px solid #dee2e6;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }
    main {
        padding: 0 0.5rem 1rem 0.5rem;
    }
    section {
        padding: 1rem;
    }
    pre {
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 15px; /* Slightly smaller base font */
    }
    header h1 {
        font-size: 1.3rem;
    }
    pre {
        font-size: 0.8em;
        padding: 0.8rem;
    }
    ul, ol {
        padding-right: 1.5rem;
    }
}