/*
Theme Name: Music Artist Pro RTL Support
Description: RTL (Right-to-Left) stylesheet for Hebrew language support
Version: 1.0
Text Domain: music-artist
*/

/*--------------------------------------------------------------
# RTL Support for Hebrew Language
--------------------------------------------------------------*/

/* Global RTL Styles */
[dir="rtl"] body {
    direction: rtl;
    text-align: right;
}

/* Typography RTL */
[dir="rtl"] h1, 
[dir="rtl"] h2, 
[dir="rtl"] h3, 
[dir="rtl"] h4, 
[dir="rtl"] h5, 
[dir="rtl"] h6 {
    text-align: right;
}

[dir="rtl"] p,
[dir="rtl"] div,
[dir="rtl"] span {
    text-align: right;
}

/* Header RTL - Keep header layout EXACTLY like English */
[dir="rtl"] header#masthead {
    direction: ltr !important; /* Force header to stay LTR layout */
}

/* Keep logo on the left side - EXACTLY like English */
[dir="rtl"] .site-branding {
    float: left !important;
    padding-left: 0;
    padding-right: 0;
    margin-left: 15px;
    margin-right: 0;
    direction: ltr !important;
}

/* Header layout fix for RTL - Keep everything LTR in header */
[dir="rtl"] .header-top .container,
[dir="rtl"] header#masthead .container {
    direction: ltr !important; /* Keep container LTR to maintain logo-left, menu-right layout */
}

[dir="rtl"] .header-top .row,
[dir="rtl"] header#masthead .row {
    direction: ltr !important; /* Keep row LTR */
}

[dir="rtl"] .header-top,
[dir="rtl"] .header-top * {
    direction: ltr !important; /* Force entire header-top to be LTR */
}

/* Search form should be RTL only for text input */
[dir="rtl"] .header-search-form {
    direction: ltr !important; /* Keep form layout LTR */
    float: right;
}

[dir="rtl"] .header-search-form input {
    direction: rtl; /* Only input text should be RTL */
    text-align: right;
}

/* Navigation RTL - Keep layout like English, only text RTL */
[dir="rtl"] nav#site-navigation {
    float: right;
    direction: ltr !important; /* Keep navigation layout LTR */
}

[dir="rtl"] nav#site-navigation ul {
    direction: ltr !important; /* Keep menu structure LTR */
    text-align: right;
}

[dir="rtl"] nav#site-navigation ul li {
    float: left; /* Keep like English - items float left */
    direction: ltr;
}

[dir="rtl"] ul#menu-main {
    float: right;
    direction: ltr !important; /* Keep menu layout LTR */
    margin-right: 20px !important; /* Move closer to search-wrap area */
    margin-left: 0 !important; /* Remove auto margin that centers menu */
    justify-content: flex-end !important;
}

[dir="rtl"] ul#menu-main li {
    float: left; /* Keep like English */
    direction: ltr;
}

[dir="rtl"] .navbar-nav {
    float: right;
    direction: ltr !important; /* Keep navbar layout LTR */
    margin-right: 20px !important; /* Move closer to search-wrap area */
    margin-left: 0 !important; /* Remove auto margin that centers menu */
}

[dir="rtl"] .navbar-nav > li {
    float: left; /* Keep like English */
    direction: ltr;
}

/* Override flexbox positioning that keeps menu centered */
[dir="rtl"] div#navbar-collapse {
    justify-content: flex-end !important;
    margin-right: 20px !important; /* Move closer to search-wrap */
    margin-left: 0 !important;
}

[dir="rtl"] ul.nav.navbar-nav.navbar-center {
    justify-content: flex-end !important;
    margin-left: 0 !important; /* Remove auto margin that centers menu */
    margin-right: 20px !important; /* Move closer to search-wrap area */
    float: right !important;
}

/* Override the custom-overlay.css that forces centering */
[dir="rtl"] .navbar-center {
    justify-content: flex-end !important; /* Override center alignment */
    margin-left: 0 !important; /* Remove auto centering */
    text-align: right !important;
    margin-right: 20px !important; /* Move menu-main closer to search-wrap */
}

