/*
Theme Name: Sports Theme
Theme URI: https://example.com/sports-theme
Author: Nasser Alrayes
Author URI: https://x.com/iN4sser
Description: A dynamic, premium sports theme for WordPress, featuring custom colors and options.
Version: 1.1.0
Text Domain: sports-theme
Tags: custom-colors, custom-logo, custom-menu, featured-images, rtl-language-support
*/

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;800&family=Outfit:wght@400;600;800&display=swap');

:root {
    /* Fallback variables */
    --primary-color: #e63946;
    --secondary-color: #1d3557;
    --bg-color: #f3f5f8;
    --surface-color: #ffffff;
    --text-color: #334155;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --header-bg: rgba(255, 255, 255, 0.85);
    --footer-bg: #0f172a;
    --footer-text: #f8fafc;

    /* Typography - Prioritize Cairo for Arabic */
    --font-heading: 'Cairo', 'Outfit', sans-serif;
    --font-body: 'Cairo', 'Outfit', sans-serif;

    /* Layout */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

[data-sports-theme="dark"] {
    --bg-color: #0a0f1d;
    --surface-color: #151e32;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #1e293b;
    --header-bg: rgba(21, 30, 50, 0.85);
    --secondary-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

[data-sports-theme="dark"] .theme-toggle-btn .moon-icon {
    display: none !important;
}

[data-sports-theme="dark"] .theme-toggle-btn .sun-icon {
    display: block !important;
}

[data-sports-theme="light"] .theme-toggle-btn .sun-icon {
    display: none !important;
}

[data-sports-theme="light"] .theme-toggle-btn .moon-icon {
    display: block !important;
}

html,
body {
    max-width: 100%;

    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--text-color);
    background-color: var(--bg-color);

    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

body.rtl {

    direction: rtl;
}

h1,
h2,
h3,

h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--secondary-color);
    margin-top: 0;
    font-weight: 800;
}


a {
    color: var(--primary-color);
    border-bottom: none !important;
    transition: all 0.3s ease;
}

a:hover,
a:focus,
a:active {
    color: var(--secondary-color);
    border-bottom: none !important;

}

/* Global Responsive Media Reset */
img,
video,

object,
embed {
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
}

/* Preserve iframe height specifically for external widgets */
iframe {
    max-width: 100%;
    box-sizing: border-box;
}

/* Standard WP Alignments */
.alignleft {
    float: left;
    margin-right: 1.5em;
    margin-bottom: 1.5em;
}

.alignright {
    float: right;
    margin-left: 1.5em;
    margin-bottom: 1.5em;
}

.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1.5em;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
/* Header */
.site-header {
    background: var(--header-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    width: 100%;
}

/* Transparent Overlay Header on Front Page */
body.home .site-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    right: 0;
}

/* Offset the absolute header if the WordPress Admin Bar is present */
body.home.admin-bar .site-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.home.admin-bar .site-header {
        top: 46px;
    }
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.site-branding {
    display: flex;
    align-items: center;
}

.site-branding img,
.custom-logo {
    max-height: 55px;
    /* Restrict height so large uploads fit naturally */
    width: auto;
    /* Keep aspect ratio */
}

.site-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

.site-title a {
    color: var(--secondary-color);
}

