/*
Theme Name: Royal Maqal Imperial (The Crown Jewel)
Theme URI: https://almaaqal.edu.iq
Author: Al-Maqal University (Imperial Unit)
Author URI: https://almaaqal.edu.iq
Description: The most advanced academic theme ever created for Al-Maqal University. Merging the V30 Dynamic Architecture with V3.1 Pro Aesthetics. Features 'Royal Preloader', 'Smart Dark Mode', and 'Imperial Typography'.
Version: 31.0.0 (Final Imperial)
Text Domain: royal-maqal
Tags: education, university, luxury, gold, black, academic
*/

/* --- ROYAL FONTS IMPORT (V26.3) --- */
@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400;1,700&family=Aref+Ruqaa:wght@400;700&family=Cairo:wght@200;300;400;600;700;900&family=Katibeh&family=Qahiri&family=Rakkas&family=Reem+Kufi:wght@400;500;600;700&family=Scheherazade+New:wght@400;700&family=Tajawal:wght@200;400;500;700;800&display=swap');

@keyframes royalShimmer {
    0% {
        background-position: -100% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.royal-title,
h1.site-title,
.section-title {
    position: relative;
    color: var(--gold-main, #d4af37);
    background: linear-gradient(to right, #d4af37 0%, #fff 50%, #d4af37 100%);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: royalShimmer 3s linear infinite;
}

/* --- DYNAMIC CALLIGRAPHY HEADER --- */
.royal-calligraphy-text {
    font-family: 'Amiri', serif;
    font-weight: 700;
    line-height: 1.2;
    background: linear-gradient(to bottom, #cfc09f 22%, #634f2c 24%, #cfc09f 26%, #cfc09f 27%, #ffecb3 40%, #3a2c0f 78%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--gold-main);
    /* Fallback */
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 10;
}

@media (max-width: 768px) {
    .site-branding.royal-calligraphy-layout {
        flex-direction: column !important;
        text-align: center !important;
    }

    .calligraphy-side {
        text-align: center !important;
        padding: 5px 0 !important;
        order: 2;
        /* Put text below logo on mobile if desired, or adjust order */
    }

    .logo-container {
        order: 1;
        margin-bottom: 10px;
    }
}

.dashicons {
    transition: all 0.3s ease;
}

.dashicons:hover {
    color: var(--gold-main);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    transform: scale(1.1);
}

/* --- ROYAL PALETTE (STRICT V1.6.0) --- */
:root {
    --gold-main: #D4AF37;
    --gold-hover: #F4C430;
    --gold-muted: #AA8C2C;
    --black-deep: #000000;
    /* Pure Black */
    --black-soft: #0a0a0a;
    /* Very Dark Grey */
    --black-card: #111111;
    /* Card Background */
    --text-light: #e0e0e0;
    --text-muted: #888888;

    /* --- COMPATIBILITY OVERRIDES (Turn Whites to Black) --- */
    --color-primary: #000000;
    --color-secondary: #D4AF37;
    --color-white: #0a0a0a;
    /* No more white backgrounds */
    --color-off-white: #111111;
    /* Darker backgrounds */
    --color-light-grey: #1a1a1a;
    /* Dark borders */
    --color-grey: #6c757d;
    --color-dark-grey: #050505;
    --color-black: #000000;

    --shadow-sm: 0 4px 15px rgba(212, 175, 55, 0.1);
    /* Gold Glow */

    --font-heading: 'Amiri', serif;
    --font-body: 'Cairo', sans-serif;
}

/* --- RESET & BASE --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--black-deep);
    color: var(--text-light);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    direction: rtl;
}

/* Fix for Custom Background */
body.custom-background {
    background-image: none !important;
    background-color: var(--black-deep) !important;
}

a {
    color: var(--gold-main);
    text-decoration: none;
    transition: 0.3s;
}

a:hover {
    color: var(--gold-hover);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* --- HEADER ARCHITECTURE --- */
.site-header {
    background: var(--black-deep);
    border-bottom: 3px solid var(--gold-main);
    position: relative;
    z-index: 10000;
}

/* FIX: Floating Search Icon (Correct Class) */
.royal-search-container {
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    z-index: 10001;
}

.search-icon-btn {
    background: transparent;
    border: none;
    color: var(--gold-main);
    font-size: 20px;
    cursor: pointer;
    padding: 10px;
}

/* FIX: Mobile Overlap & Padding */
@media (max-width: 768px) {
    body {
        padding-bottom: 80px;
        /* Ensure space for fixed bottom bar */
    }

    /* Raise Weglot slightly if present */
    .wg-default {
        bottom: 90px !important;
    }
}

/* FIX: Global Contrast for Light Sections */
.light-section,
.entry-content table {
    color: #111;
    /* Dark text for readability */
}

.light-section h1,
.light-section h2,
.light-section h3 {
    color: var(--black-deep);
}

/* 1. Top Bar */
.top-bar {
    background: var(--black-deep);
    border-bottom: 1px solid var(--black-card);
    font-size: 13px;
    padding: 8px 0;
}

.top-bar-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-info span {
    margin-left: 15px;
    color: var(--text-muted);
}

.top-info .dashicons {
    color: var(--gold-main);
    vertical-align: middle;
}

.top-social a {
    margin-right: 15px;
    color: var(--text-muted);
    font-size: 12px;
}

/* 2. Branding (Centered) */
.branding-bar {
    padding: 30px 0;
    text-align: center;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000000 70%);
}

.site-branding img.custom-logo {
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.6);
    border: 2px solid var(--gold-main);
    background: #fff;
    padding: 5px;
    transition: transform 0.3s;
}

.site-branding img.custom-logo:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.9);
}

/* 3. Navigation (Centered Strip) */
.navigation-bar {
    background: var(--black-soft);
    border-top: 1px solid #222;
}

.royal-menu-container {
    width: 100%;
    position: relative;
    z-index: 2000;
}

/* ============================================================
   ROYAL NAVIGATION (Oxford Style - Professional & Clean)
   ============================================================ */

/* 1. Top Level Container */
.royal-menu-container {
    display: block;
    background: transparent;
}

ul.royal-menu-ul-clean {
    display: flex;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    /* Default: Allow wrapping on small screens */
}

/* Force Single Line on Desktop (AGGRESSIVE) */
@media (min-width: 992px) {
    ul.royal-menu-ul-clean {
        flex-wrap: nowrap !important;
        white-space: nowrap !important;
    }
}

ul.royal-menu-ul-clean>li {
    position: relative;
}

/* 2. Top Level Links */
ul.royal-menu-ul-clean>li>a {
    display: block;
    padding: 16px 14px;
    /* Pro Spacing (v1.9.7) */
    color: var(--gold-main);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    border: none;
}

/* Top Level Hover */
/* Top Level Hover - Elegant Fix (v1.9.5) */
ul.royal-menu-ul-clean>li:hover>a,
ul.royal-menu-ul-clean>li.current-menu-item>a,
ul.royal-menu-ul-clean>li.current_page_parent>a,
ul.royal-menu-ul-clean>li.current-menu-ancestor>a {
    background: transparent !important;
    /* FORCED TRANSPARENCY */
    color: #fff !important;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.8);
    border-bottom: 2px solid var(--gold-main);
}

/* Remove Top Level Arrows - FORCED */
ul.royal-menu-ul-clean>li.menu-item-has-children>a::after {
    display: none !important;
    content: none !important;
}

/* 3. Submenus (The Dropdown) */
ul.royal-menu-ul-clean ul.sub-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 240px;
    background: var(--black-deep);
    border-top: 2px solid var(--gold-main);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    visibility: hidden;
    opacity: 1;
    transition: all 0.2s ease;
    z-index: 999;
    padding: 0;
    list-style: none;
    text-align: right;
}

/* Show Submenu on Hover */
ul.royal-menu-ul-clean li:hover>ul.sub-menu {
    visibility: visible;
    opacity: 1;
}

/* Submenu Links */
ul.royal-menu-ul-clean ul.sub-menu li a {
    display: block;
    padding: 12px 18px;
    color: var(--text-light);
    font-size: 14px;
    font-family: var(--font-body);
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
    border-bottom: 1px solid #111;
}

ul.royal-menu-ul-clean ul.sub-menu li a:hover {
    background: #222;
    color: var(--gold-main);
    padding-right: 22px;
}

/* 4. Level 3 (Flyout) - Desktop Only */
@media (min-width: 992px) {
    ul.royal-menu-ul-clean ul.sub-menu ul.sub-menu {
        top: 0;
        right: 100%;
        margin-right: 0;
        border-top: none;
        border-right: 2px solid var(--gold-main);
    }

    /* Arrow removed as per request */
    ul.royal-menu-ul-clean ul.sub-menu li.menu-item-has-children>a::after {
        display: none !important;
    }
}

/* --- HERO SECTION --- */
.hero-section {
    position: relative;
    overflow: hidden;
    min-height: 80vh;
    display: flex;
    align-items: center;
    background-color: var(--gold-main);
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 0;
    opacity: 0.4;
    animation: heroZoom 20s infinite alternate;
}

@keyframes heroZoom {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.1);
    }
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, #050505 0%, rgba(5, 5, 5, 0.6) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    width: 100%;
    padding-top: 50px;
}