/* Only the menu text/content should be RTL when Hebrew */
[dir="rtl"] .navbar-nav > li > a {
    direction: rtl; /* Only text direction RTL */
    text-align: center;
}

/* Dropdown Menus RTL */
[dir="rtl"] .navbar-nav > li > .dropdown-menu {
    left: auto;
    right: 0;
}

[dir="rtl"] ul.dropdown-menu.dropdown-sub {
    left: auto;
    right: 100%;
    margin-right: 0px;
    margin-left: 0;
}

[dir="rtl"] ul#menu-main li.menu-item-has-children .dropdown-menu li.menu-item-has-children > .dropdown-sub {
    left: auto;
    right: 230px;
}

/* Language Switcher RTL */
[dir="rtl"] .lang-item {
    float: right;
    margin-left: 10px;
    margin-right: 0;
}

[dir="rtl"] .lang-item img {
    margin-left: 5px;
    margin-right: 0;
}

/* Content Areas RTL */
[dir="rtl"] .section-title {
    text-align: right;
}

[dir="rtl"] .section-title h2 {
    text-align: right;
}

[dir="rtl"] .about-second-wrap {
    padding-left: 65px;
    padding-right: 35px;
}

[dir="rtl"] section#primary.about-sec .col-md-7 {
    padding-left: 70px;
    padding-right: 15px;
}

/* Hero Section RTL */
[dir="rtl"] .hero-section .stuff {
    text-align: right;
}

[dir="rtl"] .hero-section h1 {
    text-align: right;
}

[dir="rtl"] .intro {
    margin-left: -30px;
    margin-right: 0;
}

[dir="rtl"] .intro .title {
    text-align: left;
}

/* Blog RTL */
[dir="rtl"] .blog-wrap .date {
    left: 15px;
    right: auto;
}

[dir="rtl"] .blog-wrap figcaption h3 {
    text-align: right;
}

/* Album Section RTL */
[dir="rtl"] .album-footer {
    text-align: right;
}

[dir="rtl"] .album-footer .title {
    text-align: right;
}

/* Tours RTL */
[dir="rtl"] .tours-wrap .tour-date,
[dir="rtl"] .tours-wrap .tour-name,
[dir="rtl"] .tours-wrap .tour-address,
[dir="rtl"] .tours-wrap .tour-actions {
    text-align: right;
}

[dir="rtl"] .tour-name h3 a {
    text-align: right;
}

/* Forms RTL */
[dir="rtl"] .search-form {
    direction: rtl;
}

[dir="rtl"] .search-form .search-field {
    text-align: right;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

[dir="rtl"] .search-form .search-submit {
    left: 1px;
    right: auto;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

[dir="rtl"] .header-search-form form.search-form:before {
    left: 30px;
    right: auto;
}

/* Comments RTL */
[dir="rtl"] .comments-area {
    direction: rtl;
}

[dir="rtl"] .comments-area ol.comment-list .comment-metadata {
    margin-right: 52px;
    margin-left: 0;
}

[dir="rtl"] .comments-area ol.comment-list ol.children {
    margin-right: 56px;
    margin-left: 0;
}

[dir="rtl"] .comments-area ol.comment-list .reply {
    text-align: left;
}

/* Footer RTL */
[dir="rtl"] footer#colophon {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .site-info {
    text-align: right;
}

/* Social Icons RTL - Keep EXACTLY like English */
[dir="rtl"] .header-social {
    float: right;
    direction: ltr !important; /* Keep social layout exactly like English */
    text-align: right;
}

[dir="rtl"] .header-social .social-icon {
    margin-left: 0;
    margin-right: 10px; /* Keep original English spacing - wider */
    direction: ltr;
}

[dir="rtl"] .header-social .social-icon:last-child {
    margin-right: 0;
}

[dir="rtl"] .header-social .social-icon:first-child {
    margin-right: 10px; /* Keep original English spacing */
}

[dir="rtl"] .header-social ul a {
    margin-left: 0;
    margin-right: 10px; /* Keep original English spacing - wider */
    direction: ltr; /* Keep social links LTR */
}

[dir="rtl"] .header-social ul {
    direction: ltr !important; /* Keep social list layout LTR */
}

[dir="rtl"] .header-social li {
    direction: ltr !important; /* Keep social items LTR */
    margin-left: 0;
    margin-right: 10px; /* Keep original English spacing */
}

/* Music Player RTL */
[dir="rtl"] #music_player {
    direction: rtl;
}

