/* RTL (Right-to-Left) Styles for Arabic Language */

/* Base RTL Direction */
html[dir="rtl"],
body[dir="rtl"] {
    direction: rtl;
    text-align: right;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
}

html[dir="rtl"] * {
    direction: inherit;
}

/* Navigation RTL - Ensure navbar stays fixed */
body[dir="rtl"] .navbar {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
}

/* Navigation RTL */
body[dir="rtl"] .nav-container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

/* Logo first (on the right in RTL) */
body[dir="rtl"] .logo {
    flex-direction: row;
    order: 1;
    margin-left: auto;
    margin-right: 0;
}

/* Logo image first, then text in RTL */
body[dir="rtl"] .logo-image {
    order: 1;
}

body[dir="rtl"] .logo h1 {
    order: 2;
}

/* Navigation menu second (in the center) */
body[dir="rtl"] .nav-menu {
    flex-direction: row-reverse;
    order: 2;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
}

/* Header controls container (mode switch + language selector) on the left */
body[dir="rtl"] .header-controls {
    order: 3;
    flex-direction: row;
    margin-left: 0;
    margin-right: auto;
    gap: 1rem;
}

/* Mode switch third (before language selector) */
body[dir="rtl"] .theme-toggle-desktop {
    order: 1;
}

/* Language selector fourth (after mode switch) */
body[dir="rtl"] .language-selector-desktop {
    order: 2;
    margin-left: 0;
    margin-right: 0;
}

body[dir="rtl"] .nav-menu > .nav-item {
    margin-left: 0;
    margin-right: 0;
}

body[dir="rtl"] .nav-menu > .nav-item > a {
    padding: 1rem 1.5rem;
}

