/**
 * Premier Building Communities
 * RTL (Right-to-Left) Stylesheet for Arabic
 */

/* ============================================
   Base RTL Adjustments
   ============================================ */
html[dir="rtl"] {
    direction: rtl;
}

html[dir="rtl"] body {
    font-family: 'Cairo', 'Tajawal', var(--font-body);
    text-align: right;
}

/* ============================================
   Typography
   ============================================ */
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6 {
    font-family: 'Cairo', 'Tajawal', var(--font-heading);
}

/* ============================================
   Navigation
   ============================================ */
html[dir="rtl"] .nav-menu {
    flex-direction: row !important;  /* Force reverse order for nav links in RTL */
}

html[dir="rtl"] .nav-menu li {
    display: flex;  /* Ensure list items flex properly */
}

html[dir="rtl"] .nav-link {
    text-align: right;
}

/* Mobile Menu RTL */
html[dir="rtl"] .mobile-nav {
    flex-direction: column-reverse !important;  /* Reverse mobile menu order in RTL */
}

html[dir="rtl"] .mobile-nav li {
    text-align: right;
}
html[dir="rtl"] .header-actions {
    flex-direction: row-reverse;  /* Reverse action order in RTL */
}

html[dir="rtl"] .nav-link::after {
    left: auto;
    right: 0;
}

/* ============================================
   Buttons
   ============================================ */
html[dir="rtl"] .btn {
    flex-direction: row-reverse;
}

html[dir="rtl"] .btn svg {
    transform: scaleX(-1);
}

/* ============================================
   Hero Section
   ============================================ */
html[dir="rtl"] .hero-content,
html[dir="rtl"] .page-hero-content {
    text-align: center;
}

/* ============================================
   Features / Cards
   ============================================ */
html[dir="rtl"] .feature-card,
html[dir="rtl"] .value-card,
html[dir="rtl"] .vm-card {
    text-align: center;
}

/* ============================================
   Project Cards
   ============================================ */
html[dir="rtl"] .project-badge {
    left: auto;
    right: 20px;
}