[dir="rtl"] #music_player .ms-table .ms-nowplaying .np-meta {
    left: auto;
    right: 80px;
}

[dir="rtl"] #music_player .ms-table .ms-nowplaying .ms-add-fav {
    left: 0;
    right: auto;
}

/* Slick Slider RTL Support (Enhanced) */
[dir="rtl"] .slick-slide {
    direction: rtl;
}

[dir="rtl"] .slick-list {
    direction: rtl;
}

[dir="rtl"] .slick-track {
    direction: rtl;
}

/* Video Section RTL */
[dir="rtl"] .video-content {
    text-align: right;
}

[dir="rtl"] .video-content h2 {
    text-align: right;
}

/* Newsletter RTL */
[dir="rtl"] .newsletter-content {
    text-align: right;
}

[dir="rtl"] .newsletter-content h2.newsletter-title {
    text-align: right;
}

/* Mobile RTL */
@media (max-width: 991px) {
    /* Keep logo on left even in mobile - EXACTLY like English */
    [dir="rtl"] .site-branding {
        float: left !important;
        margin-left: 15px;
        margin-right: 0;
        direction: ltr !important;
    }
    
    /* Keep header layout LTR in mobile too */
    [dir="rtl"] header#masthead,
    [dir="rtl"] .header-top {
        direction: ltr !important;
    }
    
    [dir="rtl"] .navbar-nav > li {
        float: none;
        text-align: right;
        direction: ltr; /* Keep item layout LTR */
    }
    
    [dir="rtl"] ul#menu-main li a {
        text-align: right;
        direction: rtl; /* Only text content RTL */
    }
    
    /* Social menu stays exactly like English in mobile too */
    [dir="rtl"] .header-social {
        float: right;
        text-align: right;
        direction: ltr !important;
    }
}

/* Widgets RTL */
[dir="rtl"] #secondary .widget {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] #secondary .widget .widget-title {
    text-align: right;
}

[dir="rtl"] #secondary .widget ul li {
    text-align: right;
}

/* WooCommerce RTL Support */
[dir="rtl"] .woocommerce ul.products {
    direction: rtl;
}

[dir="rtl"] .woocommerce ul.products li.product {
    text-align: right;
}

[dir="rtl"] .woocommerce .woocommerce-ordering {
    float: left;
}

[dir="rtl"] .woocommerce .woocommerce-result-count {
    float: right;
}

/* Instagram Section RTL */
[dir="rtl"] .instagram-section {
    direction: rtl;
}

/* CTA Section RTL */
[dir="rtl"] .cta-sec .cta-content {
    text-align: right;
}

[dir="rtl"] .cta-sec .cta-title {
    text-align: right;
}

/* Album Lists RTL */
[dir="rtl"] .album-lists-wrap {
    direction: rtl;
}

[dir="rtl"] .album-lists-wrap .wrap-image h2 {
    text-align: right;
}

/* Pagination RTL */
[dir="rtl"] .nav-links .nav-previous {
    float: right;
    text-align: left;
}

[dir="rtl"] .nav-links .nav-next {
    float: left;
    text-align: right;
}

/* Specific Hebrew Font Support */
[dir="rtl"] body,
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6,
[dir="rtl"] p, [dir="rtl"] div, [dir="rtl"] span, [dir="rtl"] a {
    font-family: 'Heebo', 'Rubik', 'Assistant', 'Open Sans', Arial, sans-serif;
}

/* Hebrew text alignment */
[dir="rtl"] .hebrew-text,
[lang="he"] {
    direction: rtl;
    text-align: right;
    font-family: 'Heebo', 'Rubik', 'Assistant', 'Open Sans', Arial, sans-serif;
}

/* Fix for mixed content (Hebrew + English) */
[dir="rtl"] .mixed-content {
    direction: rtl;
    text-align: right;
    unicode-bidi: bidi-override;
}

