/*!
 * RTL Language Support Styles for Colorful Blog Theme
 * Provides enhanced RTL support with CSS logical properties
 */

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

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

/* RTL Navigation Overrides */
[dir="rtl"] .main-navigation ul li ul {
  inset-inline-start: auto;
  inset-inline-end: 0;
  text-align: start;
}

[dir="rtl"] .main-navigation ul li ul ul {
  inset-inline-start: auto;
  inset-inline-end: 250px;
}

[dir="rtl"] .main-navigation ul ul ul ul ul {
  inset-inline-start: 250px;
  inset-inline-end: auto;
}

[dir="rtl"] .main-navigation ul ul ul ul ul ul ul {
  inset-inline-start: auto;
  inset-inline-end: 250px;
}

/* RTL Search Box Adjustments */
[dir="rtl"] .search-box form:before {
  inset-inline-start: 20px;
  inset-inline-end: auto;
}

[dir="rtl"] .search-box input.search-submit {
  inset-inline-start: 0;
  inset-inline-end: auto;
}

[dir="rtl"] .header .search-box input.search-field {
  padding-inline-start: 50px;
  padding-inline-end: 0.75rem;
}

/* RTL Content Layout */
[dir="rtl"] .nx-list-item .single-nx-list-item.nx-no-img {
  border-inline-start: none;
  border-inline-end: 5px solid var(--color-primary);
}

[dir="rtl"] .nx-list-item .nx-single-list-details {
  padding-inline-start: 10px;
  padding-inline-end: 25px;
}

/* RTL Block Quotes */
[dir="rtl"] blockquote.wp-block-quote p {
  border-inline-start: none;
  border-inline-end: 5px solid #000;
  padding-inline-start: 0;
  padding-inline-end: 40px;
  margin-inline-start: 0;
  margin-inline-end: -40px;
}

/* RTL Menu Separators */
[dir="rtl"] .main-navigation ul li:after {
  inset-inline-start: 0;
  inset-inline-end: auto;
}

/* RTL Dropdown Arrows */
[dir="rtl"] .main-navigation ul li.menu-item.menu-item-has-children>a:after {
  inset-inline-start: 2px;
  inset-inline-end: auto;
  content: "\f078"; /* Keep same arrow, CSS will handle direction */
}

[dir="rtl"] .main-navigation ul ul li.menu-item.menu-item-has-children>a:after {
  inset-inline-start: 12px;
  inset-inline-end: auto;
}

/* RTL Icon and Button Adjustments */
[dir="rtl"] .grid-item a.grid-item-btn:hover i {
  margin-inline-start: 0;
  margin-inline-end: 10px;
}

[dir="rtl"] .nx-list-item .nx-list-load-more-btn i {
  margin-inline-start: 0;
  margin-inline-end: 5px;
}

[dir="rtl"] .besearch-icon i,
[dir="rtl"] .beshop-top-social i {
  margin-inline-start: 0;
  margin-inline-end: var(--spacing-inline-start);
}

/* RTL Typography */
[dir="rtl"] .newsm-title:after {
  inset-inline-start: auto;
  inset-inline-end: 0;
}

/* RTL Form Elements */
[dir="rtl"] input[type="search"],
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="url"],
[dir="rtl"] input[type="text"],
[dir="rtl"] select {
  text-align: start;
}

/* RTL Widget Areas */
[dir="rtl"] .widget ul li {
  text-align: start;
}

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

/* RTL Pagination */
[dir="rtl"] .navigation.post-navigation .nav-links .nav-next {
  margin-inline-start: 0;
  margin-inline-end: auto;
}

[dir="rtl"] .navigation.post-navigation .nav-links .nav-previous {
  margin-inline-start: auto;
}

/* RTL Comments */
[dir="rtl"] .comments-area .comment-form-comment label {
  text-align: start;
}

/* RTL Mobile Adjustments */
@media (max-width: 768px) {
  [dir="rtl"] .nx-list-item .nx-single-list-details {
    padding-inline-start: 20px;
    padding-inline-end: 20px;
  }
  
  [dir="rtl"] .menubar-content {
    padding-inline: 20px;
  }
  
  [dir="rtl"] .head-logo-sec {
    margin-inline-start: var(--spacing-inline-start);
    margin-inline-end: 0;
  }
}

/* RTL Accessibility Enhancements */
[dir="rtl"] .screen-reader-text {
  text-align: start;
}

[dir="rtl"] :focus {
  outline-offset: 2px;
}

/* RTL Grid and Flexbox Adjustments */
[dir="rtl"] .hm-row {
  justify-content: space-between;
}

[dir="rtl"] .hmr-ss {
  flex-direction: row-reverse;
}

/* RTL Social Links */
[dir="rtl"] .header .social-links a {
  margin-inline-start: 4px;
  margin-inline-end: 0;
}

[dir="rtl"] .hmr-ss2 .social-links {
  margin-inline-start: 0;
  margin-inline-end: var(--spacing-inline-start);
}

/* RTL Category and Tag Styles */
[dir="rtl"] .tag-btns a {
  margin-inline-start: 5px;
  margin-inline-end: 0;
}

[dir="rtl"] a.catname {
  margin-inline-start: 5px;
  margin-inline-end: 0;
}

[dir="rtl"] span.catname {
  margin-inline-start: var(--spacing-inline-start);
  margin-inline-end: 0;
}

/* RTL Entry Meta */
[dir="rtl"] .entry-meta a,
[dir="rtl"] .entry-meta span,
[dir="rtl"] .ghead-meta {
  margin-inline-start: 5px;
  margin-inline-end: 0;
}

[dir="rtl"] footer.entry-footer span {
  margin-inline-start: 10px;
  margin-inline-end: 0;
  padding-inline-start: 10px;
  padding-inline-end: 0;
  border-inline-start: 1px solid #ccc;
  border-inline-end: none;
}

/* RTL Footer */
[dir="rtl"] a#clickTop {
  inset-inline-start: 5px !important;
  inset-inline-end: auto !important;
}

/* RTL Container Queries Support */
@container (max-width: 768px) {
  [dir="rtl"] .nx-list-item .single-nx-list-item {
    flex-direction: column;
  }
  
  [dir="rtl"] .nx-list-item .nx-single-list-img {
    flex: none;
    inline-size: 100%;
  }
}

/* RTL Animation Adjustments */
[dir="rtl"] .grid-item a.grid-item-btn:hover i {
  transform: translateX(10px);
}

[dir="rtl"] .main-navigation ul li:hover ul {
  animation: slideDownRTL 0.5s;
}

@keyframes slideDownRTL {
  from {
    transform: translateY(-10px) translateX(10px);
  }
  to {
    transform: translateY(0) translateX(0);
  }
}

/* RTL High Contrast Mode Support */
@media (prefers-contrast: high) {
  [dir="rtl"] .main-navigation ul li:after {
    opacity: 0.8;
  }
  
  [dir="rtl"] .nx-list-item .single-nx-list-item.nx-no-img {
    border-inline-end-width: 3px;
  }
}

/* RTL Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  [dir="rtl"] .main-navigation ul li:hover ul {
    animation: none;
  }
  
  [dir="rtl"] .grid-item a.grid-item-btn:hover i {
    transform: none;
  }
}