/* --- FOOTER --- */
.site-footer {
    background: var(--black-deep);
    padding: 50px 0;
    border-top: 5px solid var(--gold-main);
    text-align: center;
    color: #666;
}

/* --- RESPONSIVE --- */
.menu-toggle {
    display: none;
    width: 100%;
    background: #111;
    color: var(--gold-main);
    border: none;
    border-bottom: 2px solid var(--gold-main);
    padding: 15px;
    font-size: 18px;
    font-family: var(--font-heading);
    cursor: pointer;
    text-align: right;
    outline: none;
}

/* Fix for Tablet/Mobile Menu Display */
@media (max-width: 991px) {

    /* --- CLASSIC VERTICAL MOBILE MENU (v18.6 Professional) --- */
    .menu-toggle {
        display: block;
    }

    .navigation-bar {
        border-top: none;
    }

    ul.royal-menu-ul-clean {
        display: none;
        /* Hidden by default */
        background: var(--black-deep);
        width: 100%;
        padding: 0;
        margin: 0;
        border-top: 1px solid #222;
    }

    /* When Toggled: Show as Vertical List */
    .main-navigation.toggled ul.royal-menu-ul-clean {
        display: block !important;
        animation: mobileSlide 0.3s ease;
    }

    /* Top Level Items - Full Width Vertical */
    ul.royal-menu-ul-clean>li {
        width: 100%;
        border-bottom: 1px solid var(--black-card);
        background: transparent;
    }

    /* Top Level Links - Professional Spacing */
    ul.royal-menu-ul-clean>li>a {
        display: block;
        padding: 15px 20px;
        color: var(--gold-main);
        font-size: 16px;
        font-weight: 600;
        text-align: right;
        border-right: 3px solid transparent;
        transition: all 0.3s ease;
    }

    /* Active/Hover State */
    ul.royal-menu-ul-clean>li>a:hover,
    ul.royal-menu-ul-clean>li.current-menu-item>a {
        background: rgba(212, 175, 55, 0.1);
        border-right-color: var(--gold-main);
        padding-right: 25px;
    }

    /* Submenu Container */
    ul.royal-menu-ul-clean ul.sub-menu {
        position: static;
        visibility: visible;
        opacity: 1;
        width: 100%;
        background: #0a0a0a;
        border-top: none;
        box-shadow: none;
        display: none;
        /* Hidden by default */
        padding: 0;
    }

    /* Show Submenu when parent has active-sub class */
    ul.royal-menu-ul-clean li.active-sub>ul.sub-menu {
        display: block !important;
    }

    /* Submenu Items */
    ul.royal-menu-ul-clean ul.sub-menu li {
        width: 100%;
        border-bottom: 1px solid #111;
    }

    /* Submenu Links - Indented */
    ul.royal-menu-ul-clean ul.sub-menu li a {
        display: block;
        padding: 12px 20px 12px 40px;
        color: #ccc;
        font-size: 14px;
        text-align: right;
        transition: all 0.2s;
    }

    ul.royal-menu-ul-clean ul.sub-menu li a:hover {
        background: #111;
        color: var(--gold-main);
        padding-right: 45px;
    }

    /* Level 3 Submenu - Further Indented */
    ul.royal-menu-ul-clean ul.sub-menu ul.sub-menu {
        background: #050505;
    }

    ul.royal-menu-ul-clean ul.sub-menu ul.sub-menu li a {
        padding-right: 60px;
    }
}