body[dir="rtl"] .hamburger {
    order: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Language Selector RTL */
body[dir="rtl"] .language-selector-desktop {
    margin-left: 0;
    margin-right: 1rem;
}

/* Language Dropdown RTL */
body[dir="rtl"] .language-dropdown-btn {
    text-align: right;
}

body[dir="rtl"] .language-text {
    text-align: right;
}

body[dir="rtl"] .language-dropdown-menu {
    right: auto;
    left: 0;
}

body[dir="rtl"] .language-option {
    text-align: right;
    flex-direction: row-reverse;
}

body[dir="rtl"] .language-option span {
    text-align: right;
}

body[dir="rtl"] .language-selector-menu {
    text-align: right;
}

body[dir="rtl"] .language-selector-menu label {
    text-align: right;
}

body[dir="rtl"] .language-option-mobile {
    flex-direction: row-reverse;
    text-align: right;
}

body[dir="rtl"] .language-option-mobile::before {
    left: auto;
    right: 0;
}

body[dir="rtl"] .language-option-mobile:hover {
    transform: translateX(-5px);
}

body[dir="rtl"] .language-option-mobile span {
    text-align: right;
}

/* Slideshow RTL */
body[dir="rtl"] .slideshow-nav.prev {
    left: auto;
    right: 20px;
}

body[dir="rtl"] .slideshow-nav.next {
    right: auto;
    left: 20px;
}

body[dir="rtl"] .slide-content {
    text-align: right;
    left: auto;
    right: 0;
}

body[dir="rtl"] .slide-link {
    text-align: right;
    display: inline-flex;
    flex-direction: row-reverse;
}

body[dir="rtl"] .slide-link::after {
    content: '←';
    margin-right: 0.75rem;
    margin-left: 0;
}

body[dir="rtl"] .slide-link:hover::after {
    transform: translateX(-5px);
}

/* Hero Slider RTL */
body[dir="rtl"] .hero-slider {
    direction: rtl;
}

body[dir="rtl"] .hero-slide-content {
    text-align: right;
}

body[dir="rtl"] .hero-content-inner {
    text-align: right;
}

body[dir="rtl"] .hero-title,
body[dir="rtl"] .hero-description {
    text-align: right;
}

body[dir="rtl"] .hero-nav-prev {
    left: auto;
    right: 2rem;
}

body[dir="rtl"] .hero-nav-next {
    right: auto;
    left: 2rem;
}

body[dir="rtl"] .hero-nav-prev i {
    transform: scaleX(-1);
}

body[dir="rtl"] .hero-nav-next i {
    transform: scaleX(-1);
}

/* Image Hero Section RTL */
body[dir="rtl"] .image-hero-section {
    direction: rtl;
}

body[dir="rtl"] .image-hero-content {
    text-align: right;
}

body[dir="rtl"] .image-hero-content h2,
body[dir="rtl"] .image-hero-content p {
    text-align: right;
}

/* Video Hero RTL */
body[dir="rtl"] .video-section {
    direction: rtl;
}

body[dir="rtl"] .video-hero-content {
    text-align: right;
}

body[dir="rtl"] .video-hero-content h2,
body[dir="rtl"] .video-hero-content p {
    text-align: right;
}

body[dir="rtl"] .video-content {
    text-align: right;
}

body[dir="rtl"] .video-content h2,
body[dir="rtl"] .video-content p {
    text-align: right;
}

/* Section Headers RTL */
body[dir="rtl"] .section-header {
    flex-direction: row-reverse;
}

body[dir="rtl"] .view-all-link {
    flex-direction: row-reverse;
}

/* Content Sections RTL */
body[dir="rtl"] .content-section {
    text-align: right;
}

body[dir="rtl"] .content-section h2 {
    text-align: center;
}

body[dir="rtl"] .latest-section .section-header h2 {
    text-align: right;
}

body[dir="rtl"] .features-grid {
    direction: rtl;
}

body[dir="rtl"] .feature-card {
    text-align: center;
}

/* Post Cards RTL */
body[dir="rtl"] .post {
    direction: rtl;
}

body[dir="rtl"] .post-content,
body[dir="rtl"] .latest-post-content {
    text-align: right;
}

body[dir="rtl"] .post h4,
body[dir="rtl"] .latest-post-content h3 {
    text-align: right;
}

body[dir="rtl"] .post p,
body[dir="rtl"] .latest-post-content p {
    text-align: right;
}

body[dir="rtl"] .post-date,
body[dir="rtl"] .latest-post-date {
    text-align: right;
}

body[dir="rtl"] .read-more-link,
body[dir="rtl"] .latest-read-more {
    align-self: flex-end;
    text-align: right;
}

/* Categories Sidebar RTL */
body[dir="rtl"] .categories-layout {
    direction: rtl;
}

body[dir="rtl"] .categories-sidebar {
    border-right: none;
    border-left: 1px solid #e0e0e0;
    padding-right: 0;
    padding-left: 2rem;
}

body[dir="rtl"] .subcategory-item a {
    border-left: none;
    border-right: 2px solid transparent;
    padding-right: 0.75rem;
    padding-left: 0.5rem;
}

body[dir="rtl"] .subcategory-item.active a,
body[dir="rtl"] .subcategory-item a:hover {
    border-right-color: var(--oxford-blue);
    border-left-color: transparent;
}

body[dir="rtl"] .subcategory-list {
    padding-right: 1rem;
    padding-left: 0;
}

body[dir="rtl"] .category-item-header {
    flex-direction: row-reverse;
    text-align: right;
}

body[dir="rtl"] .list-arrow {
    transform: scaleX(-1);
}

body[dir="rtl"] .category-item.active .list-arrow {
    transform: scaleX(-1) rotate(180deg);
}

/* Page Header RTL */
body[dir="rtl"] .page-header-content {
    flex-direction: row-reverse;
}

body[dir="rtl"] .page-header-text {
    text-align: right;
}

body[dir="rtl"] .breadcrumbs {
    direction: rtl;
    text-align: right;
}

body[dir="rtl"] .breadcrumbs .container {
    text-align: right;
}

body[dir="rtl"] .breadcrumbs span {
    margin: 0 0.5rem;
    transform: scaleX(-1);
}

body[dir="rtl"] .breadcrumbs a::after {
    content: '←';
    margin-right: 0.5rem;
    margin-left: 0;
}

body[dir="rtl"] .breadcrumbs a::before {
    content: none;
}

/* Contact Form RTL */
body[dir="rtl"] .contact-container {
    direction: rtl;
}

body[dir="rtl"] .contact-form input,
body[dir="rtl"] .contact-form textarea {
    text-align: right;
}

body[dir="rtl"] .contact-form label {
    text-align: right;
}

/* Footer RTL */
body[dir="rtl"] .footer-content {
    direction: rtl;
}

body[dir="rtl"] .footer-section {
    text-align: right;
}

body[dir="rtl"] .footer-section h3 {
    text-align: right;
}

body[dir="rtl"] .footer-section h3::after {
    left: auto;
    right: 0;
    width: 50px;
    height: 3px;
    background: var(--oxford-blue);
}

body[dir="rtl"] .footer-section ul {
    text-align: right;
}

body[dir="rtl"] .footer-section ul li {
    padding-left: 0;
    padding-right: 1.25rem;
    text-align: right;
}

body[dir="rtl"] .footer-section ul li::before {
    left: auto;
    right: 0;
    content: '←';
}

body[dir="rtl"] .footer-section ul li:hover::before {
    transform: translateX(-5px);
}

/* Article Content RTL */
body[dir="rtl"] .article-content {
    text-align: right;
}

body[dir="rtl"] .article-content h2,
body[dir="rtl"] .article-content h3 {
    text-align: right;
}

/* Video Section RTL */
body[dir="rtl"] .video-section {
    direction: rtl;
}

body[dir="rtl"] .video-content {
    text-align: right;
}

body[dir="rtl"] .video-content h2,
body[dir="rtl"] .video-content p {
    text-align: right;
}

body[dir="rtl"] .cta-button {
    align-self: flex-end;
}

/* Latest Grid RTL */
body[dir="rtl"] .latest-grid {
    direction: rtl;
}

body[dir="rtl"] .latest-post-card {
    direction: rtl;
}

/* Category Header RTL */
body[dir="rtl"] .category-header {
    text-align: right;
}

body[dir="rtl"] .category-header h2 {
    text-align: right;
}

body[dir="rtl"] .subcategory-header {
    text-align: right;
}

body[dir="rtl"] .subcategory-header h3 {
    text-align: right;
}

/* Article RTL */
body[dir="rtl"] .article-header {
    text-align: right;
}

body[dir="rtl"] .article-header h1 {
    text-align: right;
}

body[dir="rtl"] .article-meta {
    text-align: right;
}

body[dir="rtl"] .read-more-section {
    direction: rtl;
}

body[dir="rtl"] .article-container {
    direction: rtl;
}

body[dir="rtl"] .article-description {
    border-left: none;
    border-right: 4px solid var(--oxford-gold);
    text-align: right;
}

body[dir="rtl"] .article-description p {
    text-align: right;
}

body[dir="rtl"] .slider-nav.prev-slide {
    left: auto;
    right: 20px;
}

body[dir="rtl"] .slider-nav.next-slide {
    right: auto;
    left: 20px;
}

body[dir="rtl"] .back-link {
    text-align: right;
    direction: rtl;
}

body[dir="rtl"] .back-link:hover {
    transform: translateX(5px);
}

/* Social Media RTL */
body[dir="rtl"] .social-media {
    direction: ltr; /* Keep icons LTR for proper display */
}

body[dir="rtl"] .contact-info .info-item {
    flex-direction: row-reverse;
}

body[dir="rtl"] .contact-info .info-item:has(.social-media) {
    flex-direction: column;
    align-items: flex-start;
}

/* Contact Info RTL */
body[dir="rtl"] .contact-info {
    text-align: right;
}

body[dir="rtl"] .contact-info h2 {
    text-align: right;
}

body[dir="rtl"] .contact-info p {
    text-align: right;
}

body[dir="rtl"] .info-item {
    flex-direction: row-reverse;
}

body[dir="rtl"] .info-item .info-icon {
    margin-left: 1rem;
    margin-right: 0;
}

/* Form Elements RTL */
body[dir="rtl"] .contact-form {
    direction: rtl;
    text-align: right;
}

body[dir="rtl"] .contact-form .form-group {
    text-align: right;
}

body[dir="rtl"] .contact-form button {
    align-self: flex-end;
}

/* Footer Links RTL */
body[dir="rtl"] .footer-section ul li a:hover {
    transform: translateX(-5px);
}

body[dir="rtl"] .footer-section a[href^="tel:"]:hover,
body[dir="rtl"] .footer-section a[href^="mailto:"]:hover {
    transform: translateX(-3px);
}

body[dir="rtl"] .footer-bottom {
    text-align: center;
}

/* Footer RTL Mobile */
@media (max-width: 768px) {
    body[dir="rtl"] .footer-section {
        text-align: center;
    }

    body[dir="rtl"] .footer-section h3::after {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    body[dir="rtl"] .footer-section ul li {
        padding-right: 0;
        text-align: center;
    }

    body[dir="rtl"] .footer-section ul li::before {
        display: none;
    }

    body[dir="rtl"] .footer-section ul li a:hover {
        transform: none;
    }
}

/* Slideshow Indicators RTL */
body[dir="rtl"] .slideshow-indicators {
    direction: rtl;
}


/* Mobile Menu RTL */
@media (max-width: 768px) {
    body[dir="rtl"] .nav-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Hamburger menu button - on LEFT side in RTL */
    body[dir="rtl"] .hamburger {
        display: flex !important;
        flex: 0 0 auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        order: 0 !important;
    }

    /* Logo on RIGHT side in RTL */
    body[dir="rtl"] .logo {
        order: 1;
        margin-left: auto;
        margin-right: 0;
        flex: 0 0 auto;
        gap: 0.75rem;
    }

    /* Header controls hidden in RTL mobile */
    body[dir="rtl"] .header-controls {
        display: none !important;
    }
    
    body[dir="rtl"] .theme-toggle-desktop {
        display: none !important;
    }
    
    body[dir="rtl"] .language-selector-desktop {
        display: none !important;
    }
    
    /* Menu list vertical (up to down) - slides from RIGHT in RTL */
    body[dir="rtl"] .nav-menu {
        position: fixed;
        right: -100%;
        left: auto;
        top: 70px;
        flex-direction: column;
        text-align: right;
        transform: none;
        width: 100%;
        background: linear-gradient(135deg, var(--oxford-blue) 0%, #001a33 100%);
        padding: 0;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        display: block;
    }

    body[dir="rtl"] .nav-menu.active {
        right: 0;
        left: auto;
    }

    /* Custom scrollbar for mobile menu RTL */
    body[dir="rtl"] .nav-menu::-webkit-scrollbar {
        width: 6px;
    }

    body[dir="rtl"] .nav-menu::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
    }

    body[dir="rtl"] .nav-menu::-webkit-scrollbar-thumb {
        background: var(--oxford-gold);
        border-radius: 3px;
    }

    body[dir="rtl"] .nav-menu::-webkit-scrollbar-thumb:hover {
        background: rgba(212, 175, 55, 0.8);
    }

    body[dir="rtl"] .nav-menu > .nav-item {
        width: 100%;
    }

    body[dir="rtl"] .nav-menu > .nav-item > a {
        text-align: right;
        padding: 1.25rem 1.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        display: block;
        width: 100%;
    }

    body[dir="rtl"] .nav-menu > .nav-item > a::before {
        left: auto;
        right: 0;
    }

    body[dir="rtl"] .nav-menu > .nav-item > a:hover {
        padding-left: 1.5rem;
        padding-right: 2rem;
    }

    /* Show mobile menu items (theme and language) in RTL */
    body[dir="rtl"] .theme-menu-item,
    body[dir="rtl"] .language-menu-item {
        display: block !important;
    }

    body[dir="rtl"] .theme-toggle-menu {
        padding: 1rem 1.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        text-align: right;
    }

    body[dir="rtl"] .language-selector-menu {
        padding: 1rem 1.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        text-align: right;
    }

    body[dir="rtl"] .categories-sidebar {
        border-left: none;
        border-bottom: 1px solid #e0e0e0;
        padding-left: 0;
        padding-right: 0;
        text-align: right;
    }

    body[dir="rtl"] .categories-sidebar h2 {
        text-align: right;
    }

    body[dir="rtl"] .section-header {
        flex-direction: column;
        align-items: flex-end;
    }

    body[dir="rtl"] .page-header-content {
        text-align: right;
    }

    body[dir="rtl"] .event-nav.prev {
        right: -1.5rem;
        left: auto;
    }

    body[dir="rtl"] .event-nav.next {
        left: -1.5rem;
        right: auto;
    }

    body[dir="rtl"] .slider-nav.prev-slide {
        right: 20px;
        left: auto;
    }

    body[dir="rtl"] .slider-nav.next-slide {
        left: 20px;
        right: auto;
    }

    body[dir="rtl"] #back-to-top {
        left: 2rem;
        right: auto;
    }

    body[dir="rtl"] .slideshow-nav.prev {
        right: 1rem;
        left: auto;
    }

    body[dir="rtl"] .slideshow-nav.next {
        left: 1rem;
        right: auto;
    }
}

/* Tablet RTL Support */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Hamburger on LEFT side in RTL tablets */
    body[dir="rtl"] .hamburger {
        display: flex !important;
        flex: 0 0 auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        order: 0 !important;
    }

    /* Logo on RIGHT side in RTL tablets */
    body[dir="rtl"] .logo {
        order: 1;
        margin-left: auto;
        margin-right: 0;
    }

    /* Header controls hidden in RTL tablets */
    body[dir="rtl"] .header-controls {
        display: none !important;
    }

    /* Menu slides from RIGHT in RTL tablets */
    body[dir="rtl"] .nav-menu {
        position: fixed;
        right: -100%;
        left: auto;
        top: 80px;
        transition: right 0.3s ease;
    }

    body[dir="rtl"] .nav-menu.active {
        right: 0;
        left: auto;
    }
}

