/**
 * Mizar Arabic Theme Custom Styles - Clean & Fixed Version
 * Fully RTL + Bootstrap-Compatible + No Broken Gutters
 */

 :root {
    --bg: #ffffff;
    --fg: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;

    --primary: #1e40af;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;

    --secondary: #7c3aed;
    --secondary-hover: #8b5cf6;

    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
    --info: #0284c7;

    --surface: #f8fafc;
    --surface-elevated: #ffffff;
    --surface-hover: #f1f5f9;

    --link: var(--primary);
    --link-hover: var(--primary-hover);

    --scale--2: clamp(0.75rem, 0.78rem + 0.1vw, 0.85rem);
    --scale--1: clamp(0.875rem, 0.88rem + 0.2vw, 0.98rem);
    --scale-0: clamp(1rem, 0.96rem + 0.4vw, 1.125rem);
    --scale-1: clamp(1.25rem, 1.1rem + 0.8vw, 1.5rem);
    --scale-2: clamp(1.5rem, 1.2rem + 1.2vw, 1.875rem);
    --scale-3: clamp(1.875rem, 1.4rem + 2vw, 2.25rem);
    --scale-4: clamp(2.25rem, 1.6rem + 3vw, 3rem);

    --section-y: clamp(2rem, 3vw + 0.5rem, 4rem);
    --radius: 12px;
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.08);
}

/* Base RTL */
body {
    font-family: 'IBM Plex Sans Arabic', sans-serif;
    direction: rtl;
    text-align: right;
    color: var(--fg);
    background: #fff;
    margin: 0 !important;
    padding: 0 !important;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'IBM Plex Sans Arabic', sans-serif;
    color: var(--fg);
    line-height: 1.25;
    margin-bottom: 1rem;
}

/* Paragraphs */
p {
    color: var(--muted);
    line-height: 1.8;
}

/* Links */
a {
    color: var(--link);
    text-decoration: none;
}
a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Navbar - Enhanced with specific selectors */
#masthead.site-header {
    transition: all 0.3s ease !important;
    animation: fadeInDown 0.5s ease-out !important;
}

/* Override Bootstrap navbar CSS variables */
#masthead .navbar {
    --bs-navbar-padding-y: 0.75rem !important;
    --bs-navbar-nav-link-padding-x: 1rem !important;
    background: var(--bg) !important;
    background-color: #ffffff !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
}

#masthead .navbar.sticky-top {
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    background: rgba(255, 255, 255, 0.95) !important;
}

#masthead .navbar-nav .nav-link {
    --bs-navbar-color: var(--fg) !important;
    --bs-navbar-hover-color: var(--primary-hover) !important;
    padding: 0.5rem 1rem !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    color: var(--fg) !important;
    color: #0f172a !important;
    font-weight: 500 !important;
    position: relative !important;
    transition: all 0.3s ease !important;
    transition-property: color, background-color, transform !important;
    border-radius: 6px !important;
    margin: 0 0.25rem !important;
    text-decoration: none !important;
}

#masthead .navbar-nav .nav-link::before {
    content: '' !important;
    position: absolute !important;
    bottom: 4px !important;
    right: 50% !important;
    left: 50% !important;
    height: 2px !important;
    background: var(--primary) !important;
    transition: all 0.3s ease !important;
    opacity: 0 !important;
    transform: translateX(-50%) !important;
}

#masthead .navbar-nav .nav-link:hover::before,
#masthead .navbar-nav .nav-link.active::before {
    opacity: 1 !important;
    right: 0.5rem !important;
    left: 0.5rem !important;
}

#masthead .navbar-nav .nav-link:hover {
    color: var(--primary-hover) !important;
    color: #1d4ed8 !important;
    background-color: rgba(30, 64, 175, 0.05) !important;
    transform: translateY(-1px) !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
}

#masthead .navbar-brand {
    --bs-navbar-brand-padding-y: 0.3125rem !important;
    transition: transform 0.3s ease, opacity 0.3s ease !important;
    display: inline-flex !important;
    display: flex !important;
    align-items: center !important;
    text-decoration: none !important;
}

#masthead .navbar-brand:hover {
    transform: scale(1.02) !important;
    opacity: 0.9 !important;
}

#masthead .navbar-brand img {
    display: block !important;
    max-height: 40px !important;
    height: 40px !important;
    width: auto !important;
    max-width: 200px !important;
    object-fit: contain !important;
    transition: all 0.3s ease !important;
}

/* Override inline styles from WordPress custom logo */
#masthead .navbar-brand img[style] {
    width: auto !important;
    height: 40px !important;
    max-width: 200px !important;
    aspect-ratio: auto !important;
}

#masthead .navbar-toggler {
    border: none !important;
    padding: 0.5rem !important;
    transition: all 0.3s ease !important;
}