@keyframes fadeIn {
    from {
        opacity: 1;
    }

    to {
        opacity: 1;
    }
}

@keyframes mobileSlide {
    from {
        opacity: 1;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- HEADER ACTIONS --- */
.btn-royal-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 25px;
    background: transparent !important;
    /* Forced Transparency */
    border: 1px solid var(--gold-main);
    color: var(--gold-main);
    font-family: var(--font-body);
    font-weight: 700;
    border-radius: 50px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn-royal-cta:hover {
    background: transparent;
    color: #fff;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
    transform: translateY(-2px);
    border-color: var(--gold-main);
    text-shadow: 0 0 5px var(--gold-main);
}

/* --- ANIMATIONS --- */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

/* --- ROYAL PAGINATION --- */
.royal-pagination {
    margin-top: 60px;
    margin-bottom: 30px;
    text-align: center;
    width: 100%;
    display: flex;
    justify-content: center;
}

.royal-pagination .nav-links {
    display: inline-flex;
    gap: 15px;
    background: rgba(17, 17, 17, 0.8);
    backdrop-filter: blur(5px);
    padding: 15px 30px;
    border-radius: 50px;
    border: 1px solid #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    align-items: center;
}

.royal-pagination .page-numbers {
    color: #fff;
    background: transparent;
    padding: 10px 20px;
    border: 1px solid #444;
    border-radius: 30px;
    transition: all 0.3s ease;
    font-weight: bold;
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.royal-pagination .page-numbers.current {
    background: var(--gold-main);
    color: var(--black-deep);
    border-color: var(--gold-main);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
    transform: scale(1.1);
}

.royal-pagination .page-numbers:hover:not(.current) {
    border-color: var(--gold-main);
    color: var(--gold-main);
    transform: translateY(-2px);
}

.royal-pagination .page-numbers.prev,
.royal-pagination .page-numbers.next {
    border: none;
    font-size: 16px;
    padding: 10px 15px;
}

.royal-pagination .page-numbers .dashicons {
    font-size: 18px;
    margin: 0 5px;
}


/* --- GLOBAL MENU RESET (NO ARROWS) --- */
.royal-menu-ul-clean li a::after,
.royal-menu-ul-clean li a::before,
.royal-menu-ul-clean li::after,
.royal-menu-ul-clean li::before,
.menu-item-has-children>a::after,
.page_item_has_children>a::after {
    content: none !important;
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    border: none !important;
}

/* ICON VISIBILITY NOW CONTROLLED BY CUSTOMIZER (V18.3) */
/* Previously: Lines 582-591 hid icons globally - REMOVED to let Customizer work */

/* --- MOBILE STUDENT HUB (V1.4) --- */
.student-hub-mobile {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #111;
    border-top: 2px solid var(--gold-main);
    z-index: 9999;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
}

.hub-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #888;
    text-decoration: none;
    font-size: 12px;
    font-family: 'Cairo', sans-serif;
    transition: all 0.3s;
}

.hub-item .dashicons {
    font-size: 24px;
    margin-bottom: 5px;
    width: auto;
    height: auto;
    color: #fff;
}

.hub-item.active,
.hub-item:active {
    color: var(--gold-main);
}

.hub-item.active .dashicons,
.hub-item:active .dashicons {
    color: var(--gold-main);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

@media (max-width: 768px) {
    .student-hub-mobile {
        display: flex;
    }

    .site-footer {
        padding-bottom: 90px !important;
    }
}


/* --- MOBILE FOOTER ACCORDION (V1.4) --- */
@media (max-width: 768px) {
    .footer-widget h4 {
        cursor: pointer;
        position: relative;
        padding-left: 20px;
    }

    .footer-widget h4::after {
        content: '\f347';
        font-family: 'dashicons';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        transition: transform 0.3s;
    }

    .footer-widget.active h4::after {
        transform: translateY(-50%) rotate(180deg);
    }

    .footer-widget h4+* {
        display: none;
    }

    .footer-widget.active h4+* {
        display: block;
        animation: slideDown 0.3s ease;
    }

    @keyframes slideDown {
        from {
            opacity: 1;
            transform: translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}


/* --- FLIP CARDS (V1.4) --- */
.branch-flip-container:hover .branch-flip-inner {
    transform: rotateY(180deg);
    cursor: pointer;
}

/* --- ACADEMIC FOOTER (V1.4.1) --- */
.academic-title {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gold-main);
    display: inline-block;
}

.academic-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.academic-list li {
    margin-bottom: 12px;
}

.academic-list li a {
    color: #bbb;
    text-decoration: none;
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

.academic-list li a:hover {
    color: var(--gold-main);
    transform: translateX(-5px);
}

.academic-list li a .dashicons {
    font-size: 14px;
    margin-left: 8px;
    opacity: 0.7;
}

.contact-list li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
}

.contact-list .icon {
    min-width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 15px;
    color: var(--gold-main);
}

.contact-list .info strong {
    display: block;
    color: #fff;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.contact-list .info span {
    color: #999;
    font-size: 0.85rem;
}

.social-link {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    text-decoration: none;
    transition: all 0.3s;
}

.social-link:hover {
    background: var(--gold-main);
    color: var(--black-deep);
    transform: translateY(-3px);
}

.accreditation-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.accreditation-item:hover {
    border-color: var(--gold-main);
    background: rgba(212, 175, 55, 0.1);
}

.accreditation-item span {
    display: block;
    margin-top: 8px;
    font-size: 0.8rem;
    color: #bbb;
}

@media (max-width: 768px) {
    .site-info-academic .container {
        flex-direction: column;
        text-align: center;
    }

    .footer-bottom-links {
        margin-top: 15px;
    }

    .footer-bottom-links a {
        margin: 0 10px !important;
    }
}

/* --- REFINED ALIGNMENT (V1.4.4) --- */
.academic-col {
    vertical-align: top;
}

.academic-col h4.academic-title {
    margin-top: 5px;
    /* Visual alignment with logo text */
    min-height: 30px;
    /* Ensure headers line up even if font loads differently */
    display: flex;
    align-items: center;
}

.active-sub {
    /* Fix for mobile accordion styling */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* List Alignment */
.academic-list li,
.contact-list li {
    display: flex !important;
    align-items: flex-start !important;
    /* Align to top for multi-line text */
    margin-bottom: 15px !important;
    line-height: 1.6 !important;
}

.academic-list li a {
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s ease;
}

.academic-list li a:hover {
    transform: translateX(-5px);
    /* RTL slide effect */
}

/* Icon Spacing */
.contact-list .icon {
    min-width: 25px;
    margin-left: 10px;
    color: var(--gold-main);
    padding-top: 3px;
    /* Optical alignment with text line */
}

/* Copyright Bar Alignment */
.site-info-academic .container {
    padding-left: 15px;
    padding-right: 15px;
}

@media (max-width: 768px) {
    .site-info-academic .container {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .footer-bottom-links {
        margin-top: 10px;
    }

    .footer-bottom-links a {
        margin: 0 8px !important;
        display: inline-block;
    }
}

/* --- ROYAL SEAL ANIMATION (V1.4.5) --- */
.royal-seal-spin {
    animation: royalSealRotate 10s infinite linear;
    transform-style: preserve-3d;
    display: block;
    /* Soft Glow Effect */
    filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.3));
}

@keyframes royalSealRotate {
    0% {
        transform: rotateY(0deg);
    }

    100% {
        transform: rotateY(360deg);
    }
}

/* Pause on hover for elegance */
.royal-seal-spin:hover {
    animation-play-state: paused;
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.6));
}

/* Top Level Hover - ULTRA SPECIFIC FIX (v1.9.6 - FINAL) */
html body ul.royal-menu-ul-clean>li:hover>a,
html body ul.royal-menu-ul-clean>li.current-menu-item>a,
html body ul.royal-menu-ul-clean>li.current_page_parent>a,
html body ul.royal-menu-ul-clean>li.current-menu-ancestor>a,
html body ul.royal-menu-ul-clean>li.current_page_ancestor>a {
    background: transparent !important;
    /* NUCLEAR TRANSPARENCY */
    color: #fff !important;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.8) !important;
    border-bottom: 2px solid var(--gold-main) !important;
    box-shadow: none !important;
}

/* =========================================
   CURRICULUM PAGE (V3.2 ADDITION)
   ========================================= */
.curriculum-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* Sidebar */
.curriculum-sidebar {
    width: 250px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    /* Adjust based on header height */
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

.sidebar-title {
    color: var(--gold-main);
    font-size: 1.2rem;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 1px solid var(--black-card);
    padding-bottom: 10px;
}

.year-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.year-list li {
    padding: 12px 15px;
    border-bottom: 1px solid #1a1a1a;
    cursor: pointer;
    transition: all 0.3s;
    color: #ccc;
    font-weight: 500;
}

.year-list li:hover,
.year-list li.active {
    background: rgba(212, 175, 55, 0.1);
    color: var(--gold-main);
    border-right: 3px solid var(--gold-main);
    /* RTL indicator */
}

/* Content Area */
.curriculum-content {
    flex-grow: 1;
}

.stage-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.stage-section.active {
    display: block;
}

.stage-title {
    color: var(--gold-main);
    margin-bottom: 25px;
    font-size: 1.8rem;
    border-bottom: 2px solid #222;
    padding-bottom: 10px;
}

/* Semester Grid */
.semester-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.semester-col {
    background: #0f0f0f;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 20px;
    transition: transform 0.3s;
}

.semester-col:hover {
    transform: translateY(-5px);
    border-color: #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.semester-title {
    color: #fff;
    font-size: 1.3rem;
    margin-bottom: 20px;
    text-align: center;
    background: #1a1a1a;
    padding: 10px;
    border-radius: 5px;
    border-bottom: 2px solid var(--gold-main);
}

.subject-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.subject-list li {
    padding: 10px 0;
    border-bottom: 1px dashed #333;
    color: #bbb;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}

.subject-list li:before {
    content: "�";
    color: var(--gold-main);
    font-size: 1.5rem;
    line-height: 0;
    margin-left: 10px;
    /* RTL */
    position: relative;
    top: 2px;
}

.subject-list li:last-child {
    border-bottom: none;
}

/* Responsive */
@media (max-width: 991px) {
    .curriculum-container {
        flex-direction: column;
    }

    .curriculum-sidebar {
        width: 100%;
        position: static;
        margin-bottom: 30px;
    }

    .year-list {
        display: flex;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .year-list li {
        white-space: nowrap;
        border-right: none;
        border-bottom: 3px solid transparent;
        flex-shrink: 0;
    }

    .year-list li.active,
    .year-list li:hover {
        border-right: none;
        border-bottom-color: var(--gold-main);
    }
}

@media (max-width: 768px) {
    .semester-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   ABOUT PAGE (V3.2 ADDITION)
   ========================================= */

/* History Section */
.history-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 60px;
    align-items: center;
}

.lead-text {
    font-size: 1.25rem;
    color: #fff;
    line-height: 1.8;
    margin-bottom: 20px;
    font-weight: 300;
}

.history-stats {
    display: flex;
    gap: 40px;
    margin-top: 40px;
    border-top: 1px solid #333;
    padding-top: 30px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gold-main);
    line-height: 1;
    font-family: var(--font-heading);
}

.stat-label {
    color: #888;
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Image Frame */
.image-frame {
    position: relative;
    padding: 15px;
    border: 2px solid var(--gold-main);
}

.image-frame img {
    display: block;
    width: 100%;
    height: auto;
    filter: sepia(20%) contrast(1.1);
    /* Royal look */
}

.image-frame:before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(212, 175, 55, 0.3);
    z-index: -1;
}

/* Mission Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.mission-card {
    background: #111;
    padding: 40px 30px;
    text-align: center;
    border: 1px solid #222;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.mission-card:hover {
    transform: translateY(-10px);
    border-color: var(--gold-main);
}

.card-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 25px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon .dashicons {
    font-size: 32px;
    color: var(--gold-main);
    width: auto;
    height: auto;
}

.mission-card h3 {
    color: #fff;
    font-size: 1.4rem;
    margin-bottom: 15px;
}

.mission-card p {
    color: #aaa;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 991px) {
    .history-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .image-frame:before {
        display: none;
        opacity: 1;
        transform: none;
        transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    /* Specific heights/widths to force diversity */
    .royal-gallery-container .blocks-gallery-item:nth-child(even) {
        flex-basis: 40%;
    }

    .royal-gallery-container .blocks-gallery-item:nth-child(odd) {
        flex-basis: 25%;
    }

    .royal-gallery-container .blocks-gallery-item:nth-child(3n) {
        flex-basis: 30%;
    }

    /* Reveal Animation Class */
    .royal-gallery-container .blocks-gallery-item.visible,
    .royal-gallery-container .wp-block-image.visible {
        opacity: 1;
        transform: translateY(0);
    }

    .royal-gallery-container img {
        border-radius: 12px;
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.1s ease-out;
    }

    /* 2. Lightbox Styles */
    #royal-lightbox {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 100000;
        display: flex;
        justify-content: center;
        align-items: center;
        opacity: 1;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    #royal-lightbox.active {
        opacity: 1;
        pointer-events: auto;
    }

    .lightbox-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(5px);
    }

    .lightbox-content {
        position: relative;
        max-width: 90%;
        max-height: 90%;
        z-index: 2;
        animation: zoomIn 0.3s ease;
    }

    @keyframes zoomIn {
        from {
            transform: scale(0.9);
            opacity: 1;
        }

        to {
            transform: scale(1);
            opacity: 1;
        }
    }

    .lightbox-image {
        max-width: 100%;
        max-height: 85vh;
        border: 3px solid var(--gold-main);
        border-radius: 4px;
        box-shadow: 0 0 30px rgba(212, 175, 55, 0.3);
    }

    .lightbox-close {
        position: absolute;
        top: -40px;
        right: -20px;
        color: #fff;
        background: transparent;
        border: none;
        font-size: 30px;
        cursor: pointer;
    }

    .lightbox-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(255, 255, 255, 0.1);
        color: var(--gold-main);
        border: 1px solid var(--gold-main);
        border-radius: 50%;
        width: 50px;
        height: 50px;
        font-size: 20px;
        cursor: pointer;
        transition: all 0.3s;
    }

    .lightbox-nav:hover {
        background: var(--gold-main);
        color: var(--black-deep);
    }

    .lightbox-nav.prev {
        left: -70px;
    }

    .lightbox-nav.next {
        right: -70px;
    }

    .lightbox-caption {
        color: var(--gold-main);
        text-align: center;
        margin-top: 15px;
        font-size: 16px;
        font-family: var(--font-heading);
    }

    @media (max-width: 768px) {
        .lightbox-nav.prev {
            left: 10px;
        }

        .lightbox-nav.next {
            right: 10px;
        }

        .royal-gallery-container .blocks-gallery-item {
            flex-basis: 100% !important;
            margin-bottom: 10px !important;
        }
    }
}