/* Navigation */
.main-navigation ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Only the top level menu is a flex row */
.main-navigation>ul,
.main-navigation>div>ul {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.main-navigation li {
    position: relative !important;
}

/* Dropdown Sub-menus (Universally targeting nested ULs) */
.main-navigation ul ul {
    display: none !important;
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    background: var(--surface-color) !important;
    min-width: 260px !important;
    box-shadow: var(--shadow-lg) !important;
    border-radius: var(--radius-md) !important;
    padding: 12px !important;
    border: 1px solid var(--border-color) !important;
    z-index: 99999 !important;
    flex-direction: column !important;
    gap: 4px !important;
}

[data-sports-theme="dark"] .main-navigation ul ul {
    background: rgba(21, 30, 50, 0.95) !important;
    backdrop-filter: blur(16px);
}

body:not(.rtl) .main-navigation ul ul {
    left: 0 !important;
    right: auto !important;
}

/* Deep Submenus (Level 3 Dropdowns) */
.main-navigation ul ul ul {
    top: 0 !important;
    right: 100% !important;
    /* RTL - pop out to the left of the parent box */
    margin-right: 2px !important;
}

body:not(.rtl) .main-navigation ul ul ul {
    left: 100% !important;
    /* LTR - pop out to the right */
    right: auto !important;
    margin-left: 2px !important;
    margin-right: 0 !important;
}

/* Show on hover */
.main-navigation ul li:hover>ul,
.main-navigation ul li:focus-within>ul {
    display: flex !important;
    animation: fadeInDown 0.2s ease forwards !important;
}

.main-navigation ul ul li {
    display: block !important;
    width: 100% !important;
    position: relative !important;
}

/* Dropdown Arrow Indicators */
.main-navigation ul ul .menu-item-has-children>a {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.main-navigation ul ul .menu-item-has-children>a::after {
    content: " \25C2";
    /* Left-pointing triangle for RTL */
    font-size: 1.4em;
    opacity: 1;
}

body:not(.rtl) .main-navigation ul ul .menu-item-has-children>a::after {
    content: " \25B8";
    /* Right-pointing triangle for LTR */
}

.main-navigation ul ul a {
    color: var(--secondary-color) !important;
    display: block !important;
    padding: 10px 16px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    box-shadow: none !important;
    transform: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: left !important;
}

body.rtl .main-navigation ul ul a {
    text-align: right !important;
}

[data-sports-theme="dark"] .main-navigation ul ul a {
    color: #ffffff !important;
}

.main-navigation ul ul a:hover {
    background-color: var(--bg-color) !important;
    color: var(--primary-color) !important;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-navigation>ul>li>a {
    color: var(--secondary-color);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 10px 0;
    margin: 0 15px;
    display: inline-block;
    position: relative;
    transition: color 0.3s ease;
}

[data-sports-theme="dark"] .main-navigation>ul>li>a {
    color: #ffffff;
}

.main-navigation>ul>li.menu-item-has-children>a,
.main-navigation>div>ul>li.menu-item-has-children>a {
    padding-inline-end: 18px;
}

.main-navigation>ul>li.menu-item-has-children>a::before,
.main-navigation>div>ul>li.menu-item-has-children>a::before {
    content: "\25BE";
    position: absolute;
    inset-inline-end: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.4em;
    line-height: 1;
    opacity: 0.8;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.main-navigation>ul>li.menu-item-has-children:hover>a::before,
.main-navigation>ul>li.menu-item-has-children:focus-within>a::before,
.main-navigation>div>ul>li.menu-item-has-children:hover>a::before,
.main-navigation>div>ul>li.menu-item-has-children:focus-within>a::before {
    opacity: 1;
    transform: translateY(-50%) rotate(180deg);
}

.main-navigation>ul>li>a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 0%;
    height: 3px;
    background-color: var(--primary-color);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}

.main-navigation>ul>li>a:hover,
.main-navigation>ul>li.current-menu-item>a {
    color: var(--primary-color);
}

.main-navigation>ul>li>a:hover::after,
.main-navigation>ul>li.current-menu-item>a::after {
    width: 100%;
}

/* Header Actions & Buttons */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle-btn .sun-icon {
    stroke: #f59e0b;
    fill: rgba(245, 158, 11, 0.2);
}

.theme-toggle-btn .moon-icon {
    stroke: #60a5fa;
    fill: rgba(96, 165, 250, 0.2);
}

/* Main Layout */
.site-content {
    padding: 60px 0;
    min-height: calc(100vh - 400px);
    /* Pushes the footer down when page is short */
}

.content-area-wrapper {
    display: block;
    /* default full width */
}

/* Constrain ultra-wide reading lines and remove the sidebar when the no-sidebar class is applied.
   Apply globally so pages, posts and custom post types behave consistently when the layout option is used. */
.content-area-wrapper.no-sidebar {
    display: flex;
    justify-content: center;
}

.content-area-wrapper.no-sidebar .site-main {
    max-width: 1000px;
    width: 100%;
    flex-shrink: 0;
}

/* Hide widget/secondary area entirely when no-sidebar is set */
.content-area-wrapper.no-sidebar > .widget-area,
.content-area-wrapper.no-sidebar > #secondary,
.homepage-content-wrapper.no-sidebar .widget-area {
    display: none !important;
}

.content-area-wrapper.has-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 2.5fr) minmax(0, 1fr);
    gap: 48px;
}

.homepage-content-wrapper.has-sidebar {
    display: flex;
    align-items: start;
    gap: 48px;
}

.homepage-main-column {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
}

.homepage-sidebar-right {
    flex: 0 0 340px;
    width: 340px;
    min-width: 280px;
    max-width: 340px;
}

.homepage-content-wrapper.no-sidebar .homepage-main-column {
    width: 100%;
}

@media (max-width: 992px) {

    .content-area-wrapper.has-sidebar {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .homepage-content-wrapper.has-sidebar {
        flex-direction: column;
        gap: 30px;
    }

    .homepage-sidebar-right {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        flex-basis: auto;
    }
}

.site-main,
.widget-area {
    min-width: 0;
    max-width: 100%;
}

/* Cards & Posts */
.post,
.widget-area .widget,
#comments,
.comments-area {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-bottom: 40px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
}

.post:hover,
.widget-area .widget:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.post-thumbnail img {
    width: 100%;
    height: 220px;
    display: block;
    object-fit: cover;
}

.single-post-thumbnail img {
    height: auto;
    max-height: 700px;
}

.post-content-wrap {
    padding: 40px;
}

.entry-title {
    font-size: 1.75rem;
    line-height: 1.3;
    margin-bottom: 16px;
}

.entry-meta {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    font-weight: 600;
}

.entry-content {
    font-size: 1.15rem;
    color: var(--text-color);
    margin-bottom: 30px;
}

/* Force post content images to be full width and bold */
.entry-content .wp-block-image img,
.entry-content p>img,
.entry-content figure>img {
    width: 100% !important;
    height: auto;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    margin: 15px 0;
    display: block;
}

/* Handle WordPress block galleries */
.entry-content .wp-block-gallery img {
    width: 100% !important;
    height: 100% !important;
    /* overrides specific gallery flex logic */
    object-fit: cover;
}

/* Single Post Taxonomies & Social Sharing */
.post-taxonomies {
    border-top: 1px solid var(--border-color);
    padding-top: 25px;
    margin-top: 40px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.tax-wrapper a {
    display: inline-block;
    padding: 6px 14px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.3s;
}

.tax-wrapper.cat-wrapper a {
    background: #ffc107;
    color: #000;
    border-color: #ffc107;
}

.tax-wrapper a:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.social-share-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
}

.share-title {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--secondary-color);
    margin-left: 15px;
    /* RTL spacing */
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}

.share-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--text-muted);
    transition: fill 0.3s;
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.share-btn.share-x:hover svg {
    fill: #000000;
}

