:root {
    --bg-black: #0a0a0a;
    --card-black: #141414;
    --alt-black: #0f0f0f;
    --accent-yellow: #ffcc00;
    --accent-yellow-hover: #fde047;
    --accent-red: #ff3333;
    --text-white: #f1f1f1;
    --text-gray: #aaaaaa;
    --border-color: #262626;
    --header-h: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-black);
    color: var(--text-white);
    line-height: 1.7;
    direction: rtl;
}

:focus-visible {
    outline: 2px solid var(--accent-yellow);
    outline-offset: 3px;
}

section { scroll-margin-top: 90px; }

/* الهيدر */
header {
    background: rgba(10, 10, 10, 0.95);
    border-bottom: 2px solid var(--accent-yellow);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: var(--header-h);
    padding: 0 5%;
    transition: background 0.3s, box-shadow 0.3s;
}

header.scrolled {
    background: rgba(10, 10, 10, 0.98);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
}

.logo {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-white);
    text-decoration: none;
}
.logo span { color: var(--accent-yellow); }

nav ul {
    display: flex;
    list-style: none;
    gap: 25px;
}
nav ul li a {
    color: var(--text-white);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}
nav ul li a:hover, nav ul li a.active { color: var(--accent-yellow); }

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-white);
    width: 44px;
    height: 44px;
    border-radius: 6px;
    font-size: 1.2rem;
    cursor: pointer;
}
.nav-toggle:hover { color: var(--accent-yellow); border-color: var(--accent-yellow); }

/* الواجهة الرئيسية */
.hero {
    padding: 50px 20px 20px 20px;
    background: linear-gradient(135deg, rgba(20,20,20,0.9), rgba(10,10,10,0.95));
    border-bottom: 1px solid var(--border-color);
    margin-top: var(--header-h);
}

.hero-home {
    padding: 80px 8% 70px;
}
.hero-content { max-width: 760px; }
.hero-home h1 {
    font-size: clamp(1.8rem, 4.5vw, 3rem);
    font-weight: 900;
    line-height: 1.35;
    margin-bottom: 16px;
}
.hero-home p {
    color: var(--text-gray);
    font-size: 1.1rem;
    max-width: 60ch;
    margin-bottom: 30px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 26px;
    border-radius: 6px;
    font-weight: 700;
    text-decoration: none;
    border: 2px solid transparent;
    transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.btn-youtube { background: var(--accent-red); color: #fff; }
.btn-youtube:hover { background: #e02b2b; }
.btn-outline { border-color: var(--accent-yellow); color: var(--accent-yellow); }
.btn-outline:hover { background: var(--accent-yellow); color: #000; }

/* الأقسام العامة */
.section-container { padding: 80px 8%; }
.section-container[hidden] { display: none; }

.section-title {
    text-align: right;
    font-size: 2.2rem;
    margin-bottom: 40px;
    font-weight: 900;
}
.section-title span { color: var(--accent-yellow); }

/* شبكة الأقسام */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.cat-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    background-color: var(--card-black);
    border: 1px solid var(--border-color);
    border-right: 4px solid var(--accent-yellow);
    padding: 22px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-white);
    transition: transform 0.3s, border-color 0.3s, background-color 0.3s;
}
.cat-card:hover {
    transform: translateY(-4px);
    border-right-color: var(--accent-yellow-hover);
    background-color: #1a1a1a;
}
.cat-card i { font-size: 1.4rem; color: var(--accent-yellow); }
.cat-card h3 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.cat-card p { color: var(--text-gray); font-size: 0.9rem; line-height: 1.6; }

/* أحدث الفيديوهات */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.video-card {
    display: block;
    text-decoration: none;
    color: var(--text-white);
    background: var(--card-black);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.3s;
}
.video-card:hover { border-color: var(--accent-yellow); }
.video-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.video-card span { display: block; padding: 12px 14px; font-weight: 600; }

/* نموذج التواصل */
#form-msg { display: none; }
#form-msg.error { color: var(--accent-red); }

/* الفوتر */
footer {
    background-color: #050505;
    border-top: 2px solid var(--border-color);
    padding: 50px 8% 20px;
    text-align: right;
}
.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}
.footer-col h3, .footer-col h4 { margin-bottom: 15px; color: var(--text-white); }
.footer-col h3 span { color: var(--accent-yellow); }
.footer-col p { color: var(--text-gray); font-size: 0.9rem; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a {
    color: var(--text-gray);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}
.footer-col ul li a:hover { color: var(--accent-yellow); }
.footer-bottom {
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    color: var(--text-gray);
    font-size: 0.85rem;
}
.footer-bottom span { color: var(--accent-yellow); }

/* ==================== صفحة المقال المعدلة ==================== */
.post-page {
    max-width: 1350px;
    width: 95%;
    margin: 0 auto;
    padding: calc(var(--header-h) + 30px) 20px 60px;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--text-gray);
    margin-bottom: 20px;
}
.breadcrumb a { color: var(--text-gray); text-decoration: none; transition: color 0.3s; }
.breadcrumb a:hover { color: var(--accent-yellow); }

.post-card {
    background: var(--card-black);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--accent-yellow);
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
}