/* =========================================
   ?? ROYAL FILTER BAR (V3 - Smart AI)
   ========================================= */
.royal-filter-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.royal-filter-btn {
    background: transparent;
    color: #888;
    border: 1px solid #333;
    padding: 10px 25px;
    border-radius: 50px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 14px;
    transition: all 0.3s ease;
}

.royal-filter-btn:hover,
.royal-filter-btn.active {
    background: var(--gold-main);
    color: var(--black-deep);
    border-color: var(--gold-main);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
    transform: translateY(-2px);
}



/* =========================================
   ??? ROYAL MOSAIC GALLERY (V4 - Pinterest Style)
   ========================================= */

.royal-gallery-container .wp-block-gallery {
    column-count: 3;
    column-gap: 20px;
    display: block !important;
    /* Override flex */
}

.royal-gallery-container .blocks-gallery-item,
.royal-gallery-container .wp-block-image {
    display: inline-block !important;
    width: 100% !important;
    margin-bottom: 20px !important;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    break-inside: avoid;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.royal-gallery-container img {
    width: 100% !important;
    height: auto !important;
    display: block;
    border-radius: 12px;
}

/* SMART BADGE */
.royal-smart-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.8);
    color: var(--gold-main);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-family: var(--font-body);
    border: 1px solid var(--gold-main);
    z-index: 10;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.royal-gallery-container .blocks-gallery-item:hover .royal-smart-badge,