html[dir="rtl"] .project-location {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

html[dir="rtl"] .project-link {
    flex-direction: row-reverse;
}

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

/* ============================================
   About Page - Timeline
   ============================================ */
html[dir="rtl"] .timeline::before {
    left: auto;
    right: 50%;
    transform: translateX(50%);
}

html[dir="rtl"] .timeline-item:nth-child(odd) {
    left: auto;
    right: 0;
    text-align: left;
    padding-left: 50px;
    /* padding-right: 0; */
}

html[dir="rtl"] .timeline-item:nth-child(even) {
    left: auto;
    right: 50%;
    text-align: right;
    padding-left: 0;
    padding-right: 50px;
}

html[dir="rtl"] .timeline-item:nth-child(odd) .timeline-dot {
    right: auto;
    left: -10px;
}

html[dir="rtl"] .timeline-item:nth-child(even) .timeline-dot {
    left: auto;
    right: -10px;
}

@media (max-width: 992px) {
    html[dir="rtl"] .timeline::before {
        left: auto;
        right: 20px;
    }

    html[dir="rtl"] .timeline-item {
        right: 0 !important;
        padding-left: 0;
        padding-right: 60px;
        text-align: right !important;
    }

    html[dir="rtl"] .timeline-dot {
        left: auto !important;
        right: 10px !important;
    }
}

/* ============================================
   About Page - Intro
   ============================================ */
html[dir="rtl"] .about-intro {
    direction: rtl;
}

html[dir="rtl"] .about-intro-content {
    text-align: right;
}

/* ============================================
   Project Single Page
   ============================================ */
html[dir="rtl"] .project-hero-location {
    flex-direction: row-reverse;
}

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

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

html[dir="rtl"] .feature-item span {
    text-align: right;
}

/* ============================================
   Contact Page
   ============================================ */
html[dir="rtl"] .contact-info-item {
    flex-direction: row-reverse;
    text-align: right;
}

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

html[dir="rtl"] .form-control {
    text-align: right;
}

html[dir="rtl"] select.form-control {
    background-position: left 18px center;
    padding-left: 40px;
    padding-right: 18px;
}

/* ============================================
   Footer
   ============================================ */
html[dir="rtl"] .footer {
    text-align: right;
}

html[dir="rtl"] .footer-contact p {
    flex-direction: row-reverse;
}

html[dir="rtl"] .footer-social {
    justify-content: flex-start;
}

html[dir="rtl"] .footer-bottom {
    flex-direction: row-reverse;
}

html[dir="rtl"] .footer-bottom-links {
    flex-direction: row-reverse;
}

@media (max-width: 768px) {
    html[dir="rtl"] .footer-bottom {
        flex-direction: column;
    }
}

/* ============================================
   WhatsApp Float
   ============================================ */
html[dir="rtl"] .whatsapp-float {
    right: auto;
    left: 30px;
}

@media (max-width: 480px) {
    html[dir="rtl"] .whatsapp-float {
        left: 20px;
    }
}

/* ============================================
   Lists
   ============================================ */
html[dir="rtl"] ul,
html[dir="rtl"] ol {
    padding-right: 0;
}

/* ============================================
   Icons with Text
   ============================================ */
html[dir="rtl"] .social-links {
    justify-content: flex-start;
}

/* ============================================
   Margins & Paddings Adjustments
   ============================================ */
html[dir="rtl"] .me-2 { margin-right: 0; margin-left: 0.5rem; }
html[dir="rtl"] .me-3 { margin-right: 0; margin-left: 1rem; }
html[dir="rtl"] .ms-2 { margin-left: 0; margin-right: 0.5rem; }
html[dir="rtl"] .ms-3 { margin-left: 0; margin-right: 1rem; }

html[dir="rtl"] .pe-2 { padding-right: 0; padding-left: 0.5rem; }
html[dir="rtl"] .pe-3 { padding-right: 0; padding-left: 1rem; }
html[dir="rtl"] .ps-2 { padding-left: 0; padding-right: 0.5rem; }
html[dir="rtl"] .ps-3 { padding-left: 0; padding-right: 1rem; }


/* ============================================
   Mobile Menu RTL
   ============================================ */
html[dir="rtl"] .mobile-menu {
    left: auto;
    right: 0;
    transform: none;
    transition: none;
}

html[dir="rtl"] .mobile-menu.active {
    transition: transform 0.3s ease;
    transform: translateX(0);
}

/* Reset to LTR-style transform for RTL */
html[dir="rtl"] .mobile-menu:not(.active) {
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

/* ============================================
   Back Button
   ============================================ */
html[dir="rtl"] .back-link svg {
    transform: scaleX(-1);
}

/* ============================================
   Gallery Grid
   ============================================ */
html[dir="rtl"] .gallery-grid {
    direction: rtl;
}

/* ============================================
   Stats
   ============================================ */
html[dir="rtl"] .stat-item {
    text-align: center;
}

/* ============================================
   Section Header
   ============================================ */
html[dir="rtl"] .section-header {
    text-align: center;
}

/* ============================================
   Letter Spacing Reduction for Arabic
   ============================================ */
html[dir="rtl"] .section-subtitle,
html[dir="rtl"] .btn,
html[dir="rtl"] .nav-link,
html[dir="rtl"] .filter-btn,
html[dir="rtl"] .stat-item p,
html[dir="rtl"] .footer h4 {
    letter-spacing: 0;
}

/* ============================================
   Enhanced About Page - New Sections RTL
   ============================================ */

/* Container and Base RTL Adjustments */
html[dir="rtl"] .container {
    padding-left: 20px;
    padding-right: 20px;
}

html[dir="rtl"] .section {
    overflow: visible;
    overflow-x: hidden;
}

html[dir="rtl"] p {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Feature Cards RTL */
html[dir="rtl"] .feature-card {
    text-align: center;
    direction: rtl;
    overflow: hidden;
    padding: 30px 20px;
}

html[dir="rtl"] .feature-icon {
    display: flex;
    justify-content: center;
    margin: 0 auto 20px;
    flex-shrink: 0;
}

html[dir="rtl"] .feature-card h4,
html[dir="rtl"] .feature-card p {
    text-align: center;
    padding: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Value Cards RTL */
html[dir="rtl"] .value-card {
    text-align: center;
    direction: rtl;
    overflow: hidden;
    padding: 30px 20px;
}

html[dir="rtl"] .value-number {
    margin: 0 auto 20px;
    display: block;
    flex-shrink: 0;
}

html[dir="rtl"] .value-card h4,
html[dir="rtl"] .value-card p {
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* VM (Vision/Mission) Cards RTL */
html[dir="rtl"] .vm-card {
    text-align: center;
    direction: rtl;
    overflow: hidden;
    padding: 30px 20px;
}

html[dir="rtl"] .vm-icon {
    display: flex;
    justify-content: center;
    margin: 0 auto 20px;
    flex-shrink: 0;
}

html[dir="rtl"] .vm-card h3,
html[dir="rtl"] .vm-card p {
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* About Intro RTL - Enhanced */
html[dir="rtl"] .about-intro {
    direction: rtl;
    text-align: right;
    /* overflow: hidden; */
}

html[dir="rtl"] .about-intro-content {
    text-align: right;
    padding-right: 20px;
    padding-left: 20px;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

html[dir="rtl"] .about-intro-content h2,
html[dir="rtl"] .about-intro-content p,
html[dir="rtl"] .about-intro-content .section-subtitle {
    text-align: right;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

html[dir="rtl"] .about-intro-image {
    margin-right: 0;
    margin-left: 0;
    overflow: hidden;
}

/* Section Header RTL */
html[dir="rtl"] .section-header {
    text-align: center;
}

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

html[dir="rtl"] .section-header p {
    text-align: center;
}

html[dir="rtl"] .section-subtitle {
    display: block;
    text-align: center;
    margin-bottom: 15px;
}

/* CTA Premium RTL */
html[dir="rtl"] .cta-premium .cta-content {
    text-align: center;
}

html[dir="rtl"] .cta-premium h2,
html[dir="rtl"] .cta-premium p {
    text-align: center;
}

html[dir="rtl"] .cta-premium .btn {
    flex-direction: row-reverse;
}

/* Timeline RTL - Already handled above, but reinforcing */
html[dir="rtl"] .timeline-item h4,
html[dir="rtl"] .timeline-item p {
    direction: rtl;
    text-align: right;
}

/* Page Hero RTL */
html[dir="rtl"] .page-hero-content {
    text-align: center;
    direction: rtl;
}

html[dir="rtl"] .page-hero-content h1 {
    text-align: center;
}

html[dir="rtl"] .page-hero-content p {
    text-align: center;
}

/* Grid Container RTL */
html[dir="rtl"] .features-grid,
html[dir="rtl"] .values-grid,
html[dir="rtl"] .projects-grid {
    direction: rtl;
    overflow: visible;
}

/* General RTL Text Overflow Prevention */
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6 {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

html[dir="rtl"] .section-header {
    overflow: visible;
    padding: 0 20px;
}

html[dir="rtl"] .section-header h2,
html[dir="rtl"] .section-header p {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Responsive About Intro - RTL */
@media (max-width: 992px) {
    html[dir="rtl"] .about-intro {
        grid-template-columns: 1fr;
    }

    html[dir="rtl"] .about-intro-image {
        order: -1;
        margin-right: 0;
        margin-left: 0;
    }

    html[dir="rtl"] .about-intro-content {
        text-align: right;
    }
}

/* Mobile - Feature Cards RTL */
@media (max-width: 768px) {
    html[dir="rtl"] .feature-card,
    html[dir="rtl"] .value-card {
        padding: 30px 20px;
        text-align: center;
        overflow: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    html[dir="rtl"] .feature-icon,
    html[dir="rtl"] .vm-icon {
        margin: 0 auto 20px;
        flex-shrink: 0;
    }

    html[dir="rtl"] .feature-card h4,
    html[dir="rtl"] .feature-card p,
    html[dir="rtl"] .value-card h4,
    html[dir="rtl"] .value-card p {
        text-align: center;
        padding: 0;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        max-width: 100%;
    }

    html[dir="rtl"] .about-intro-content {
        padding: 20px 15px;
    }

    html[dir="rtl"] .about-intro-content h2,
    html[dir="rtl"] .about-intro-content p {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Mobile - Section Padding RTL */
@media (max-width: 768px) {
    html[dir="rtl"] .section {
        padding: 60px 20px;
    }

    html[dir="rtl"] .container {
        padding: 0 20px;
    }
}

/* ============================================
   Filter Bar RTL
   ============================================ */
html[dir="rtl"] .filter-bar {
    direction: rtl;
}

html[dir="rtl"] .filter-group label,
html[dir="rtl"] .filter-search-group label {
    text-align: right;
}

html[dir="rtl"] .filter-select,
html[dir="rtl"] .filter-search {
    direction: rtl;
    text-align: right;
    padding-left: 36px;
    padding-right: 14px;
    background-position: left 12px center;
}

html[dir="rtl"] .filter-search-wrapper {
    direction: rtl;
}

html[dir="rtl"] .filter-search-group svg {
    right: auto;
    left: 12px;
}

@media (max-width: 768px) {
    html[dir="rtl"] .filter-select,
    html[dir="rtl"] .filter-search {
        padding-left: 32px;
        padding-right: 12px;
        background-position: left 10px center;
    }

    html[dir="rtl"] .filter-search-group svg {
        left: 10px;
    }
}

/* Small Mobile - Additional Adjustments */
@media (max-width: 480px) {
    html[dir="rtl"] .feature-card,
    html[dir="rtl"] .value-card,
    html[dir="rtl"] .vm-card {
        padding: 20px 15px;
        text-align: center;
    }

    html[dir="rtl"] .feature-icon,
    html[dir="rtl"] .vm-icon,
    html[dir="rtl"] .value-number {
        margin: 0 auto 15px;
    }

    html[dir="rtl"] .cta-premium .cta-content {
        padding: 40px 20px;
        text-align: center;
    }

    html[dir="rtl"] .cta-premium .btn {
        width: 100%;
    }
}

/* ============================================
   La Vista Style Contact Page RTL
   Premium Right-to-Left Layout for Arabic
   ============================================ */

/* Contact Section RTL - Professional Mirrored Layout */
html[dir="rtl"] .contact-section {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .contact-container {
    grid-template-columns: 1.2fr 1fr;  /* Reversed: map on left, content on right */
}

html[dir="rtl"] .contact-left {
    order: 2;  /* Push to right in RTL */
}

html[dir="rtl"] .contact-right {
    order: 1;  /* Pull to left in RTL */
}

html[dir="rtl"] .contact-label {
    text-align: right;
    margin-bottom: 16px;
}

html[dir="rtl"] .contact-title {
    text-align: right;
    margin-bottom: 60px;
    font-family: 'Cairo', 'Tajawal', 'Playfair Display', serif;
    letter-spacing: -0.02em;  /* Tighter for Arabic */
}

html[dir="rtl"] .contact-details-block {
    text-align: right;
}

html[dir="rtl"] .contact-section-title {
    text-align: right;
    margin-bottom: 36px;
}

html[dir="rtl"] .contact-detail-item {
    /* DO NOT use row-reverse in RTL - natural RTL flow positions icon on right */
    flex-direction: row;  /* Natural RTL will reverse this automatically */
    align-items: flex-start;
    text-align: right;
    margin-bottom: 32px;
    gap: 20px;
}

html[dir="rtl"] .contact-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    flex-shrink: 0;
    color: #4A5568;
    stroke: currentColor;
    margin-top: 1px;
    /* DO NOT mirror - icons must maintain natural appearance */
    transform: none !important;
    /* Natural RTL flow positions icon correctly - no order needed */
}

html[dir="rtl"] .contact-detail-text {
    text-align: right;  /* Arabic text flows right-to-left */
    unicode-bidi: plaintext;  /* Preserve natural directionality of mixed content */
    flex: 1;
}

/* ============================================
   Phone Numbers & Email Handling in RTL
   Critical: Must remain readable, not reversed
   ============================================ */

/* All links (phone & email) in contact details */
html[dir="rtl"] .contact-detail-text a {
    color: var(--dark);
    text-decoration: none;
    display: inline-block;
}

/* Phone numbers - Force LTR to preserve readability */
html[dir="rtl"] .contact-detail-text a[href^="tel:"] {
    direction: ltr;  /* Phone numbers MUST be left-to-right */
    unicode-bidi: isolate;  /* Isolate from parent RTL context */
    text-align: left;  /* + sign appears at beginning */
}

/* Email addresses - Preserve LTR for alphanumeric */
html[dir="rtl"] .contact-detail-text a[href^="mailto:"] {
    direction: ltr;  /* Email addresses remain LTR */
    unicode-bidi: plaintext;  /* Natural directionality */
}

html[dir="rtl"] .contact-detail-text a:hover {
    color: #00A699;
}

/* Contact Form Section RTL - Professional Layout */
html[dir="rtl"] .contact-form-section {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .contact-form-horizontal {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .form-row-horizontal {
    direction: rtl;
    text-align: right;
}

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

html[dir="rtl"] .form-group-horizontal label {
    text-align: right;
    margin-bottom: 10px;
}

html[dir="rtl"] .form-group-horizontal .form-control {
    text-align: right;
    direction: rtl;
    padding: 14px 18px;
    text-align: right;
}

html[dir="rtl"] .form-group-horizontal textarea.form-control {
    text-align: right;
    direction: rtl;
    padding: 14px 18px;
}

html[dir="rtl"] .form-message {
    text-align: right;
    direction: rtl;
}

/* Responsive RTL - Tablet */
@media (max-width: 1200px) {
    html[dir="rtl"] .contact-container {
        grid-template-columns: 1fr;
    }

    html[dir="rtl"] .contact-left {
        order: 1;
    }

    html[dir="rtl"] .contact-right {
        order: 2;
    }

    html[dir="rtl"] .contact-detail-item {
        flex-direction: row;  /* Natural RTL positions icon on right */
        gap: 20px;
    }
}

/* Responsive RTL - Mobile */
@media (max-width: 768px) {
    html[dir="rtl"] .contact-detail-item {
        flex-direction: row;  /* Natural RTL positions icon on right */
        gap: 16px;
        margin-bottom: 28px;
    }

    html[dir="rtl"] .contact-section-title {
        text-align: right;
        margin-bottom: 28px;
    }
}

/* Responsive RTL - Small Mobile */
@media (max-width: 480px) {
    html[dir="rtl"] .contact-detail-item {
        flex-direction: row;  /* Natural RTL positions icon on right */
        gap: 14px;
        margin-bottom: 24px;
    }

    html[dir="rtl"] .contact-detail-text {
        text-align: right;
    }
}

/* ============================================
   Footer RTL Support
   ============================================ */

html[dir="rtl"] .footer-main {
    flex-direction: row-reverse;  /* Logo on right, language on left in RTL */
}

html[dir="rtl"] .footer-lang-section {
    text-align: left;  /* Language toggle on left side in RTL */
}

html[dir="rtl"] .footer-lang-toggle {
    direction: rtl;
    text-align: left;
}

html[dir="rtl"] .lang-switch {
    direction: ltr;  /* Keep language names LTR (English) */
    unicode-bidi: plaintext;
}

/* Footer bottom RTL */
html[dir="rtl"] .footer-copyright {
    text-align: center;
    direction: rtl;
    unicode-bidi: plaintext;
}

/* Responsive Footer RTL - Mobile */
@media (max-width: 768px) {
    html[dir="rtl"] .footer-main {
        flex-direction: column;
        text-align: center;
    }

    html[dir="rtl"] .footer-lang-section {
        text-align: center;
    }

    html[dir="rtl"] .footer-lang-toggle {
        text-align: center;
    }
}

/* ============================================
   Partners Slider RTL Support
   ============================================ */
html[dir="rtl"] .partners-slider-section {
    direction: rtl;
}

html[dir="rtl"] .partners-slider-section h2 {
    text-align: center;
    direction: rtl;
}

html[dir="rtl"] .slider {
    direction: ltr;  /* Keep slider LTR for animation */
}

html[dir="rtl"] .slider-items {
    direction: ltr;  /* Keep items LTR for smooth animation */
}

html[dir="rtl"] .slider-items img {
    direction: ltr;
}