/* Ensure buttons maintain proper styling in RTL */
[dir="rtl"] .btn,
[dir="rtl"] .button,
[dir="rtl"] .btn-default {
    direction: ltr;
    text-align: center;
}

/* Fix specific elements that should remain LTR */
[dir="rtl"] .email,
[dir="rtl"] .url,
[dir="rtl"] .phone,
[dir="rtl"] .number {
    direction: ltr;
    text-align: left;
    display: inline-block;
}

/*--------------------------------------------------------------
# Mobile RTL Specific Styles
--------------------------------------------------------------*/
@media (max-width: 768px) {
    [dir="rtl"] .hero-section .stuff {
        text-align: center;
    }
    
    [dir="rtl"] .intro {
        margin: 0;
        min-width: auto;
    }
    
    [dir="rtl"] .section-title {
        text-align: center;
    }
}

/*--------------------------------------------------------------
# Print RTL Styles
--------------------------------------------------------------*/
@media print {
    [dir="rtl"] * {
        direction: rtl !important;
        text-align: right !important;
    }
}

/*--------------------------------------------------------------
# Polylang Language Switcher RTL
--------------------------------------------------------------*/
[dir="rtl"] .custom-language-switcher {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .custom-language-switcher li {
    float: right;
    margin-left: 10px;
    margin-right: 0;
}

[dir="rtl"] .custom-language-switcher li:first-child {
    margin-left: 0;
}

[dir="rtl"] .custom-language-switcher a {
    direction: ltr; /* Keep flag and country code LTR */
    text-align: center;
}

/* General language switcher styles */
.custom-language-switcher {
    list-style: none;
    margin: 0;
    padding: 0;
    display: inline-block;
}

.custom-language-switcher li {
    display: inline-block;
    margin-right: 10px;
}

.custom-language-switcher li:last-child {
    margin-right: 0;
}

.custom-language-switcher a {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    text-decoration: none;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

.custom-language-switcher a:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.custom-language-switcher img {
    margin-right: 5px;
    width: 16px;
    height: auto;
}

[dir="rtl"] .custom-language-switcher img {
    margin-right: 0;
    margin-left: 5px;
}

/* Hebrew content auto-detection */
.hebrew-content {
    direction: rtl;
    text-align: right;
    font-family: 'Heebo', 'Rubik', 'Assistant', 'Open Sans', Arial, sans-serif;
}

/* Mixed content handling */
.mixed-content-rtl {
    direction: rtl;
    text-align: right;
}

.mixed-content-rtl .english {
    direction: ltr;
    display: inline-block;
    text-align: left;
}

/* Ensure numbers and English text in RTL context display correctly */
[dir="rtl"] .number,
[dir="rtl"] .price,
[dir="rtl"] .date-display,
[dir="rtl"] .time-display {
    direction: ltr;
    unicode-bidi: embed;
}

/* WordPress admin bar RTL support */
[dir="rtl"] #wpadminbar {
    direction: rtl;
}

[dir="rtl"] #wpadminbar .ab-top-menu > li {
    float: right;
}

/*--------------------------------------------------------------
# Hebrew Typography Improvements
--------------------------------------------------------------*/
[dir="rtl"] body,
[dir="rtl"] .hebrew-text {
    font-family: 'Heebo', 'Rubik', 'Assistant', system-ui, -apple-system, sans-serif;
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
}

[dir="rtl"] h1.entry-title,
[dir="rtl"] h2.entry-title,
[dir="rtl"] .section-title h2 {
    font-family: 'Heebo', 'Rubik', 'Assistant', serif;
    font-weight: 700;
}

/* Improve Hebrew text spacing */
[dir="rtl"] p,
[dir="rtl"] div,
[dir="rtl"] span {
    line-height: 1.6;
    word-spacing: 0.05em;
}

/*--------------------------------------------------------------
# Debug Mode - Remove after testing
--------------------------------------------------------------*/
.debug-rtl {
    border: 2px solid red !important;
    background: rgba(255,0,0,0.1) !important;
}

.debug-hebrew {
    border: 2px solid blue !important;
    background: rgba(0,0,255,0.1) !important;
}