.royal-gallery-container .wp-block-image:hover .royal-smart-badge {
    opacity: 1;
    transform: translateY(0);
}

/* HOVER EFFECT */
.royal-gallery-container .blocks-gallery-item:hover,
.royal-gallery-container .wp-block-image:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

/* LIGHTBOX (Retained) */
#royal-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

#royal-lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content img {
    max-height: 90vh;
    max-width: 90vw;
    border: 2px solid var(--gold-main);
    border-radius: 5px;
    box-shadow: 0 0 50px rgba(212, 175, 55, 0.2);
}

@media (max-width: 991px) {
    .royal-gallery-container .wp-block-gallery {
        column-count: 2;
    }
}

/* Fallback Static Class for Custom Colors */
.royal-static-text {
    font-weight: 700;
    line-height: 1.2;
    position: relative;
    z-index: 10;
    /* No gradient or text-fill-color here, allowing inline color to work */
}

@media (max-width: 600px) {
    .royal-gallery-container .wp-block-gallery {
        column-count: 1;
    }
}

/* --- ROYAL PARTNER CARDS (Interactive Redesign V30.0) --- */
.royal-partner-card {
    background: var(--black-card);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 16px;
    padding: 40px 30px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    position: relative;
    z-index: 1;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.royal-partner-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--gold-main);
    box-shadow: 0 15px 40px rgba(212, 175, 55, 0.25);
    z-index: 10;
}