.share-btn.share-facebook:hover svg {
    fill: #1877F2;
}

.share-btn.share-whatsapp:hover svg {
    fill: #25D366;
}

.share-btn.share-linkedin:hover svg {
    fill: #0A66C2;
}

.share-btn.share-pinterest:hover svg {
    fill: #E60023;
}

body:not(.rtl) .share-title {
    margin-left: 0;
    margin-right: 15px;
}

/* Enhanced Tables (Specific for Sports Plugins & Widgets) */
table,
.sp-template table,
.wp-block-table table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 24px 0;
    background: var(--surface-color);
    border-radius: var(--radius-md);
    overflow-x: auto;
    display: block;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

th,
td,
.sp-template th,
.sp-template td {
    padding: 18px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

body.rtl th,
body.rtl td,
body.rtl .sp-template th,
body.rtl .sp-template td {
    text-align: right;
}

th,
.sp-template th,
thead th {
    background-color: var(--bg-color);
    font-weight: 800;
    color: var(--secondary-color);
    font-size: 0.95rem;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Make images inside tables (team logos) look better */
table img,
.sp-template table img {
    max-width: 30px;
    height: auto;
    border-radius: 50%;
    vertical-align: middle;
    margin: 0 8px;
}

/* Buttons */
.read-more-btn,
button,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff !important;
    padding: 14px 32px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1.05rem;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.read-more-btn:hover,
button:hover,
input[type="submit"]:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    filter: brightness(1.1);
}

/* Sidebar & Widgets */
.widget,
.custom-contained-widget {
    padding: 35px;
    max-width: 100vw !important;
    overflow-x: auto;
    box-sizing: border-box;
}

.widget img,
.widget video,
.custom-contained-widget img,
.custom-contained-widget video {
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
}

.widget iframe,
.widget object,
.widget embed,
.widget table,
.widget>div,
.custom-contained-widget iframe,
.custom-contained-widget embed,
.custom-contained-widget table,
.custom-contained-widget>div {
    max-width: 100%;
    box-sizing: border-box;
}

.widget-title {
    font-size: 1.6rem;
    margin-bottom: 24px;
    position: relative;
    padding-bottom: 16px;
    color: var(--secondary-color);
}

[data-sports-theme="dark"] .widget-title,
[data-sports-theme="dark"] .section-title,
[data-sports-theme="dark"] .category-title,
[data-sports-theme="dark"] .entry-title,
[data-sports-theme="dark"] .entry-title a,
[data-sports-theme="dark"] .share-title {
    color: var(--primary-color) !important;
}

[data-sports-theme="dark"] .post-taxonomies,
[data-sports-theme="dark"] .post-taxonomies a {
    color: var(--secondary-color) !important;
}

.widget-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
}