@media (max-width: 480px) {
    /* Hamburger Small Mobile RTL */
    body[dir="rtl"] .hamburger {
        display: flex !important;
        flex: 0 0 auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body[dir="rtl"] .event-nav.prev {
        right: -1rem;
    }

    body[dir="rtl"] .event-nav.next {
        left: -1rem;
    }

    body[dir="rtl"] .slider-nav.prev-slide {
        right: 10px;
    }

    body[dir="rtl"] .slider-nav.next-slide {
        left: 10px;
    }

    /* Hero Slider RTL Mobile */
    body[dir="rtl"] .hero-nav-prev {
        left: auto;
        right: 0.75rem;
    }

    body[dir="rtl"] .hero-nav-next {
        right: auto;
        left: 0.75rem;
    }

    /* Image Hero Section RTL Mobile */
    body[dir="rtl"] .image-hero-content {
        text-align: right;
    }

    /* Video Section RTL Mobile */
    body[dir="rtl"] .video-hero-content {
        text-align: right;
    }

    body[dir="rtl"] #back-to-top {
        left: 1rem;
        bottom: 1rem;
    }

    body[dir="rtl"] .slideshow-nav.prev {
        right: 0.75rem;
        left: auto;
    }

    body[dir="rtl"] .slideshow-nav.next {
        left: 0.75rem;
        right: auto;
    }

    /* Hero Slider RTL Small Mobile */
    body[dir="rtl"] .hero-nav-prev {
        right: 0.5rem;
    }

    body[dir="rtl"] .hero-nav-next {
        left: 0.5rem;
    }

    /* Mobile Menu RTL Small */
    body[dir="rtl"] .nav-menu {
        top: 60px;
        max-height: calc(100vh - 60px);
    }

    body[dir="rtl"] .nav-menu > .nav-item > a {
        padding: 0.875rem 1.25rem;
        font-size: 0.85rem;
    }

    body[dir="rtl"] .theme-toggle-menu,
    body[dir="rtl"] .language-selector-menu {
        padding: 0.875rem 1.25rem;
    }
}

