/* تنسيقات خاصة بصفحات المقالات */
.article-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

.article-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.article-header {
    padding: 30px;
    border-bottom: 1px solid #eee;
}

.article-header h1 {
    font-size: 2.2em;
    color: #1c274c;
    margin-bottom: 15px;
    line-height: 1.3;
}

.article-meta {
    display: flex;
    gap: 20px;
    color: #666;
    font-size: 0.9em;
}

.article-meta i {
    margin-left: 5px;
    color: #007bff;
}

/* login */
.header-actions {
    display: flex;
    align-items: center;
}

.login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #ffd43b;
    color: #1c274c !important;
    padding: 10px 18px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.95rem;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.login-btn i {
    font-size: 1rem;
}

.login-btn:hover {
    background-color: #ffcc00;
    transform: translateY(-2px);
}


.article-image {
    height: 400px;
    overflow: hidden;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-body {
    padding: 30px;
    line-height: 1.8;
}

.article-body h2 {
    color: #1c274c;
    margin: 30px 0 15px;
    font-size: 1.6em;
    border: none;
    padding: 0;
}

.article-body h3 {
    color: #2c3e50;
    margin: 25px 0 10px;
    font-size: 1.3em;
}

.article-body p {
    margin-bottom: 15px;
    color: #333;
}

.article-body .intro {
    font-size: 1.1em;
    line-height: 1.8;
    color: #2c3e50;
    margin-bottom: 25px;
}

.article-tips {
    background: #f8f9fa;
    border-right: 4px solid #007bff;
    padding: 20px;
    margin: 30px 0;
    border-radius: 0 5px 5px 0;
}

.tips-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: center;
}

.tip-image {
    text-align: center;
}

.tip-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .tips-grid {
        grid-template-columns: 1fr;
    }

    .tip-image {
        order: -1;
        margin-bottom: 15px;
    }
}

.article-tips h3 {
    margin-top: 0;
    color: #1c274c;
}

.article-tips ul {
    padding-right: 20px;
}

.article-tips li {
    margin-bottom: 8px;
    position: relative;
    padding-right: 15px;
}

.article-tips li:before {
    content: '•';
    color: #007bff;
    position: absolute;
    right: 0;
}

.article-conclusion {
    background: #e8f4fd;
    padding: 20px;
    border-radius: 5px;
    margin: 30px 0;
    border-right: 4px solid #007bff;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-top: 1px solid #eee;
    background: #f9f9f9;
}

.back-to-articles {
    color: #007bff;
    font-weight: 600;
    transition: color 0.3s;
}

.back-to-articles:hover {
    color: #0056b3;
}

.back-to-articles i {
    margin-right: 5px;
}

.social-share {
    display: flex;
    align-items: center;
    gap: 10px;
}

.social-share span {
    color: #666;
    font-size: 0.9em;
}

.social-icon {
    color: #666;
    font-size: 1.2em;
    transition: color 0.3s;
}

.social-icon:hover {
    color: #007bff;
}

/* التنسيقات الأساسية وإعادة الضبط */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Cairo', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f7f9fb; /* خلفية هادئة */
    direction: rtl;
    text-align: right;
}

a {
    text-decoration: none;
    color: #007bff;
    transition: color 0.3s;
}

