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

:root {
    --primary: #121d2f; /* كحلي ملكي قانوني */
    --secondary: #b08d4a; /* ذهبي فخم */
    --accent: #f4f7f9;
    --text-main: #2c3e50;
    --text-muted: #5d6d7e;
    --white: #ffffff;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Cairo', sans-serif;
    line-height: 1.8;
    color: var(--text-main);
    background-color: var(--white);
    direction: rtl;
    overflow-x: hidden; /* منع التمرير الأفقي تماماً */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & Navigation */
header {
    background: var(--white);
    border-bottom: 3px solid var(--accent);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 1;
    min-width: 0; /* يسمح للوجو بالتقلص ولا يخرج عن الحاوية */
}

.logo img {
    height: 50px;
    width: auto;
    flex-shrink: 0;
}

.logo-text {
    overflow: hidden;
}

.logo-text .logo-name {
    display: block;
    font-weight: 800;
    color: var(--primary);
    font-size: 1.1rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logo-text .logo-sub {
    color: var(--secondary);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

nav.desktop-nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
}

nav.desktop-nav a {
    text-decoration: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
    transition: 0.3s;
}

nav.desktop-nav a:hover {
    color: var(--secondary);
}

/* Hero Section */
.hero-section {
    background: var(--accent);
    padding: 40px 0;
    border-bottom: 1px solid #e2e8f0;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 30px;
    align-items: center;
}

.hero-title {
    font-size: 2.2rem;
    color: var(--primary);
    margin-bottom: 20px;
    font-weight: 800;
    line-height: 1.3;
    overflow-wrap: break-word;
}

.hero-desc {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 30px;
    line-height: 1.7;
}

.hero-btns {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-main, .btn-secondary {
    padding: 12px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    transition: 0.3s;
    display: inline-block;
    text-align: center;
}

.btn-main {
    background: var(--primary);
    color: white !important;
    border: 2px solid var(--primary);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-main:hover, .btn-secondary:hover {
    background: var(--secondary);
    border-color: var(--secondary);
    color: white !important;
}

.hero-image-wrapper {
    text-align: center;
}

.hero-img {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 4px solid white;
}

/* Article Content & Typography */
.content {
    width: 100%;
    overflow: hidden; /* لضمان عدم خروج أي عناصر داخلية */
}

.content h2 {
    color: var(--primary);
    font-size: 1.6rem;
    margin: 35px 0 15px;
    padding-right: 12px;
    border-right: 4px solid var(--secondary);
    line-height: 1.4;
}

.content h3 {
    font-size: 1.3rem;
    margin: 25px 0 10px;
    color: var(--primary);
}

.content p {
    margin-bottom: 18px;
    font-size: 1.05rem;
    text-align: justify;
    color: #34495e;
    max-width: 100%;
}

.content ul {
    margin: 0 20px 20px 0;
}

.content li {
    margin-bottom: 10px;
}

/* Grid & Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.card {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #eee;
    text-decoration: none;
    transition: 0.3s;
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: var(--secondary);
}

/* Table of Contents */
.toc {
    background: #fdfdfd;
    padding: 20px;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    margin: 30px 0;
    width: 100%;
}

.toc h4 {
    margin-bottom: 10px;
    color: var(--primary);
}

.toc ul {
    list-style: none;
    padding: 0;
}

.toc-link {
    display: block;
    padding: 5px 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 15px;
}

.modal-box {
    background: white;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    border-radius: 15px;
    position: relative;
    padding: 30px;
    overflow-y: auto;
}

/* Footer Styles */
footer {
    background: var(--primary);
    color: var(--white);
    padding: 50px 0 30px;
    margin-top: 50px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.footer-col h4 {
    color: var(--secondary);
    margin-bottom: 15px;
}

.footer-col ul {
    list-style: none;
}

.footer-col a {
    color: #cbd5e0;
    text-decoration: none;
    font-size: 0.85rem;
}

/* Mobile Sticky Footer */
.mobile-sticky-footer {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
    z-index: 4000;
}

.sticky-flex {
    display: flex;
    height: 60px;
}

.sticky-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 800;
    font-size: 0.9rem;
    gap: 6px;
}

.btn-phone { background: var(--primary); color: white !important; }
.btn-whatsapp { background: #25d366 !important; color: white !important; }

/* Sidebar Mobile */
.sidebar {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: var(--white);
    z-index: 5000;
    transition: 0.3s;
    padding: 50px 20px;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
}

.sidebar.active {
    right: 0;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--primary);
    cursor: pointer;
}

/* Responsive Adjustments */
@media (max-width: 991px) {
    .hero-grid { gap: 20px; }
    .hero-title { font-size: 1.8rem; }
}

@media (max-width: 768px) {
    .container { padding: 0 15px; }
    .hero-grid { grid-template-columns: 1fr; text-align: center; }
    .hero-title { font-size: 1.6rem; }
    .hero-btns { justify-content: center; }
    .hero-image-wrapper { order: -1; }
    .hero-img { max-width: 280px; }
    .desktop-nav { display: none; }
    .mobile-toggle { display: block; }
    .mobile-sticky-footer { display: block; }
    body { padding-bottom: 60px; }
    
    .content h2 { font-size: 1.4rem; }
    .content p { font-size: 1rem; text-align: right; } /* إلغاء التوسيط في الموبايل لجمالية القراءة */
    
    .logo img { height: 40px; }
    .logo-text .logo-name { font-size: 1rem; }
}

@media (max-width: 480px) {
    .hero-title { font-size: 1.4rem; }
    .hero-desc { font-size: 1rem; }
    .btn-main, .btn-secondary { width: 100%; }
    .logo-text { display: none; } /* إخفاء نص اللوجو في الهواتف الصغيرة جداً لتوفير مساحة */
}
