/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Arabic text support */
html[dir="rtl"] {
    font-family: 'Tahoma', 'Arial', sans-serif;
}

html[dir="rtl"] body {
    text-align: right;
    direction: rtl;
}

/* Header and Navigation */
.navbar {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #007bff;
}

.logo a {
    text-decoration: none;
    color: inherit;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-link {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    background-color: #007bff;
    color: white;
}

.locale-selector select {
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.locale-selector select:focus {
    outline: none;
    border-color: #007bff;
}

/* Main content */
.main-content {
    min-height: calc(100vh - 140px);
    padding: 40px 0;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Home page styles */
.page-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.link-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.link-card h3 {
    color: #007bff;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.link-card p {
    color: #666;
    margin-bottom: 20px;
}

.btn {
    display: inline-block;
    background: #007bff;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background: #0056b3;
}

/* Content pages */
.content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin-top: 20px;
}

.content h1 {
    color: #007bff;
    margin-bottom: 30px;
    font-size: 2.5rem;
    border-bottom: 3px solid #007bff;
    padding-bottom: 15px;
}

/* Rich text content styles */
.rich-text {
    font-size: 1.1rem;
    line-height: 1.8;
}

.rich-text h1,
.rich-text h2,
.rich-text h3,
.rich-text h4,
.rich-text h5,
.rich-text h6 {
    margin: 30px 0 15px 0;
    color: #333;
}

.rich-text h1 {
    font-size: 2rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.rich-text h2 {
    font-size: 1.6rem;
    color: #007bff;
}

.rich-text h3 {
    font-size: 1.4rem;
}

.rich-text p {
    margin-bottom: 20px;
}

.rich-text ul,
.rich-text ol {
    margin: 20px 0;
    padding-left: 30px;
}

.rich-text li {
    margin-bottom: 10px;
}

.rich-text a {
    color: #007bff;
    text-decoration: none;
}

.rich-text a:hover {
    text-decoration: underline;
}

.rich-text blockquote {
    border-left: 4px solid #007bff;
    margin: 20px 0;
    padding: 15px 20px;
    background: #f8f9fa;
    font-style: italic;
}

.rich-text code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.rich-text pre {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 20px 0;
}

.rich-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.rich-text th,
.rich-text td {
    border: 1px solid #e9ecef;
    padding: 12px;
    text-align: left;
}

.rich-text th {
    background: #f8f9fa;
    font-weight: bold;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #666;
    font-size: 1.1rem;
}

/* Error state */
.error {
    text-align: center;
    padding: 60px 20px;
    color: #dc3545;
}

.error h1 {
    margin-bottom: 15px;
}

/* Footer */
footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
}

/* RTL support */
html[dir="rtl"] .nav-menu {
    flex-direction: row-reverse;
}

html[dir="rtl"] .nav-container {
    flex-direction: row-reverse;
}

html[dir="rtl"] .rich-text ul,
html[dir="rtl"] .rich-text ol {
    padding-right: 30px;
    padding-left: 0;
}

html[dir="rtl"] .rich-text blockquote {
    border-right: 4px solid #007bff;
    border-left: none;
}

html[dir="rtl"] .rich-text th,
html[dir="rtl"] .rich-text td {
    text-align: right;
}

/* Responsive design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 15px 20px;
    }

    .nav-menu {
        margin-top: 15px;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .page-links {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 25px;
        margin-top: 15px;
    }

    .content h1 {
        font-size: 2rem;
    }

    .rich-text {
        font-size: 1rem;
    }

    .container {
        padding: 0 15px;
    }
}

@media (max-width: 480px) {
    .nav-menu {
        flex-direction: column;
        gap: 10px;
    }

    .content {
        padding: 20px 15px;
    }

    .content h1 {
        font-size: 1.8rem;
    }

    .link-card {
        padding: 20px;
    }
}