#masthead .navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(30, 64, 175, 0.25) !important;
    outline: none !important;
}

#masthead .navbar-toggler-icon {
    transition: transform 0.3s ease !important;
}

#masthead .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon {
    transform: rotate(90deg) !important;
}

/* Dropdown RTL */
.dropdown-menu {
    right: 0;
    left: auto;
    text-align: right;
}

/* Buttons */
.btn {
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 500;
}
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
}

/* Cards */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Footer */
.site-footer {
    background: #0f172a !important;
    color: #fff !important;
}
.site-footer a {
    color: rgba(255,255,255,0.8) !important;
}

/* Footer Menu Fix */
.site-footer .nav {
    flex-wrap: wrap;
    justify-content: center;
}
.site-footer .nav li::after {
    content: " | ";
    color: rgba(255,255,255,0.4);
    margin: 0 0.5rem;
}
.site-footer .nav li:last-child::after {
    content: "";
}

/* RESPONSIVE footer fix */
@media(max-width:768px){
    .site-footer .nav {
        flex-direction: column;
    }
    .site-footer .nav li::after {
        display:none;
    }
}

/* Content Cleanup */
.page .container {
    max-width: 1140px;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Entry content */
.entry-content {
    margin: 0;
    padding: 0;
}

/* Remove WordPress auto title spacing */
.page .entry-header,
.page .entry-title {
    display: none !important;
}

/* ✔ Bootstrap Gutters FIX – Correct and Safe */
.row.g-4 {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 1.5rem;
}

/* ===== HEADER ENHANCEMENTS ===== */
/* Already included in Navbar section above */

/* ===== FOOTER ENHANCEMENTS ===== */
.site-footer {
    padding-top: 3rem;
    padding-bottom: 2rem;
    margin-top: 4rem;
    position: relative;
    overflow: hidden;
}

.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

.site-footer .container {
    position: relative;
    z-index: 1;
}

.site-footer .row:first-child {
    margin-bottom: 2rem;
}

.site-footer .widget {
    margin-bottom: 1.5rem;
}

.site-footer .widget-title {
    color: #fff;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.site-footer a {
    transition: all 0.3s ease;
    display: inline-block;
    padding: 0.25rem 0;
}

.site-footer a:hover {
    color: #fff !important;
    transform: translateX(-3px);
    text-decoration: none;
}

.footer-menu-wrapper {
    margin: 1.5rem 0;
}

.footer-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.footer-menu li {
    margin: 0;
}

.footer-menu a {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.footer-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.site-footer .text-center p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin: 0;
}

.site-footer .text-center .h5 {
    color: #fff;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* ===== SMOOTH SCROLLING ===== */
html {
    scroll-behavior: smooth;
}

/* ===== RESPONSIVE HEADER ENHANCEMENTS ===== */
@media (max-width: 991.98px) {
    #masthead .navbar-collapse {
        margin-top: 1rem !important;
        padding-top: 1rem !important;
        border-top: 1px solid var(--border) !important;
    }
    
    #masthead .navbar-nav .nav-link {
        padding: 0.75rem 1rem !important;
        margin: 0.25rem 0 !important;
    }
    
    #masthead .navbar-nav .nav-link::before {
        display: none !important;
    }
}

/* ===== RESPONSIVE FOOTER ENHANCEMENTS ===== */
@media (max-width: 768px) {
    .site-footer {
        padding-top: 2rem;
        padding-bottom: 1.5rem;
        margin-top: 2rem;
    }
    
    .site-footer .row:first-child {
        margin-bottom: 1.5rem;
    }
    
    .site-footer .col-md-4 {
        margin-bottom: 2rem;
    }
    
    .footer-menu {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    .footer-menu a {
        display: block;
        width: 100%;
        text-align: center;
    }
}

/* ===== ANIMATION ENHANCEMENTS ===== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#masthead.site-header {
    animation: fadeInDown 0.5s ease-out !important;
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
#masthead .navbar-nav .nav-link:focus,
.footer-menu a:focus {
    outline: 2px solid var(--primary) !important;
    outline-offset: 2px !important;
}

.skip-link {
    position: absolute;
    top: -40px;
    right: 0;
    background: var(--primary);
    color: #fff;
    padding: 0.5rem 1rem;
    text-decoration: none;
    z-index: 9999;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}

/* Force header styles to apply - Direct overrides */
#masthead .navbar.navbar-expand-lg {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
}

#masthead .navbar .navbar-nav .nav-link {
    transition: color 0.3s ease, background-color 0.3s ease, transform 0.3s ease !important;
}

#masthead .navbar .navbar-nav .nav-link:hover {
    transition: color 0.3s ease, background-color 0.3s ease, transform 0.3s ease !important;
}