/**
 * RTL (Right-to-Left) CSS Overrides - Arabic Support
 * MILOBRE DE DRAG
 * Applied only when lang=ar is active (html[dir="rtl"])
 */

/* ============================================================
   BASE TYPOGRAPHY & DIRECTION
   ============================================================ */
html[dir="rtl"] body {
    font-family: 'Segoe UI', 'Tahoma', 'Arial', sans-serif;
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6,
html[dir="rtl"] p,
html[dir="rtl"] li,
html[dir="rtl"] a,
html[dir="rtl"] span,
html[dir="rtl"] label {
    direction: rtl;
    text-align: right;
}

/* ============================================================
   HEADER
   ============================================================ */
html[dir="rtl"] .header-top .container {
    flex-direction: row-reverse;
}

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

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

html[dir="rtl"] .lang-switcher {
    margin-left: 0;
    margin-right: 15px;
}

html[dir="rtl"] .header-contact a {
    direction: ltr; /* keep phone/email LTR */
}

/* ============================================================
   NAVIGATION
   ============================================================ */
html[dir="rtl"] .main-nav {
    flex-direction: row-reverse;
}

html[dir="rtl"] .main-nav > li > a {
    flex-direction: row-reverse;
}

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

html[dir="rtl"] .sticky-brand {
    margin-right: 0;
    margin-left: auto;
}

html[dir="rtl"] .mobile-menu-toggle {
    order: -1;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
html[dir="rtl"] .breadcrumb {
    direction: rtl;
}

html[dir="rtl"] .breadcrumb a::after,
html[dir="rtl"] .breadcrumb span::before {
    content: ' /';
    margin: 0 4px;
}

/* ============================================================
   CARDS & GRIDS
   ============================================================ */
html[dir="rtl"] .card-body,
html[dir="rtl"] .dog-content,
html[dir="rtl"] .race-content,
html[dir="rtl"] .news-content,
html[dir="rtl"] .contact-info-card,
html[dir="rtl"] .contact-form-card {
    text-align: right;
}

html[dir="rtl"] .dog-tag {
    left: auto;
    right: 10px;
}

html[dir="rtl"] .dog-available-badge {
    right: auto;
    left: 10px;
}

html[dir="rtl"] .card-badge {
    left: auto;
    right: 10px;
}

/* ============================================================
   FORMS
   ============================================================ */
html[dir="rtl"] .form-control,
html[dir="rtl"] select.form-control,
html[dir="rtl"] textarea.form-control,
html[dir="rtl"] input.form-control {
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] .form-check {
    padding-left: 0;
    padding-right: 1.5rem;
}

html[dir="rtl"] .form-check-input {
    margin-left: 0;
    margin-right: -1.5rem;
}

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

html[dir="rtl"] .input-group-prepend {
    margin-right: 0;
    margin-left: -1px;
}

html[dir="rtl"] .input-group-append {
    margin-left: 0;
    margin-right: -1px;
}

/* ============================================================
   ALERTS & BADGES
   ============================================================ */
html[dir="rtl"] .alert {
    text-align: right;
}

html[dir="rtl"] .alert ul,
html[dir="rtl"] .alert .mb-0 {
    padding-right: 1.5rem;
    padding-left: 0;
}

html[dir="rtl"] .alert .fas,
html[dir="rtl"] .alert .far {
    margin-left: 6px;
    margin-right: 0;
}

html[dir="rtl"] .badge {
    direction: ltr; /* keep numbers LTR */
}

/* ============================================================
   BUTTONS
   ============================================================ */
html[dir="rtl"] .btn .fas,
html[dir="rtl"] .btn .far,
html[dir="rtl"] .btn .fab {
    margin-right: 0;
    margin-left: 6px;
}

html[dir="rtl"] .hero-actions .btn + .btn {
    margin-left: 0;
    margin-right: 10px;
}

html[dir="rtl"] .ml-3 { margin-left: 0 !important; margin-right: 1rem !important; }
html[dir="rtl"] .mr-3 { margin-right: 0 !important; margin-left: 1rem !important; }
html[dir="rtl"] .ml-2 { margin-left: 0 !important; margin-right: 0.5rem !important; }
html[dir="rtl"] .mr-2 { margin-right: 0 !important; margin-left: 0.5rem !important; }

/* ============================================================
   RACE PAGE - alternate layout
   ============================================================ */
html[dir="rtl"] .race-card.reverse {
    flex-direction: row-reverse;
}

html[dir="rtl"] .race-card:not(.reverse) {
    flex-direction: row;
}

/* ============================================================
   PORTEES
   ============================================================ */
html[dir="rtl"] .portee-header {
    flex-direction: row-reverse;
}

html[dir="rtl"] .portee-status {
    margin-left: 0;
    margin-right: auto;
}

/* ============================================================
   TIMELINE (résultats)
   ============================================================ */
html[dir="rtl"] .timeline::after {
    right: 50%;
    left: auto;
    margin-right: -3px;
    margin-left: 0;
}

html[dir="rtl"] .timeline-container.left {
    right: 0;
    left: auto;
}

html[dir="rtl"] .timeline-container.right {
    right: 50%;
    left: auto;
}

html[dir="rtl"] .timeline-container.left::after {
    left: -12.5px;
    right: auto;
}

html[dir="rtl"] .timeline-container.right::after {
    right: -12.5px;
    left: auto;
}

/* ============================================================
   ABOUT / FEATURE BOXES
   ============================================================ */
html[dir="rtl"] .about-features li,
html[dir="rtl"] .about-features {
    list-style: none;
    padding-right: 0;
    text-align: right;
}

html[dir="rtl"] .about-features li .fas {
    margin-right: 0;
    margin-left: 8px;
}

html[dir="rtl"] .feature-box {
    text-align: center; /* keep centered for icon boxes */
}

/* ============================================================
   INFO ITEMS (contact page)
   ============================================================ */
html[dir="rtl"] .info-item {
    flex-direction: row-reverse;
    text-align: right;
}

html[dir="rtl"] .info-item > i {
    margin-right: 0;
    margin-left: 15px;
}

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

html[dir="rtl"] .footer-section ul {
    padding-right: 0;
}

html[dir="rtl"] .footer-section ul li a {
    direction: rtl;
}

html[dir="rtl"] .footer-section p .fas,
html[dir="rtl"] .footer-section p .far {
    margin-right: 0;
    margin-left: 8px;
}

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

html[dir="rtl"] .footer-social {
    direction: ltr; /* keep social icons LTR */
    text-align: right;
}

/* ============================================================
   LIVRE D'OR
   ============================================================ */
html[dir="rtl"] .card-title .float-right {
    float: left !important;
}

/* ============================================================
   TABLE
   ============================================================ */
html[dir="rtl"] .table th,
html[dir="rtl"] .table td {
    text-align: right;
}

/* ============================================================
   NEWS / ACTUALITES
   ============================================================ */
html[dir="rtl"] .news-meta {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

html[dir="rtl"] .news-meta .date .far {
    margin-right: 0;
    margin-left: 4px;
}

/* ============================================================
   PHONE NUMBERS - keep LTR for digits
   ============================================================ */
html[dir="rtl"] a[href^="tel:"],
html[dir="rtl"] a[href^="mailto:"] {
    direction: ltr;
    display: inline-block;
}

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

/* ============================================================
   FILTER FORM
   ============================================================ */
html[dir="rtl"] .filter-form .d-flex {
    flex-direction: row-reverse;
}

/* ============================================================
   HERO SECTION
   ============================================================ */
html[dir="rtl"] .hero-content {
    text-align: center; /* keep hero centered */
}

/* ============================================================
   CHIOT / CHIOT-INFO GRID
   ============================================================ */
html[dir="rtl"] .chiot-info-item {
    flex-direction: row-reverse;
    text-align: right;
}

html[dir="rtl"] .chiot-info-item .c-icon {
    margin-right: 0;
    margin-left: 10px;
}

/* ============================================================
   DOG DETAILS SPANS
   ============================================================ */
html[dir="rtl"] .dog-details span .fas,
html[dir="rtl"] .dog-details span .far {
    margin-right: 0;
    margin-left: 5px;
}

/* ============================================================
   RACE CARD STATS
   ============================================================ */
html[dir="rtl"] .race-stats {
    text-align: right;
}

/* ============================================================
   ABOUT SECTION
   ============================================================ */
html[dir="rtl"] .about-content {
    padding-right: 1rem;
    padding-left: 0;
}

html[dir="rtl"] .about-images .secondary-img {
    left: auto;
    right: 60px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media screen and (max-width: 768px) {
    html[dir="rtl"] .timeline::after {
        right: 31px;
        left: auto;
        margin-right: 0;
    }

    html[dir="rtl"] .timeline-container,
    html[dir="rtl"] .timeline-container.left,
    html[dir="rtl"] .timeline-container.right {
        right: 0;
        left: auto;
        padding-right: 70px;
        padding-left: 25px;
    }

    html[dir="rtl"] .timeline-container.left::after,
    html[dir="rtl"] .timeline-container.right::after {
        right: 18.5px;
        left: auto;
    }

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