/*
Theme Name: المدار نيوز (Al-Madar News)
Theme URI: https://example.com/al-madar-news
Author: Your Name
Author URI: https://example.com
Description: قالب إخباري عصري ومتطور مع صلاحيات كاملة لإدارة الأخبار العاجلة وآراء الكتاب.
Version: 4.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: news, blog, rtl, responsive-layout, two-columns, custom-menu, featured-images
Text Domain: al-madar-news
*/

/* --- CSS Variables --- */
:root {
    --primary-dark: #0a2463;
    --primary-blue: #4facfe;
    --accent-light: #d8e3e7;
    --text-color: #2d3436;
    --light-text-color: #636e72;
    --bg-color: #ffffff;
    --breaking-news-red: #e53935;
    --heading-font: 'Almarai', sans-serif;
    --body-font: 'Cairo', sans-serif;
    --page-bg: #f8f9fa;
}

/* --- Global Styles & Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--body-font);
    background-color: var(--page-bg);
    color: var(--text-color);
    line-height: 1.7;
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 25px;
}

a {
    color: var(--primary-blue);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--heading-font);
    font-weight: 800;
    line-height: 1.2;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Navigation (Unchanged from previous version) --- */
.main-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; background-color: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); padding: 15px 0; box-shadow: 0 2px 10px rgba(0,0,0,0.05); transition: all 0.3s ease; }
.main-nav.solid { background-color: rgba(10, 36, 99, 0.98); padding: 10px 0; }
.nav-content { display: flex; justify-content: space-between; align-items: center; }
.logo { font-family: var(--heading-font); font-size: 28px; font-weight: 900; color: var(--primary-dark); display: flex; align-items: center; gap: 10px; }
.logo a { color: inherit; display: flex; align-items: center; }
.logo-news-icon { display: flex; justify-content: center; align-items: center; width: 40px; height: 40px; background-color: var(--primary-dark); color: #fff; border-radius: 50%; font-family: 'Cairo', sans-serif; font-weight: 900; font-size: 10px; transition: background-color 0.3s ease, color 0.3s ease; }
.main-nav.solid .logo { color: #fff; }
.main-nav.solid .logo-news-icon { background-color: #fff; color: var(--primary-dark); }
.main-navigation { flex-grow: 1; text-align: center; }
.main-navigation ul { list-style: none; display: flex; justify-content: center; gap: 30px; margin: 0; padding: 0; }
.main-navigation a { color: var(--primary-dark); font-weight: 700; font-size: 16px; transition: color 0.3s; }
.main-nav.solid .main-navigation a { color: #fff; }
.main-navigation a:hover { color: var(--primary-blue); text-decoration: none; }
.nav-actions { display: flex; gap: 20px; align-items: center; }
.nav-actions a { color: var(--primary-dark); font-size: 18px; transition: transform 0.2s; }
.main-nav.solid .nav-actions a { color: #fff; }
.nav-actions a:hover { transform: scale(1.2); }
.mobile-menu-toggle { display: none; color: var(--primary-dark); font-size: 24px; cursor: pointer; }
.main-nav.solid .mobile-menu-toggle { color: #fff; }

/* --- Hero Section (Unchanged) --- */
.hero { margin-top: 82px; height: 100vh; position: relative; display: flex; align-items: center; justify-content: center; text-align: center; color: #fff; overflow: hidden; }
.hero video { position: absolute; top: 50%; left: 50%; min-width: 100%; min-height: 100%; width: auto; height: auto; transform: translateX(-50%) translateY(-50%); z-index: -1; }
@media (max-width: 768px) { .hero video { display: none; } .hero { background: linear-gradient(rgba(10, 36, 99, 0.7), rgba(10, 36, 99, 0.7)), url('https://placehold.co/1920/1080') no-repeat center center/cover; } }
.hero-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(rgba(10, 36, 99, 0.5), rgba(10, 36, 99, 0.7)); z-index: -1; }
.hero-content { position: relative; z-index: 1; }
.hero-content h1 { font-size: clamp(2.5rem, 8vw, 5rem); margin-bottom: 20px; text-shadow: 2px 2px 15px rgba(0,0,0,0.7); }
.hero-content p { font-size: clamp(1rem, 2vw, 1.5rem); max-width: 800px; margin: 0 auto 30px auto; color: var(--accent-light); text-shadow: 1px 1px 8px rgba(0,0,0,0.5); }
.cta-button { display: inline-block; background-color: var(--primary-blue); color: #fff; padding: 15px 35px; border-radius: 50px; font-weight: 700; font-size: 16px; transition: background-color 0.3s, transform 0.3s; box-shadow: 0 4px 15px rgba(62, 146, 204, 0.4); }
.cta-button:hover { background-color: var(--primary-dark); color: #fff; text-decoration: none; transform: translateY(-3px); box-shadow: 0 6px 20px rgba(62, 146, 204, 0.6); }

/* ======================= ENHANCED: PROFESSIONAL BREAKING NEWS TICKER ======================= */
.breaking-news-ticker {
    background: linear-gradient(90deg, var(--breaking-news-red), #d32f2f);
    padding: 12px 0;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(229, 57, 53, 0.4);
    position: relative;
    transition: transform 0.4s ease, opacity 0.4s ease;
}
/* NEW: Class to hide the ticker */
.breaking-news-ticker.ticker-hidden {
    transform: translateY(-100%);
    opacity: 0;
}
.breaking-news-ticker .container {
    display: flex;
    align-items: center;
    position: relative;
}
.ticker-label {
    background-color: #fff;
    color: var(--breaking-news-red);
    padding: 6px 22px;
    font-family: var(--heading-font);
    font-weight: 900;
    font-size: 18px;
    border-radius: 4px;
    margin-left: 20px;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: glow 2s ease-in-out infinite;
}
@keyframes glow {
    0%, 100% { box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
    50% { box-shadow: 0 2px 15px rgba(229, 57, 53, 0.6); }
}
.ticker-label i {
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
.ticker-content-wrapper {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
}
.ticker-content {
    display: flex;
    animation: scroll-left 30s linear infinite;
    white-space: nowrap;
}
.ticker-content-item {
    padding: 0 50px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}
.ticker-content-item a {
    color: #fff;
    transition: color 0.2s;
}
.ticker-content-item a:hover {
    color: #ffebee;
}
@keyframes scroll-left {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* NEW: Ticker Close Button */
.ticker-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 15px;
    transition: color 0.2s, transform 0.2s;
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}
.ticker-close-btn:hover {
    color: #fff;
    transform: translateY(-50%) scale(1.2);
}


/* --- Content Sections (Unchanged) --- */
main { padding-top: 2px; }
.content-section { padding: 80px 0; }
.section-title { font-size: 36px; margin-bottom: 40px; position: relative; padding-bottom: 15px; display: inline-block; }
.section-title::after { content: ''; position: absolute; bottom: 0; right: 0; width: 80px; height: 4px; background-color: var(--primary-blue); }

/* --- Article Cards (Homepage - Unchanged) --- */
.standard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 30px; }
.article-card { background-color: var(--bg-color); border-radius: 12px; overflow: hidden; box-shadow: 0 8px 25px rgba(0,0,0,0.08); transition: transform 0.3s ease, box-shadow 0.3s ease; cursor: pointer; border: 1px solid var(--accent-light); display: flex; flex-direction: column; height: 100%; }
.article-card:hover { transform: translateY(-8px); box-shadow: 0 15px 35px rgba(0,0,0,0.12); }
.article-card .image-wrapper { overflow: hidden; height: 200px; flex-shrink: 0; }
.article-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.article-card:hover img { transform: scale(1.08); }
.article-card-content { padding: 25px; display: flex; flex-direction: column; flex-grow: 1; }
.article-card-content h3 { font-size: 20px; margin-bottom: 10px; color: var(--primary-dark); flex-shrink: 0; }
.article-card-content p { color: var(--light-text-color); font-size: 15px; margin-bottom: 15px; flex-grow: 1; }
.article-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--light-text-color); padding-top: 15px; border-top: 1px solid var(--accent-light); margin-top: auto; flex-shrink: 0; }
.article-meta-item { display: flex; align-items: center; gap: 8px; }
.article-meta-item i { color: var(--primary-blue); }
.article-meta-item.author { font-weight: 700; }
.article-meta-item.author:hover { color: var(--primary-blue); }

/* --- Horizontal Scrolling Section (Unchanged) --- */
.horizontal-section { background-color: var(--accent-light); padding: 60px 0; }
.scroll-container { display: flex; gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 20px; }
.scroll-container::-webkit-scrollbar { height: 8px; }
.scroll-container::-webkit-scrollbar-track { background: #ddd; border-radius: 10px; }
.scroll-container::-webkit-scrollbar-thumb { background: var(--primary-blue); border-radius: 10px; }
.scroll-item { min-width: 300px; scroll-snap-align: start; }
.opinion-card { background-color: #fff; padding: 30px; border-radius: 12px; display: flex; align-items: center; gap: 20px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.opinion-card img { width: 70px; height: 70px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.opinion-card-content h4 { font-size: 18px; margin-bottom: 5px; }
.opinion-card-content .author { font-size: 14px; color: var(--primary-blue); }

/* ======================= ULTRA-MODERN & EYE-CATCHING SINGLE POST PAGE (Unchanged from previous version) ======================= */
.reading-progress-bar { position: fixed; top: 0; left: 0; height: 4px; background: linear-gradient(to left, #4facfe 0%, #00f2fe 100%); z-index: 10000; transition: width 0.2s ease; }
.single-article-wrapper { margin-top: 82px; }
.post-hero-image img { width: 100%; height: 60vh; object-fit: cover; }
.post-container { background-color: #fff; padding: 60px; margin: -60px auto 0 auto; max-width: 800px; position: relative; z-index: 1; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,0.08); }
.post-header { text-align: center; margin-bottom: 50px; border-bottom: 1px solid var(--accent-light); padding-bottom: 40px; }
.post-title { font-size: 3.2rem; font-weight: 900; line-height: 1.2; color: var(--primary-dark); margin-bottom: 20px; }
.post-meta { font-size: 15px; color: var(--light-text-color); }
.post-meta span { margin-left: 20px; position: relative; }
.post-meta i { color: var(--primary-blue); margin-left: 5px; }
.post-body-wrapper { display: grid; grid-template-columns: 250px 1fr; gap: 50px; }
.post-toc { position: sticky; top: 100px; align-self: start; }
.post-toc h4 { font-size: 16px; font-weight: 800; margin-bottom: 15px; color: var(--primary-dark); }
.post-toc h4 i { color: var(--primary-blue); margin-left: 8px; }
.post-toc ul { list-style: none; border-right: 2px solid var(--primary-blue); padding-right: 15px; }
.post-toc li { margin-bottom: 10px; }
.post-toc a { font-size: 14px; color: var(--light-text-color); font-weight: 600; transition: all 0.2s ease; display: inline-block; position: relative; }
.post-toc a:hover { color: var(--primary-blue); transform: translateX(-5px); }
.post-toc i { margin-left: 5px; transition: transform 0.2s ease; }
.post-toc a:hover i { transform: translateX(3px); }
.post-content { font-size: 20px; line-height: 1.9; color: #333; }
.post-content p:first-of-type::first-letter { float: right; font-family: var(--heading-font); font-size: 6rem; line-height: 1; font-weight: 900; margin: 0.05em 0.1em 0 0; color: var(--primary-blue); padding: 0.1em; text-shadow: 2px 2px 4px rgba(0,0,0,0.1); }
.post-content p { margin-bottom: 30px; }
.post-content a { position: relative; background: linear-gradient(to bottom, var(--primary-blue) 0%, var(--primary-blue) 100%); background-position: 0 100%; background-repeat: repeat-x; background-size: 2px 2px; text-decoration: none; transition: background-size 0.3s; }
.post-content a:hover { background-size: 2px 100%; }
.post-content h2 { font-size: 2rem; margin-top: 50px; margin-bottom: 25px; color: var(--primary-dark); border-right: 5px solid var(--primary-blue); padding-right: 15px; box-shadow: 5px 5px 15px rgba(79, 172, 254, 0.2); }
.post-content blockquote { margin: 40px 0; padding: 30px; background-color: var(--page-bg); border-right: 5px solid var(--primary-blue); font-size: 1.3rem; color: var(--light-text-color); font-style: italic; position: relative; }
.post-content blockquote::before { content: '\f10d'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; top: 10px; right: 15px; font-size: 2rem; color: rgba(79, 172, 254, 0.2); }
.post-footer { background-color: var(--page-bg); padding: 50px 0; margin-top: 80px; }
.author-bio { display: flex; align-items: center; gap: 25px; margin-bottom: 40px; }
.author-avatar img { width: 100px; height: 100px; border-radius: 50%; border: 4px solid var(--primary-blue); transition: transform 0.3s ease; }
.author-avatar:hover img { transform: scale(1.05); }
.author-details h4 { font-size: 20px; color: var(--primary-dark); margin-bottom: 5px; }
.author-details p { font-size: 15px; color: var(--light-text-color); }
.social-share { text-align: center; }
.social-share h4 { font-size: 18px; margin-bottom: 20px; color: var(--text-color); }
.social-share h4 i { color: var(--primary-blue); margin-left: 8px; }
.social-links a { display: inline-block; width: 50px; height: 50px; line-height: 50px; text-align: center; border-radius: 50%; color: #fff; margin: 0 10px; font-size: 18px; transition: all 0.3s ease; transform-style: preserve-3d; }
.social-links a:hover { transform: translateY(-5px) rotateY(360deg); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.social-links .facebook { background-color: #3b5998; }
.social-links .twitter { background-color: #1da1f2; }
.social-links .linkedin { background-color: #0077b5; }
.social-links .telegram { background-color: #0088cc; }

/* --- Responsive Design for Single Post (Unchanged) --- */
@media (max-width: 1024px) { .post-body-wrapper { grid-template-columns: 1fr; } .post-toc { margin-bottom: 40px; position: static; } }
@media (max-width: 768px) { .hero { height: 70vh; } .content-section { padding: 60px 0; } .section-title { font-size: 28px; } .post-container { padding: 40px 30px; margin-top: -40px; } .post-title { font-size: 2.2rem; } .post-content { font-size: 18px; } .post-content p:first-of-type::first-letter { font-size: 4rem; } .author-bio { flex-direction: column; text-align: center; } }
@media (max-width: 576px) { .nav-actions { display: none; } .main-nav { padding: 10px 0; height: 62px; } .main-nav.solid { height: 62px; } .single-article-wrapper { margin-top: 62px; } }

/* --- Footer (Unchanged) --- */
footer.main-footer { background-color: var(--primary-dark); color: #b2bec3; padding: 70px 0 30px 0; text-align: center; }
.footer-logo { font-size: 32px; color: #fff; margin-bottom: 20px; }
.footer-socials { margin-bottom: 30px; }
.footer-socials a { color: #b2bec3; margin: 0 10px; font-size: 20px; transition: color 0.3s; }
.footer-socials a:hover { color: var(--primary-blue); }
.footer-bottom { margin-top: 40px; padding-top: 30px; border-top: 1px solid #34495e; font-size: 14px; }

/* --- Responsive Design --- */
@media (max-width: 992px) {
    .main-navigation ul { display: none; position: absolute; top: 100%; right:0; background: var(--primary-dark); width: 100%; flex-direction: column; padding: 20px; box-shadow: 0 5px 10px rgba(0,0,0,0.1); }
    .main-navigation.toggled ul{display: flex;}
    .mobile-menu-toggle { display: block; }
    .main-navigation a { color: #fff; }
}