body.rtl .widget-title::after {
    left: auto;
    right: 0;
}

/* Hide the yellow widget title underline ONLY on inner pages and posts as requested */
body.page:not(.home) .widget-title::after,
body.single .widget-title::after {
    display: none;
}

.widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget ul li {
    padding: 8px 0;
    border-bottom: none;
    transition: color 0.2s ease;
    /* Removed the jumping transform */
}

.widget ul li a {
    color: var(--text-color);
    font-weight: 600;
}

.widget ul li:hover a {
    color: var(--primary-color);
}

.widget ul li:last-child {
    border-bottom: none;
}

/* Override WordPress Core block injected underlines that cause visual shifting */
.entry-content a {
    border-bottom: none !important;
    box-shadow: none !important;
}

.entry-content a:hover {
    color: var(--primary-color) !important;
}

/* Footer */
.site-footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 80px 0 30px;
    position: relative;
    overflow: hidden;
}

.footer-widgets-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-bottom: 60px;
}

.site-footer .widget {
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 0;
    margin: 0;
}

.site-footer .widget:hover {
    transform: none;
    box-shadow: none;
}

.site-footer .widget-title {
    color: #fff;
}

.site-footer .widget ul li {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.site-footer .widget ul li a {
    color: rgba(255, 255, 255, 0.7);
}

.site-footer .widget ul li:hover a {
    color: var(--primary-color);
}

.site-info {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Homepage Specific Styles */
.homepage-hero {
    position: relative;
    padding: 180px 24px 120px 24px;
    /* Native generous padding to avoid overlay */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin: 0;
}

.homepage-hero .hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(29, 53, 87, 0.85) 0%, rgba(230, 57, 70, 0.75) 100%);
    z-index: 1;
}

.homepage-hero .hero-content {
    position: relative;
    z-index: 2;
    color: #fff;
    max-width: 800px;
}

.homepage-hero .hero-title {
    font-size: 2.8rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 20px;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

.homepage-hero .hero-subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0;
}

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

@media (max-width: 992px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .news-grid {
        grid-template-columns: 1fr;
    }
}

/* Premium Card matching screenshot */
.news-card.premium-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    height: 250px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    background: #000;
    /* fall back if no image */
}

.news-card.premium-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.news-card.premium-card .news-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.news-card.premium-card .news-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
    /* slight dim for contrast */
}

.news-card.premium-card .news-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(10, 15, 30, 0.95) 0%, rgba(10, 15, 30, 0) 100%);
    padding: 30px 24px 20px 24px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.news-card.premium-card .post-time {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.7rem;
    font-weight: 600;
}

.news-card.premium-card .entry-title {
    margin: 0;
    line-height: 0.75;
}