.post-cover {
    width: 100%;
    max-height: 550px;
    object-fit: cover;
    display: block;
}

.post-body { 
    padding: 35px clamp(20px, 5vw, 60px) 50px;
}

.post-badge {
    display: inline-block;
    background: rgba(255, 204, 0, 0.1);
    color: var(--accent-yellow);
    border: 1px solid rgba(255, 204, 0, 0.35);
    padding: 4px 16px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}

.post-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 900;
    line-height: 1.45;
    margin: 16px 0 12px;
}

.post-meta {
    color: var(--text-gray);
    font-size: 0.95rem;
    padding-bottom: 18px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.post-video {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    margin-bottom: 30px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border-color);
}
.post-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* محتوى النص والأكواد المضمنة */
.post-content { 
    font-size: 1.15rem; 
    color: #d8d8d8; 
    line-height: 1.8;
}
.post-content p { margin-bottom: 1.4em; }
.post-content a { color: var(--accent-yellow); }
.post-content img { max-width: 100%; border-radius: 6px; }

.post-html-frame {
    width: 100%;
    min-height: 500px;
    border: 0;
    display: block;
    border-radius: 6px;
}

.post-back { margin-top: 35px; }

/* كروت المدونة */
.blog-card {
    background: var(--card-black);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s, border-color 0.3s;
}

.blog-card:hover {
    border-color: var(--accent-yellow);
    transform: translateY(-3px);
}

.blog-thumbnail {
    position: relative;
    width: 100%;
    height: 170px;
    background-color: #000;
    overflow: hidden;
}

.blog-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-thumbnail img {
    transform: scale(1.05);
}

.blog-thumbnail .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 0, 0, 0.85);
    color: #fff;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 0 12px rgba(0,0,0,0.5);
}

.blog-card-body {
    padding: 15px;
    flex-grow: 1;
}

.blog-card-footer {
    padding: 10px 15px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-actions {
    display: flex;
    gap: 6px;
}

.btn-edit {
    background: var(--accent-yellow);
    color: #000;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    text-decoration: none;
    font-weight: bold;
}

.btn-delete {
    background: #ff3333;
    color: #fff;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: bold;
}

/* ==================== قسم التعليقات ==================== */
.comments-section {
    margin-top: 40px;
    background: var(--card-black);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 30px;
}

.comments-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-white);
    border-bottom: 2px solid var(--accent-yellow);
    display: inline-block;
    padding-bottom: 5px;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.comment-form input,
.comment-form textarea {
    width: 100%;
    background: var(--bg-black);
    border: 1px solid var(--border-color);
    color: var(--text-white);
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.comment-form input:focus,
.comment-form textarea:focus {
    border-color: var(--accent-yellow);
    outline: none;
}

.comment-card {
    background: var(--alt-black);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 15px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-bottom: 8px;
}

.comment-author {
    font-weight: 700;
    color: var(--accent-yellow);
}

.comment-text {
    font-size: 0.98rem;
    color: var(--text-white);
    line-height: 1.6;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }

    nav {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        background: rgba(10, 10, 10, 0.98);
        border-bottom: 2px solid var(--accent-yellow);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    nav.open { max-height: 400px; }
    nav ul { flex-direction: column; gap: 0; padding: 8px 5%; }
    nav ul li a { display: block; padding: 14px 0; border-bottom: 1px solid var(--border-color); }
    nav ul li:last-child a { border-bottom: none; }

    .hero-home { padding: 50px 6% 45px; }
    .section-container { padding: 55px 6%; }
    .section-title { font-size: 1.8rem; }

    .post-page { 
        width: 100%;
        padding: calc(var(--header-h) + 18px) 12px 40px; 
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}