/*
Theme Name: A3tal KSA Theme
Theme URI: https://a3tal.com
Author: A3tal Team
Description: Automotive Dark Theme (Orange/Amber Accent) with Cairo Font & Full Mobile Support.
Version: 28.0
*/

/* --- 1. Fonts & Global Reset --- */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;700;900&display=swap');

* { box-sizing: border-box; }

:root {
    --main-bg: #0f172a;       /* كحلي غامق */
    --accent-color: #f59e0b;  /* برتقالي الأعطال */
    --accent-hover: #d97706;  /* برتقالي أغمق */
    --text-light: #f8fafc;
    --text-dark: #334155;
    --border-color: #e2e8f0;
}

html, body {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* منع السكرول العرضي */
    font-family: 'Cairo', sans-serif;
    line-height: 1.8;
    color: var(--text-dark);
    background-color: #f8fafc;
    font-size: 16px;
    direction: rtl;
    text-align: right;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
a:hover { color: var(--accent-color); }

img, video, iframe, figure {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- 2. Header & Navigation --- */
.site-header { 
    background: var(--main-bg); 
    padding: 15px 0; 
    position: relative; 
    box-shadow: 0 4px 25px rgba(0,0,0,0.15); 
    z-index: 1000; 
    border-bottom: 3px solid var(--accent-color); 
}
.header-inner { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 20px; 
    gap: 20px; 
}
.site-branding a { display: flex; align-items: center; text-decoration: none; }

/* Desktop Menu */
.main-navigation { width: 100%; display: flex; justify-content: center; }
.main-navigation ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.main-navigation > ul > li > a { 
    display: block; 
    padding: 8px 20px; 
    color: var(--text-light); 
    background: rgba(255,255,255,0.05); 
    border: 1px solid rgba(255,255,255,0.1); 
    border-radius: 6px; 
    font-family: 'Cairo', sans-serif; 
    font-size: 15px; 
    font-weight: 700; 
    transition: all 0.2s ease; 
}
.main-navigation > ul > li > a:hover, 
.main-navigation > ul > li.current-menu-item > a { 
    background: var(--accent-color); 
    color: #fff; 
    border-color: var(--accent-color); 
    transform: translateY(-2px); 
}

/* Dropdown */
.main-navigation li { position: relative; }
.main-navigation ul ul { 
    display: none; 
    position: absolute; 
    top: 100%; 
    right: 50%; 
    transform: translateX(50%); 
    width: 200px; 
    background: #1e293b; 
    border: 1px solid #334155; 
    border-radius: 8px; 
    padding: 10px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); 
    flex-direction: column; 
    gap: 5px; 
    z-index: 999; 
    margin-top: 10px; 
}
.main-navigation li:hover > ul { display: flex; animation: fadeInUp 0.2s ease forwards; }
.main-navigation ul ul li a { display: block; padding: 8px 12px; color: #cbd5e1; font-size: 14px; text-align: center; border: none; background: transparent; }
.main-navigation ul ul li a:hover { background: rgba(255,255,255,0.05); color: var(--accent-color); }
@keyframes fadeInUp { from { opacity: 0; transform: translate(50%, 10px); } to { opacity: 1; transform: translate(50%, 0); } }
#menu-toggle { display: none; }

/* --- 3. Hero & Ticker --- */
.hero-section { max-width: 1200px; margin: 30px auto; padding: 0 20px; width: 100%; }
.swiper-wrapper.mosaic-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 280px); gap: 15px; }
.mosaic-item { position: relative; border-radius: 12px; overflow: hidden; background: #e2e8f0; height: 100%; width: 100%; }
.mosaic-item.item-1 { grid-column: span 2; grid-row: span 2; }
.mosaic-item img { width: 100%; height: 100%; transition: transform 0.6s; object-fit: cover; }
.mosaic-item:hover img { transform: scale(1.05); }
.mosaic-overlay { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, rgba(15, 23, 42, 0.9), transparent); padding: 20px; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: right; }
.mosaic-cat { display: inline-block; background: var(--accent-color); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 4px; width: fit-content; margin-bottom: 8px; }
.mosaic-title { color: #fff; font-family: 'Cairo', sans-serif; font-weight: 700; line-height: 1.3; margin: 0; }
.item-1 .mosaic-title { font-size: 24px; } .mosaic-item:not(.item-1) .mosaic-title { font-size: 15px; }
.swiper-pagination { display: none; }

.news-ticker-wrap { max-width: 1200px; margin: 0 auto 40px auto; padding: 0 20px; display: flex; align-items: center; overflow: hidden; width: 100%; direction: rtl; }
.ticker-label { background: #ef4444; color: #fff; padding: 8px 15px; font-weight: 700; font-size: 13px; border-radius: 0 4px 4px 0; z-index: 2; flex-shrink: 0; }
.ticker-content { background: #fff; flex: 1; padding: 8px 15px; border: 1px solid var(--border-color); border-right: none; border-radius: 4px 0 0 4px; overflow: hidden; white-space: nowrap; }
.ticker-move { display: inline-block; padding-right: 100%; animation: ticker 25s linear infinite; }
.ticker-item { display: inline-block; margin-left: 30px; color: #334155; font-weight: 600; font-size: 14px; }
@keyframes ticker { 0% { transform: translate3d(0, 0, 0); } 100% { transform: translate3d(100%, 0, 0); } }

/* --- 4. Featured Grid --- */
.features-section { max-width: 1200px; margin: 0 auto 60px auto; padding: 0 20px; width: 100%; }
.mag-heading { border-bottom: 2px solid var(--main-bg); margin-bottom: 25px; display: flex; justify-content: space-between; align-items: flex-end; }
.mag-heading span { background: var(--main-bg); color: #fff; padding: 6px 15px; font-size: 18px; font-weight: 700; }
.mag-heading a { font-size: 13px; font-weight: 600; color: #64748b; margin-bottom: 5px; }
.features-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.feature-card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.03); transition: transform 0.3s; }
.feature-card:hover { transform: translateY(-3px); }
.feature-img-wrap { height: 150px; overflow: hidden; position: relative; }
.feature-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.feature-card:hover .feature-img-wrap img { transform: scale(1.1); }
.feature-content { padding: 15px; }
.feature-meta { font-size: 11px; color: #94a3b8; margin-bottom: 5px; }
.feature-title { font-size: 16px; margin: 0; color: var(--main-bg); line-height: 1.4; font-weight: 700; }

/* --- 5. Ad & Bottom Grid --- */
.ad-section { max-width: 1000px; margin: 0 auto 50px auto; padding: 0 20px; text-align: center; width: 100%; }
.ad-container { background: #fff; border: 1px dashed #cbd5e1; min-height: 90px; display: flex; align-items: center; justify-content: center; color: #cbd5e1; width: 100%; overflow: hidden; }
.bottom-section { max-width: 1200px; margin: 0 auto 60px auto; padding: 0 20px; width: 100%; }
.bottom-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.column-title { font-size: 18px; font-weight: 700; color: var(--main-bg); border-bottom: 2px solid var(--border-color); padding-bottom: 8px; margin-bottom: 20px; position: relative; }
.column-title::after { content: ''; position: absolute; bottom: -2px; right: 0; width: 50px; height: 2px; background: var(--accent-color); }
.small-card { display: flex; gap: 15px; margin-bottom: 20px; align-items: flex-start; }
.small-img { width: 80px; height: 60px; border-radius: 4px; overflow: hidden; flex-shrink: 0; }
.small-img img { width: 100%; height: 100%; object-fit: cover; }
.small-content { flex: 1; }
.small-title { font-size: 14px; font-weight: 600; line-height: 1.4; color: #334155; margin: 0; }

/* --- 6. Single Post & Page (The Important Part) --- */
.container { max-width: 1000px; margin: 0 auto; padding: 0 20px; width: 100%; }
.breadcrumbs { font-size: 13px; color: #64748b; margin-bottom: 20px; font-weight: 600; display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.single-title { font-size: 32px; line-height: 1.4; color: var(--main-bg); margin: 10px 0 20px 0; text-align: center; font-weight: 800; word-wrap: break-word; }
.single-meta { display: flex; justify-content: center; gap: 15px; font-size: 14px; color: #64748b; flex-wrap: wrap; }
.single-thumb { margin-bottom: 40px; border-radius: 8px; overflow: hidden; width: 100%; box-shadow: 0 5px 20px rgba(0,0,0,0.05); }
.single-thumb img { width: 100%; height: auto; object-fit: cover; }

/* تحسين محتوى المقال */
.entry-content { font-size: 18px; line-height: 1.8; color: #334155; overflow-wrap: break-word; }

/* منع كسر الصور في المقال */
.entry-content img, 
.entry-content figure, 
.wp-block-image,
.wp-block-image img {
    max-width: 100% !important;
    height: auto !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
    border-radius: 6px;
}
.alignleft, .alignright, .aligncenter { float: none !important; margin: 0 auto !important; display: block !important; }

/* جداول المحتويات */
#toc-container { background: #fff; border: 1px solid var(--border-color); border-right: 4px solid var(--accent-color); padding: 20px; margin-bottom: 30px; border-radius: 8px; }
.toc-title { font-size: 18px; font-weight: 700; margin-bottom: 10px; color: var(--main-bg); }
#toc-list { list-style: none; margin: 0; padding: 0; }
#toc-list li a { color: #334155; font-size: 16px; display: block; padding: 5px 15px 5px 0; position: relative; transition: 0.2s; }
#toc-list li a:hover { color: var(--accent-color); transform: translateX(-5px); }

.entry-content h2 { font-size: 26px; color: var(--main-bg); margin-top: 40px; margin-bottom: 15px; font-weight: 700; border-bottom: 2px solid #f1f5f9; padding-bottom: 10px; }
.entry-content h3 { font-size: 22px; color: #1e293b; margin-top: 30px; margin-bottom: 10px; font-weight: 700; }

.author-box { background: #fff; border: 1px solid var(--border-color); padding: 25px; border-radius: 8px; display: flex; gap: 20px; margin-top: 50px; align-items: center; }
.author-avatar img { width: 70px; height: 70px; border-radius: 50%; }
.author-info h4 { margin: 0 0 5px 0; font-size: 18px; }
.author-info p { margin: 0; font-size: 14px; color: #64748b; }
.related-posts { margin-top: 50px; }
.related-heading { font-size: 22px; border-bottom: 2px solid var(--main-bg); padding-bottom: 10px; margin-bottom: 30px; text-align: center; font-weight: 700; }

/* --- 8. Footer --- */
.site-footer { background: #0b1120; color: #94a3b8; font-size: 15px; border-top: 4px solid var(--accent-color); width: 100%; text-align: right; margin-top: 40px; }
.footer-widgets { padding: 60px 0 40px 0; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.2fr; gap: 40px; }
.footer-col h3 { color: #fff; font-size: 18px; margin-bottom: 20px; font-weight: 700; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 10px; }
.footer-links a { color: #94a3b8; display: flex; align-items: center; gap: 5px; }
.footer-links a:hover { color: var(--accent-color); padding-right: 5px; }
.footer-newsletter input { width: 100%; padding: 10px; background: #1e293b; border: 1px solid #1e293b; color: #fff; border-radius: 4px; margin-bottom: 10px; text-align: right; }
.footer-btn { width: 100%; padding: 10px; background: var(--accent-color); color: #fff; border: none; border-radius: 4px; font-weight: 700; cursor: pointer; }
.footer-btn:hover { background: var(--accent-hover); }
.social-icons { display: flex; gap: 10px; margin-top: 20px; }
.social-icon { width: 36px; height: 36px; background: #1e293b; color: #fff; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: 0.3s; }
.social-icon:hover { background: var(--accent-color); }
.social-icon svg { width: 18px; height: 18px; fill: currentColor; }
.footer-bottom { background: #020617; padding: 20px 0; border-top: 1px solid #1e293b; text-align: center; font-size: 14px; }
.static-page-card { background: #fff; padding: 40px; border-radius: 8px; border: 1px solid #f1f5f9; }

/* =========================================================
   MOBILE ONLY STYLES (تحسينات الموبايل)
   ========================================================= */
@media (max-width: 1100px) {
    html, body { overflow-x: hidden; width: 100%; }
    .site-content, .container, .hero-section { max-width: 100vw; overflow: hidden; }

    /* تحسين عرض الهيدر والقوائم */
    .header-inner { flex-direction: row; justify-content: space-between; padding: 0 15px; }
    .site-branding a { justify-content: flex-start; }
    
    /* القائمة المخفية وزر التبديل */
    #menu-toggle { display: flex !important; margin-top: 0; background: transparent; border: 1px solid var(--accent-color); color: var(--accent-color); padding: 5px 10px; border-radius: 4px; }
    .main-navigation ul { display: none; } /* إخفاء الروابط في الموبايل */
    #site-navigation.toggled ul { display: flex; flex-direction: column; width: 100%; background: var(--main-bg); position: absolute; top: 100%; left: 0; padding: 20px; z-index: 1001; border-top: 2px solid var(--accent-color); }
    #site-navigation.toggled ul li a { width: 100%; text-align: center; margin-bottom: 5px; }
    
    /* تحسين عرض الهيرو سلايدر */
    .hero-section { margin-top: 15px; margin-bottom: 15px; padding: 0; width: 100vw; }
    .swiper-wrapper.mosaic-grid { display: flex; gap: 0; } 
    .mosaic-item { width: 100vw; height: auto; aspect-ratio: 16 / 9; border-radius: 0; flex-shrink: 0; }
    .swiper-pagination { display: block; bottom: 10px !important; } 
    .swiper-pagination-bullet-active { background: var(--accent-color) !important; }

    /* تحسين عرض المقال */
    .single-title { font-size: 24px !important; line-height: 1.4; padding: 0 10px; }
    .single-meta { flex-wrap: wrap; gap: 10px !important; margin-bottom: 20px; }
    .entry-content { font-size: 17px !important; padding: 0 5px; }
    .author-box { flex-direction: column; text-align: center; }

    /* منع الجداول والأكواد من كسر الشاشة */
    table, pre, iframe { overflow-x: auto; display: block; max-width: 100%; }

    /* تنسيق الشبكات (Grid) لتصبح عمود واحد */
    .features-grid, .bottom-grid, .footer-grid { grid-template-columns: 1fr; gap: 25px; }
    .footer-col { text-align: center; }
    .footer-links a { justify-content: center; }
    .social-icons { justify-content: center; }
    
    .static-page-card { padding: 20px; }
}

@media (max-width: 600px) { 
    .features-grid { grid-template-columns: 1fr; }
    .feature-img-wrap { height: auto; aspect-ratio: 16/9; }
    .ticker-label { font-size: 11px; padding: 8px 10px; }
    .ticker-item { font-size: 13px; margin-left: 20px; }
}
/* ---------- Footer: clean professional ---------- */
.a3tal-footer { background: #071022; color: #e6eef7; font-family: 'Cairo', Tahoma, sans-serif; }
.a3tal-footer a { color: #ffd28a; text-decoration: none; }
.a3tal-footer a:hover { text-decoration: underline; }

/* inner area */
.a3tal-footer-inner { max-width: 1200px; margin: 0 auto; padding: 40px 18px; display: flex; gap: 30px; align-items: flex-start; justify-content: space-between; }
.footer-col { flex: 1 1 0; min-width: 260px; }

/* LEFT */
.footer-left .footer-logo img { width: 160px; height: auto; display: block; margin-bottom: 14px; }
.footer-phone { color: rgba(230,238,247,0.9); line-height: 1.6; margin-bottom: 12px; font-size: 0.98rem; }
.footer-social { display:flex; gap:10px; margin-top:6px; }
.social-link { background: rgba(255,255,255,0.03); padding:6px 10px; border-radius:6px; font-size:0.9rem; }

/* RIGHT */
.footer-right .footer-about h4,
.footer-right .footer-links-quick h4 { color:#fff; margin:0 0 8px; font-size:1.02rem; }
.footer-about p { margin:0 0 14px; color: rgba(230,238,247,0.85); line-height:1.6; }
.footer-links-quick ul { list-style: none; padding:0; margin:0; display:flex; flex-direction:column; gap:8px; }
.footer-links-quick ul li a { color: rgba(255,210,138,0.95); }

/* bottom */
.a3tal-footer-bottom { border-top: 1px solid rgba(255,255,255,0.04); padding: 14px 0; background: linear-gradient(180deg,#050814,#071022); }
.a3tal-footer-bottom .container { max-width:1200px; margin:0 auto; padding:0 18px; display:flex; align-items:center; justify-content:space-between; gap:12px; }
.copyright { color: rgba(230,238,247,0.6); margin:0; font-size:0.95rem; }

/* responsive */
@media (max-width: 880px){
  .a3tal-footer-inner { flex-direction: column; padding: 28px 14px; }
  .footer-col { min-width: auto; }
  .footer-left .footer-logo img { width: 140px; }
  .a3tal-footer-bottom .container { flex-direction: column; gap:10px; align-items:flex-start; }
}

/* === A3TAL: horizontal sections (cards row) === */
.a3tal-horizontal-section { padding: 30px 0; border-top: 1px solid rgba(0,0,0,0.04); background: transparent; }
.a3tal-horizontal-section .section-heading { text-align: right; font-size: 20px; color: #0f172a; margin: 0 0 14px; font-weight:800; }

.cards-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: stretch; }
.card-item { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 3px 12px rgba(2,6,23,0.06); transition: transform .15s ease, box-shadow .15s ease; }
.card-item a { display:block; color: inherit; text-decoration: none; padding: 10px; height: 100%; }
.card-thumb { height: 140px; overflow: hidden; border-radius:6px; background: linear-gradient(180deg,#f1f5f9,#eef2ff); display:flex; align-items:center; justify-content:center; }
.card-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.card-title { margin: 10px 0 0; font-size: 15px; font-weight:700; color: #0f172a; min-height: 3em; line-height:1.2; }

.card-item:hover { transform: translateY(-6px); box-shadow: 0 10px 30px rgba(2,6,23,0.12); }

/* responsiveness */
@media (max-width: 1100px) {
  .cards-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .cards-row { grid-template-columns: 1fr; }
  .a3tal-horizontal-section { padding: 18px 12px; }
  .card-thumb { height: 180px; }
}
/* Optional: tweak spacing for services block */
.services-horizontal .section-heading { color: #0f172a; }
.services-horizontal .cards-row { margin-top: 8px; }
.services-horizontal .section-more { margin-top: 12px; font-weight:700; color: #d97706; }
