/* Main Theme CSS - AkhbarTec Trend */
:root {
    --bg-dark: #050505;
    --bg-card: #0f0f0f;
    --primary: #ff3e3e;
    --primary-hover: #e63535;
    --accent: #00d2ff;
    --text-main: #ffffff;
    --text-muted: #b0b0b0;
    --border: #222222;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(0,0,0,0.5);
    --font-main: 'Tajawal', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    line-height: 1.6;
    direction: rtl;
    text-align: right;
}

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

/* Header */
header.main-header {
    background: rgba(15,15,15,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Header Tools & Search */
.header-tools {
    display: flex;
    align-items: center;
}

.search-form {
    display: flex;
    background: #1a1a1a;
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 5px 15px;
    transition: 0.3s;
}

.search-form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(255, 62, 62, 0.2);
}

.search-form input {
    background: none;
    border: none;
    color: white;
    padding: 5px;
    outline: none;
    font-family: var(--font-main);
    width: 150px;
    transition: width 0.3s;
}

.search-form input:focus {
    width: 200px;
}

.search-form button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 0 5px;
}

@media (max-width: 1024px) {
    .header-tools {
        margin-left: 10px;
    }
    .search-form input {
        width: 100px;
    }
    .search-form input:focus {
        width: 130px;
    }
}

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

.logo { font-size: 24px; font-weight: 900; color: var(--text-main); text-decoration: none; }
.logo span { color: var(--primary); }

nav.main-nav ul { 
    display: flex; 
    list-style: none; 
    gap: 15px; /* تقليل المسافة لاستيعاب تبويبات أكثر */
    flex-wrap: wrap; /* السماح بالتفاف العناصر إذا كانت كثيرة */
    justify-content: center;
}

nav.main-nav a { 
    color: var(--text-main); 
    text-decoration: none; 
    font-weight: 700; 
    transition: 0.3s; 
    font-size: 14px; /* تصغير الخط قليلاً للاحترافية */
    padding: 5px 10px;
    border-radius: 4px;
}
nav.main-nav a:hover { color: var(--primary); }

/* Hero Section */
.hero-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin: 40px 0;
}

/* Slider Animations */
.hero-slider-container {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
    border-radius: var(--radius);
}

.slide-item {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease-in-out, visibility 0.8s;
    z-index: 1;
}

.slide-item.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

.hero-slider-nav {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.slider-dot {
    width: 12px;
    height: 12px;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
}

.slider-dot.active {
    background: var(--primary);
    transform: scale(1.2);
}

.hero-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    padding: 40px;
}

.cat-badge {
    background: var(--primary);
    color: white;
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    margin-bottom: 15px;
    display: inline-block;
}

.trend-badge {
    background: rgba(255, 62, 62, 0.2);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 900;
    margin-right: 10px;
}

/* Cards */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.trend-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: 0.3s;
}

.trend-card:hover { transform: translateY(-10px); border-color: var(--primary); }

.card-img { position: relative; height: 200px; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }

.card-content { padding: 20px; }
.card-content h3 { font-size: 18px; margin-bottom: 10px; color: var(--text-main); }
.card-content h3 a { text-decoration: none; color: inherit; }

/* Single Page */
.single-post-wrap { max-width: 900px; margin: 40px auto; }
.post-header { text-align: center; margin-bottom: 40px; }
.post-header h1 { font-size: 40px; margin: 20px 0; }
.post-meta { color: var(--text-muted); font-size: 14px; display: flex; justify-content: center; gap: 20px; }

.post-content { font-size: 18px; line-height: 1.8; color: #e0e0e0; }
.post-content p { margin-bottom: 25px; }

/* Official Magazine Typography */
h1, h2, h3, h4 {
    letter-spacing: -0.5px;
    line-height: 1.3;
}

/* Dynamic Mixed Layout */
.cat-mixed-layout {
    margin-bottom: 30px;
}

.big-card {
    background: #0a0a0a !important;
    border: 1px solid #1a1a1a !important;
}

.big-card:hover {
    border-color: var(--primary) !important;
    box-shadow: 0 15px 40px rgba(255, 62, 62, 0.1) !important;
}

.cat-sub-list .mini-card {
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding-bottom: 15px;
    margin-bottom: 5px;
}

.cat-sub-list .mini-card:last-child {
    border-bottom: none;
}

/* Header Enhancements */
.main-nav ul {
    align-items: center;
}

.main-nav .menu-item-has-children {
    position: relative;
}

.main-nav .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    min-width: 200px;
    padding: 10px 0;
    list-style: none;
    box-shadow: var(--shadow);
}

.main-nav li:hover > .sub-menu {
    display: block;
}

.main-nav .sub-menu a {
    padding: 10px 20px;
    display: block;
    font-size: 14px;
}
/* Grid Layouts for High Density */
.main-grid-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    margin: 40px 0;
}

.section-title-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
}

.section-title-wrap h2 {
    border-right: 4px solid var(--primary);
    padding-right: 15px;
    font-size: 22px;
}

.more-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
}

/* Category Sections */
.category-block {
    margin-bottom: 50px;
}

.cat-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.cat-list-vertical {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mini-card {
    display: flex;
    gap: 15px;
    background: var(--bg-card);
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: 0.3s;
}

.mini-card:hover { border-color: var(--primary); }
.mini-card img { width: 100px; height: 100px; border-radius: 8px; object-fit: cover; }
.mini-card h4 { font-size: 15px; line-height: 1.4; }

/* Sidebar Widgets */
.widget {
    background: var(--bg-card);
    padding: 25px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 30px;
}

.widget-title {
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

/* Breaking Ticker */
.breaking-ticker {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
    overflow: hidden;
    white-space: nowrap;
}

.ticker-label {
    background: var(--primary);
    color: white;
    padding: 5px 15px;
    border-radius: 4px;
    font-weight: 900;
    margin-left: 15px;
    display: inline-block;
}

.ticker-content {
    display: inline-block;
    padding-left: 100%;
    animation: ticker 60s linear infinite; /* أبطأ مرتين للقراءة المريحة */
}

.breaking-ticker:hover .ticker-content {
    animation-play-state: paused; /* توقف عند مرور الماوس */
}

@keyframes ticker {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

/* Responsive & Mobile Fixes */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-main);
    transition: 0.3s;
    border-radius: 2px;
}

.menu-toggle.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 1024px) {
    .header-flex { padding: 0 10px; }
    .logo { font-size: 20px; }
    
    .menu-toggle { display: flex; }
    
    .nav-container {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--bg-card);
        z-index: 1000;
        transition: 0.4s ease-in-out;
        padding: 80px 20px 40px;
        border-left: 1px solid var(--border);
        box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    }

    .nav-container.active { right: 0; }
    
    .nav-container ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .nav-container a {
        font-size: 18px;
        width: 100%;
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid var(--border);
    }

    .header-tools { display: none; } /* Hide search on small mobile to save space */
    
    .main-grid-layout { grid-template-columns: 1fr; }
    .hero-grid { grid-template-columns: 1fr; height: auto; }
    .hero-slider-container { height: 350px; }
    .hero-side { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
    .hero-side .trend-card { height: 120px !important; }
    
    .cat-mixed-layout { grid-template-columns: 1fr !important; }
    .cat-grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
    .hero-side { grid-template-columns: 1fr; }
    .cat-grid-3 { grid-template-columns: 1fr; }
    .hero-slider-container { height: 280px; }
    .hero-overlay h1 { font-size: 20px !important; }
    .ticker-label { font-size: 10px; padding: 3px 8px; }
}

body.menu-open { overflow: hidden; }