/* 1. Icon Box */
.rpc-icon-box {
    width: 90px;
    height: 90px;
    margin: 0 auto 25px;
    background: linear-gradient(135deg, #222, #000);
    border: 1px solid #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    color: #fff;
    transition: all 0.5s ease;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 2;
}

.royal-partner-card:hover .rpc-icon-box {
    background: var(--gold-main);
    color: #000;
    border-color: var(--gold-main);
    transform: rotateY(180deg);
    box-shadow: 0 0 20px var(--gold-hover);
}

.rpc-icon {
    display: inline-block;
    transition: transform 0.5s;
}

.royal-partner-card:hover .rpc-icon {
    transform: rotateY(-180deg);
}

/* 2. Content */
.rpc-content {
    position: relative;
    z-index: 2;
}

.rpc-title {
    font-size: 1.3rem;
    color: var(--gold-main);
    margin-bottom: 10px;
    font-family: var(--font-heading);
    font-weight: 700;
    transition: color 0.3s;
}

.royal-partner-card:hover .rpc-title {
    color: var(--gold-hover);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

.rpc-desc {
    font-size: 0.95rem;
    color: var(--text-light);
    opacity: 0.7;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* 3. Badge */
.rpc-badge {
    display: inline-block;
    padding: 6px 18px;
    background: transparent;
    border: 1px solid var(--gold-muted);
    color: var(--gold-muted);
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: bold;
    transition: all 0.3s;
}

.royal-partner-card:hover .rpc-badge {
    background: var(--gold-main);
    color: #000;
    border-color: var(--gold-main);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* 4. Glow Overlay */
.rpc-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(212, 175, 55, 0.15) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
    z-index: 0;
    transform: scale(0.8);
}

.royal-partner-card:hover .rpc-glow {
    opacity: 1;
    transform: scale(1.2);
}

/* Partner Logo Image */
.rpc-logo-img {
    width: 65%;
    height: 65%;
    object-fit: contain;
    filter: brightness(0) invert(1);
    /* Make it white initially */
    transition: all 0.4s ease;
}

.royal-partner-card:hover .rpc-logo-img {
    filter: none;
    /* Show original colors OR gold */
    transform: scale(1.1);
}

/* Partner Logo Refinement V30.0.3 */
.rpc-logo-img {
    width: 85% !important;
    /* Increased from 65% */
    height: 85% !important;
    object-fit: contain;
    filter: grayscale(100%) brightness(1.2);
    /* Cleaner silver look */
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    /* Ensure image itself is circular if needed */
}

.royal-partner-card:hover .rpc-logo-img {
    filter: none;
    transform: scale(1.15) rotate(0deg);
    /* Slight pop */
}

/* V30.0.4 Logo Tweaks (Rectangular Support) */
.rpc-logo-img {
    border-radius: 0 !important;
    /* Allow rectangular logos */
    width: 90% !important;
    /* Maximized visibility */
    height: 90% !important;
}

/* =========================================
   ⏳ ROYAL PRELOADER (V31.0 IMPERIAL)
   ========================================= */
#royal-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #050505;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-out;
}

.preloader-logo {
    width: 120px;
    height: auto;
    margin-bottom: 20px;
    animation: pulseGold 2s infinite;
    text-align: center;
}

.preloader-logo img {
    max-width: 100%;
    height: auto;
}

.preloader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(212, 175, 55, 0.2);
    border-top: 3px solid var(--gold-main);
    border-radius: 50%;
    animation: spinRoyal 1s linear infinite;
}

@keyframes pulseGold {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.2));
    }

    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.6));
    }

    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.2));
    }
}

@keyframes spinRoyal {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* =========================================
   🌙 ROYAL DARK MODE (V31.0 IMPERIAL)
   ========================================= */
.royal-dark-mode-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    background: #111;
    border: 2px solid var(--gold-main);
    border-radius: 50%;
    z-index: 9999;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.3s;
}

.royal-dark-mode-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.6);
}

/* Global Override Classes */
body.royal-dark-mode {
    background-color: #050505 !important;
    color: #e0e0e0 !important;
}

body.royal-dark-mode .site-header,
body.royal-dark-mode .site-footer {
    background-color: #000 !important;
}

body.royal-dark-mode .royal-card,
body.royal-dark-mode .news-card {
    background: #121212 !important;
    border: 1px solid #333 !important;
}