a:hover {
    color: #1c274c;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

section {
    padding: 50px 0;
}

h2 {
    font-size: 2.2em;
    color: #1c274c;
    border-bottom: 3px solid #007bff;
    padding-bottom: 10px;
    margin-bottom: 30px;
    text-align: right;
}

/* 2. الهيدر وشريط التنقل */
.main-header {
    background-color: #1c274c; /* أزرق غامق (Blue Navy) */
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    gap: 15px;
}

.logo .logo-image {
    height: 70px;
    width: 70px;
    margin-left: 10px;
    object-fit: contain;
}

.logo span {
    color: #ffd43b; /* لون ذهبي */
    line-height: 1;
}

.main-nav ul {
    list-style: none;
    display: flex;
}

.main-nav ul li a {
    color: #fff;
    padding: 15px 18px;
    display: block;
    font-weight: 600;
}

.main-nav ul li a:hover {
    background-color: #2b3962;
    color: #ffd43b;
}

.menu-toggle {
    display: none;

    /* (سيتم عرضه في التنسيق المستجيب) */
}

/* 3. الإعلان وشريط الأسعار */
.ad-banner-top {
    text-align: center;
    padding: 0;
    margin-bottom: 10px;
}

.ad-placeholder-horizontal {
    width: 100%;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    border: none;
    background-color: transparent;
}

.ad-placeholder-horizontal img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* شريط الأسعار الحي (Ticker) */
.price-ticker {
    direction: ltr; /* نعزل الشريط عن اتجاه الصفحة RTL عشان حساب الحركة يبقى صحيح */
    overflow: hidden;
    background-color: #34495e;
    color: #fff;
    white-space: nowrap;
    padding: 8px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    position: relative;
}

.ticker-content {
    display: inline-block;
    white-space: nowrap;
    padding-left: 100%;
    animation: ticker-scroll 35s linear infinite;
    will-change: transform;
}

@keyframes ticker-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

.price-ticker:hover .ticker-content {
    animation-play-state: paused;
}

.pair-item {
    padding: 0 20px;
    font-weight: 600;
    font-size: 1.05em;
    display: inline-block;
    direction: ltr;
}

.change {
    margin-right: 5px;
}

.up { color: #2ecc71; }
.down { color: #e74c3c; }

/* 4. البانر الجديد */
.hero-banner {
    background: linear-gradient(135deg, #1c274c, #2c3e50);
    border-radius: 12px;
    margin: 30px 0;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.banner-content {
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    position: relative;
}

.banner-text {
    flex: 1;
    padding: 40px;
    color: #fff;
    z-index: 2;
    text-align: right;
}

.banner-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    margin-bottom: 20px;
    font-weight: 600;
}

.banner-text h1 {
    font-size: 2.2em;
    margin: 0 0 20px 0;
    line-height: 1.3;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.banner-text p {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 30px;
    max-width: 500px;
    opacity: 0.9;
}

.banner-image {
    flex: 1;
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.banner-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0 0 0 50px;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.2);
}

.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ff6b35;
    color: #fff;
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1em;
    transition: all 0.3s ease;
    border: 2px solid #ff6b35;
    gap: 8px;
}

.cta-button:hover {
    background: transparent;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.3);
}

@media (max-width: 992px) {
    .banner-content {
        flex-direction: column-reverse;
        text-align: center;
    }

    .banner-text {
        padding: 30px 20px;
        text-align: center;
    }

    .banner-text h1 {
        font-size: 1.8em;
    }

    .banner-text p {
        margin-left: auto;
        margin-right: auto;
    }

    .banner-image {
        width: 100%;
        min-height: 250px;
    }

    .banner-image img {
        border-radius: 0;
    }
}

@media (max-width: 768px) {
    .banner-text {
        padding: 25px 15px;
    }

    .banner-text h1 {
        font-size: 1.6em;
        margin-bottom: 15px;
    }

    .banner-text p {
        font-size: 1em;
        margin-bottom: 20px;
    }

    .cta-button {
        padding: 10px 20px;
        font-size: 1em;
    }
}

/* 4. القسم الافتتاحي (Hero) */
.hero-section {
    position: relative;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #fff;
    padding: 20px 10px;
    text-align: right;
    border-radius: 10px;
    margin: 20px 0;
    box-shadow: 0 10px 20px rgba(0, 123, 255, 0.3);
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    min-height: 200px;
}

.hero-section > div {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px;
}

.hero-section h1 {
    font-size: 1.8em;
    margin: 0 0 10px 0;
    line-height: 1.3;
    padding: 0;
    word-wrap: break-word;
    white-space: normal;
    text-align: right;
    direction: rtl;
}

.hero-section p {
    padding: 0;
    margin: 0 0 20px 0;
    line-height: 1.6;
    font-size: 1em;
    max-width: 100%;
    text-align: right;
    direction: rtl;
}

.cta-button {
    display: inline-block;
    background-color: #ffd43b;
    color: #1c274c;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: bold;
    transition: all 0.3s;
    margin: 10px 0;
    font-size: 0.9em;
}

@media (min-width: 768px) {
    .hero-section {
        padding: 60px 40px;
    }

    .hero-section h1 {
        font-size: 2.5em;
        margin-bottom: 20px;
    }

    .hero-section p {
        font-size: 1.1em;
        margin-bottom: 25px;
    }

    .cta-button {
        padding: 12px 30px;
        font-size: 1.1em;
    }
}

@media (min-width: 1024px) {
    .hero-section h1 {
        font-size: 3em;
    }

    .hero-section {
        padding: 80px 40px;
    }
}

.cta-button:hover {
    background-color: #ffcd38;
}

/* 5. هيكل المحتوى والشريط الجانبي */
.content-and-sidebar {
    display: flex;
    gap: 30px;
}

.main-content {
    flex: 3;
    min-width: 0;
}

.sidebar {
    flex: 1;
    min-width: 280px;
}

/* 6. تنسيقات الأخبار والمقالات (Cards) */
.news-container, .articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.news-item, .article-card {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid #eee;
}

.news-item:hover, .article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.article-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 15px;
    max-width: 100%;
    display: block;
}

.article-card p {
    color: #555;
    margin: 0 0 12px 0;
    line-height: 1.6;
    flex-grow: 1;
    font-size: 0.95em;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 4.8em;
    line-clamp: 3;
}

.article-card h3 {
    color: #1c274c;
    margin: 0 0 12px 0;
    font-size: 1.2em;
    line-height: 1.4;
    min-height: 3.2em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-height: 3.2em;
    line-clamp: 2;
}

.read-full-article {
    display: block;
    margin-top: auto;
    padding: 12px 15px;
    font-weight: bold;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 5px;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.read-full-article i {
    font-size: 0.8em;
    margin-right: 5px;
}

/* 7. قسم التحليل */
.analysis-card {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.analysis-chart-placeholder {
    background-color: #eaf1f7;
    height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #1c274c;
    border-radius: 5px;
    margin: 20px 0;
    font-weight: 600;
}

/* 8. قسم الأدوات */
.tools-section {
    background-color: #e6f7ff;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    margin-top: 30px;
}

.tools-grid {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-top: 30px;
}

.tool-card {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    flex: 1;
    border: 2px solid #007bff;
    font-weight: 600;
}

.tool-card i {
    font-size: 1.8em;
    color: #007bff;
    margin-bottom: 10px;
}

.ad-placeholder-sidebar {
    height: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px 0;
    border-radius: 6px;
    overflow: hidden;
}

.ad-placeholder-sidebar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ad-placeholder-sidebar.large {
    height: 400px;
}


.news-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 15px;
}

/* Start iframe */
.calendar-container {
    margin-top: 20px;
    background-color: #131722;
    border-radius: 8px;
    padding: 10px;
    height: 500px;
}

/* 10. الفوتر */
.main-footer {
    background-color: #1c274c;
    color: #ccc;
    text-align: center;
    padding: 30px 0;
    margin-top: 40px;
}

.main-footer a {
    color: #ffd43b;
    margin: 0 10px;
}


/* 11. تنسيقات الاستجابة (Responsive Design) */
@media (max-width: 992px) {
    .content-and-sidebar {
        flex-direction: column;
    }
    .sidebar {
        min-width: unset;
        order: -1; /* يظهر الشريط الجانبي في الأعلى في الأجهزة الصغيرة */
    }
}

@media (max-width: 768px) {
    /* تحسين البطاقات على الموبايل */
    .news-container, .articles-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 10px;
    }

    .news-item, .article-card {
        padding: 20px;
        margin: 0 0 20px 0;
        min-height: 200px;
        display: flex;
        flex-direction: column;
    }

    .article-card h3 {
        font-size: 1.3em;
        min-height: auto;
        margin-bottom: 12px;
        line-height: 1.4;
    }

    .article-card p {
        font-size: 1em;
        line-height: 1.6;
        margin-bottom: 15px;
        -webkit-line-clamp: 4;
        line-clamp: 4;
    }

    .read-full-article {
        font-size: 1em;
        padding: 12px 0;
        margin-top: auto;
        text-align: center;
        background-color: #f8f9fa;
        border-radius: 5px;
        transition: all 0.3s;
    }

    .read-full-article:hover {
        background-color: #e9ecef;
    }

    .main-nav {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 60px;
        right: 0;
        background-color: #1c274c;
        z-index: 999;
    }

    .main-nav.active {
        display: flex;
    }

    .main-nav ul {
        flex-direction: column;
    }

    .main-nav ul li a {
        padding: 10px 20px;
        text-align: right;
        border-bottom: 1px solid #2b3962;
    }

    .menu-toggle {
        display: block;
        background: none;
        border: none;
        color: #fff;
        font-size: 1.5em;
        cursor: pointer;
    }

    /* تحسين البطاقات على الموبايل */
    .news-container, .articles-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0 10px;
    }

    .news-item, .article-card {
        padding: 15px;
        margin: 0 0 15px 0;
    }

    .article-card h3 {
        font-size: 1.1em;
        min-height: auto;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        margin-bottom: 10px;
    }

    .article-card p {
        font-size: 0.9em;
        line-height: 1.5;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        margin-bottom: 10px;
    }

    .read-full-article {
        font-size: 0.9em;
        padding-top: 10px;
    }

    .hero-section h1 {
        font-size: 1.6em;
        margin-bottom: 10px;
    }

    .hero-section p {
        font-size: 0.95em;
        margin-bottom: 15px;
    }

    /* منع الشريط من الحركة الأفقية المزعجة في الهاتف */
    .price-ticker {
        overflow-x: scroll;
        padding: 5px 0;
    }

    .ticker-content {
        animation: none;
        padding-left: 20px;
    }

    .pair-item {
        font-size: 0.9em;
        padding: 0 12px;
    }

    .tools-grid {
        flex-direction: column;
        gap: 15px;
    }
}

/* ─── Code & Pre - Mobile Responsive ─── */
code, pre, kbd, samp {
    font-family: 'Courier New', Courier, monospace;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 4px;
}
code {
    padding: 2px 6px;
    font-size: 0.88em;
    word-break: break-all;
}
pre {
    padding: 12px 16px;
    overflow-x: auto;
    font-size: 0.85em;
    white-space: pre;
    max-width: 100%;
}
pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

@media (max-width: 768px) {
    code {
        font-size: 0.75em;
        padding: 1px 5px;
    }
    pre {
        font-size: 0.72em;
        padding: 10px 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: calc(100vw - 32px);
        white-space: pre;
    }
}

/* ─── Responsive Banners & Ads ─── */
img, .ad-placeholder-horizontal img, .ad-banner-top img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .ad-placeholder-horizontal img, .ad-banner-top img, img[src*="baner"], img[src*="banner"], img[src*="ad"] {
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain;
    }
}