.news-card.premium-card .entry-title a {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.news-card.premium-card .entry-title a:hover {
    color: #ffc107;
}

/* Category Banners - Refined RTL Style */
.category-header-bar {
    position: relative;
    margin-bottom: 25px;
    display: flex;
    justify-content: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.category-title {
    color: var(--secondary-color);
    font-size: 1.6rem;
    font-weight: 900;
    margin: 0;
    padding-left: 15px;
    border-left: 4px solid var(--primary-color);
}

body.rtl .category-title {
    padding-left: 0;
    border-left: none;
    padding-right: 15px;
    border-right: 4px solid var(--primary-color);
}

/* Base Top 5 Grid Layout (overlaid on background) */
.header-top-five-wrapper {
    position: relative;
    padding: 110px 0 30px 0;
    margin: 0;
    box-shadow: inset 0 0 0 2000px rgba(0, 0, 0, 0.5);
    /* Remove negative margin hack */
    background-size: cover;
    background-position: center;
}

.header-top-five-wrapper::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    /* Dark wash so cards stand out */
}

.top-five-bento-grid {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-rows: 250px 250px;
    gap: 15px;
}

.top-five-bento-grid .news-card.premium-card {
    height: 100%;
}

.top-five-item-0 {
    grid-column: 2;
    grid-row: 1 / span 2;
}

.top-five-item-1 {
    grid-column: 3;
    grid-row: 1;
}

.top-five-item-2 {
    grid-column: 3;
    grid-row: 2;
}

.top-five-item-3 {
    grid-column: 1;
    grid-row: 1;
}

.top-five-item-4 {
    grid-column: 1;
    grid-row: 2;
}

/* Category Pill */
.cat-pill {
    position: absolute;
    top: 15px;
    right: 15px;
    /* RTL default */
    background: #ffc107;
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

@media (max-width: 992px) {
    .top-five-bento-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }

    .top-five-item-0 {
        grid-column: 1 / span 2;
        grid-row: 1;
        height: 350px !important;
    }

    .top-five-item-1 {
        grid-column: 2;
        grid-row: 2;
        height: 200px !important;
    }

    .top-five-item-2 {
        grid-column: 2;
        grid-row: 3;
        height: 200px !important;
    }

    .top-five-item-3 {
        grid-column: 1;
        grid-row: 2;
        height: 200px !important;
    }

    .top-five-item-4 {
        grid-column: 1;
        grid-row: 3;
        height: 200px !important;
    }
}

/* Mobile App Bottom Navigation */
.mobile-app-nav {
    display: none;
    /* hidden on desktop */
}

/* Generic plugin UI resets for cleaner look */
.sp-template {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

/* Responsive */
@media (max-width: 992px) {
    .content-area-wrapper {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding-bottom: 70px;
    }

    /* Compact header and overlayed search for mobile */
    .site-header {
        padding: 8px 12px;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    /* Prevent horizontal overflow and ensure header/nav use the full viewport width */
    .site-header,
    .header-inner,
    .mobile-app-nav {
        width: 100vw;
        max-width: 100vw;
        left: 0;
        right: 0;
        box-sizing: border-box;
    }

    .header-inner {
        flex-direction: row;
        text-align: center;
        gap: 8px;
        padding: 6px 8px;
        align-items: center;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    /* keep content away from the right-edge so absolute search button doesn't overlap */
    .header-inner {
        padding-right: 56px;
    }

    .site-branding {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        flex: 1 1 auto;
    }

    .site-branding img,
    .custom-logo {
        max-height: 40px;
        width: auto;
    }

    .site-title {
        font-size: 1rem;
        margin: 0;
        line-height: 1;
        font-weight: 800;
    }

    /* Take the search button out of document flow so it doesn't consume space.
       Position it relative to the header (site-header) so it aligns to the
       viewport edge and doesn't cause horizontal gaps. */
    .site-header {
        left: 0;
        right: 0;
    }

    .search-toggle-btn {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
        z-index: 1200;
    }

    /* slightly increase right offset if device has safe-area inset */
    .search-toggle-btn {
        right: env(safe-area-inset-right, 12px);
    }

    /* Ensure header actions (menu / search) don't push center branding */
    .main-navigation {
        display: none !important;
    }

    /* Hide top nav items to emulate App */
    .main-navigation>ul,
    .main-navigation>div>ul {
        display: none !important;
    }

    .site-title {
        font-size: 1.2rem;
    }

    .homepage-hero .hero-title {
        font-size: 1.8rem;
    }

    .homepage-hero .hero-subtitle {
        font-size: 1rem;
    }

    .entry-title {
        font-size: 1.35rem;
    }

    .news-card.premium-card .post-time {
        font-size: 0.55rem;
    }

    .news-card.premium-card .entry-title a {
        font-size: 0.7rem;
        font-weight: normal;
    }

    /* Bottom App Navigation Bar */
    .mobile-app-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: auto;
        padding-top: 10px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.08);
        z-index: 999999;
        justify-content: space-around;
        align-items: center;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--secondary-color);
        flex: 1;
        transition: color 0.2s ease;
    }

    .mobile-nav-item:hover,
    .mobile-nav-item:active {
        color: var(--primary-color);
    }

    .mobile-nav-icon svg {
        display: block;
        width: 24px;
        height: 24px;
        margin-bottom: 4px;
        opacity: 0.8;
    }

    .mobile-nav-label {
        font-size: 0.65rem;
        font-weight: 700;
        text-transform: uppercase;
    }
}

/* 365Scores Widget Third-Party Overrides */
div[data-widget-type],
div[data-widget-id],
.widget-type-entityScores {
    max-width: 100% !important;
    overflow-x: auto;
    box-sizing: border-box;
}

div[data-widget-type] a,
div[data-widget-type] a:hover,
div[data-widget-id] a,
div[data-widget-id] a:hover,
.widget-type-entityScores a,
.widget-type-entityScores a:hover {
    border-bottom: none !important;
    box-shadow: none !important;
}

div[data-widget-type] *:hover {}

/* =========================================
   Posts Grid – 2-column listing layout
   ========================================= */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.posts-grid .post {
    margin-bottom: 0;
    /* gap handles spacing */
    display: flex;
    flex-direction: column;
}

.posts-grid .post-content-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.posts-grid .entry-content {
    flex: 1;
}

.posts-grid .read-more-btn {
    align-self: flex-start;
    margin-top: auto;
}

@media (max-width: 640px) {
    .posts-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   Search Toggle Button (in header)
   ========================================= */
.search-toggle-btn,
.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid var(--secondary-color);
    border-radius: 50%;
    background: var(--secondary-color);
    color: var(--primary-color);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.search-toggle-btn svg,
.theme-toggle-btn svg {
    width: 18px;
    height: 18px;
    color: var(--primary-color);
}

.search-toggle-btn:hover,
.theme-toggle-btn:hover {
    background: var(--secondary-color);
    color: #fff;
    border-color: var(--secondary-color);
    transform: scale(1.1);
}

/* =========================================
   Search Overlay
   ========================================= */
.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 15, 30, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.search-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

body.search-overlay-open {
    overflow: hidden;
}

.search-overlay-inner {
    position: relative;
    width: min(600px, 90vw);
    transform: translateY(-20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-overlay.is-active .search-overlay-inner {
    transform: translateY(0);
}

/* Style the WP search form inside the overlay */
.search-overlay .search-form {
    display: flex;
    gap: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
}

/* WordPress wraps the input in a <label> — make it a flex child */
.search-overlay .search-form label {
    flex: 1;
    display: flex;
    min-width: 0;
}

.search-overlay .search-form label .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.search-overlay .search-field {
    flex: 1;
    width: 100%;
    min-width: 0;
    padding: 18px 24px;
    font-size: 1.15rem;
    font-family: var(--font-body);
    border: none;
    outline: none;
    background: #fff;
    color: var(--text-color);
    border-radius: 0;
}

.search-overlay .search-submit {
    padding: 18px 28px;
    font-size: 1rem;
    border-radius: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: #fff;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 700;
    transition: filter 0.2s ease;
}

.search-overlay .search-submit:hover {
    filter: brightness(1.1);
    transform: none;
    box-shadow: none;
}

/* Close button */
.search-close-btn {
    position: absolute;
    top: -52px;
    left: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s ease, transform 0.2s ease;
}

body.rtl .search-close-btn {
    left: auto;
    right: 0;
}

.search-close-btn svg {
    width: 18px;
    height: 18px;
}

.search-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Typography Overrides */
.page-title {
    color: var(--primary-color) !important;
}

/* =========================================
   Related Posts (Single)
   ========================================= */
.related-posts-section {
    margin: 20px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

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

@media (max-width: 768px) {
    .related-posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

.related-post-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.related-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.related-post-thumb {
    display: block;
    width: 100%;
    height: 160px;
    overflow: hidden;
}

.related-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.related-post-card:hover .related-post-thumb img {
    transform: scale(1.05);
}

.fallback-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-color);
    width: 100%;
    height: 100%;
}

.related-post-title {
    padding: 15px;
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.4;
    font-weight: 700;
}

.related-post-title a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.related-post-title a:hover {
    color: var(--primary-color);
}