/* Container RTL */
body[dir="rtl"] .container {
    direction: rtl;
}

/* Slideshow Container RTL */
body[dir="rtl"] .slideshow-container {
    direction: rtl;
}

/* Video Container RTL */
body[dir="rtl"] .video-container {
    direction: rtl;
}

/* Posts Main Content RTL */
body[dir="rtl"] .posts-main-content {
    direction: rtl;
}

/* Category List RTL */
body[dir="rtl"] .category-list {
    direction: rtl;
}

/* Text Alignment Overrides for RTL */
body[dir="rtl"] .text-center {
    text-align: center !important;
}

body[dir="rtl"] .text-left {
    text-align: right !important;
}

body[dir="rtl"] .text-right {
    text-align: left !important;
}

/* Ensure all text elements are right-aligned in RTL */
body[dir="rtl"] h1,
body[dir="rtl"] h2,
body[dir="rtl"] h3,
body[dir="rtl"] h4,
body[dir="rtl"] h5,
body[dir="rtl"] h6 {
    text-align: right;
}

body[dir="rtl"] p {
    text-align: right;
}

body[dir="rtl"] .welcome-message {
    text-align: center;
}

/* Event Carousel RTL */
body[dir="rtl"] .event-nav.prev {
    left: auto;
    right: 20px;
}

body[dir="rtl"] .event-nav.next {
    right: auto;
    left: 20px;
}

body[dir="rtl"] .event-carousel-wrapper {
    direction: rtl;
}

body[dir="rtl"] .event-carousel {
    flex-direction: row-reverse;
    direction: ltr; /* Keep internal direction LTR for transform calculations */
}

body[dir="rtl"] .events-header {
    flex-direction: row-reverse;
    text-align: right;
}

body[dir="rtl"] .events-header .eyebrow {
    text-align: right;
}

body[dir="rtl"] .events-header h2 {
    text-align: right;
}

body[dir="rtl"] .events-header p {
    text-align: right;
}

