/**
 * YasTV RTL CSS - Right-to-Left Language Support
 * Persian/Farsi language layout overrides
 */

/* RTL Base Overrides */
body.rtl {
  direction: rtl;
  text-align: right;
}

/* Typography RTL */
body.rtl h1,
body.rtl h2,
body.rtl h3,
body.rtl h4,
body.rtl h5,
body.rtl h6 {
  text-align: right;
}

body.rtl p {
  text-align: right;
}

/* List RTL */
body.rtl ul,
body.rtl ol {
  padding-right: var(--spacing-xl);
  padding-left: 0;
}

/* Button RTL */
body.rtl .btn {
  flex-direction: row-reverse;
}

body.rtl .btn .icon:first-child {
  margin-right: 0;
  margin-left: var(--spacing-sm);
}

body.rtl .btn .icon:last-child {
  margin-left: 0;
  margin-right: var(--spacing-sm);
}

/* Input RTL */
body.rtl .input {
  text-align: right;
}

body.rtl .select select {
  padding-left: var(--spacing-3xl);
  padding-right: var(--spacing-lg);
}

body.rtl .select::after {
  left: var(--spacing-lg);
  right: auto;
}

/* Navbar RTL */
body.rtl .navbar-container {
  flex-direction: row-reverse;
}

body.rtl .navbar-nav {
  flex-direction: row-reverse;
}

body.rtl .navbar-actions {
  flex-direction: row-reverse;
}

body.rtl .navbar-nav a.active::after {
  left: auto;
  right: 0;
}

/* Language Switcher RTL */
body.rtl .language-switcher select {
  padding-left: var(--spacing-xl);
  padding-right: var(--spacing-md);
}

body.rtl .language-switcher::after {
  left: var(--spacing-sm);
  right: auto;
}

/* Dropdown RTL */
body.rtl .dropdown-menu {
  left: 0;
  right: auto;
}

body.rtl .dropdown-item {
  text-align: right;
}

/* Modal RTL */
body.rtl .modal-header {
  flex-direction: row-reverse;
}

body.rtl .modal-footer {
  flex-direction: row-reverse;
}

/* Toast RTL */
body.rtl .toast {
  left: var(--spacing-2xl);
  right: auto;
  transform: translateX(-400px);
}

body.rtl .toast.show {
  transform: translateX(0);
}

body.rtl .toast-success,
body.rtl .toast-error,
body.rtl .toast-warning,
body.rtl .toast-info {
  border-left: none;
  border-right: 4px solid;
}

/* Card RTL */
body.rtl .video-card-actions {
  flex-direction: row-reverse;
}

body.rtl .video-card-meta {
  flex-direction: row-reverse;
}

/* Grid & Layout RTL */
body.rtl .flex {
  flex-direction: row-reverse;
}

body.rtl .flex-col {
  flex-direction: column;
}

body.rtl .justify-start {
  justify-content: flex-end;
}

body.rtl .justify-end {
  justify-content: flex-start;
}

/* Spacing RTL Utilities */
body.rtl .ml-0 { margin-left: auto; margin-right: 0; }
body.rtl .mr-0 { margin-right: auto; margin-left: 0; }
body.rtl .pl-0 { padding-left: auto; padding-right: 0; }
body.rtl .pr-0 { padding-right: auto; padding-left: 0; }

/* Text Alignment RTL */
body.rtl .text-left { text-align: right; }
body.rtl .text-right { text-align: left; }

/* Video Player RTL */
body.rtl .big-play-button .icon {
  margin-left: 0;
  margin-right: 4px;
}

body.rtl .controls-row {
  flex-direction: row-reverse;
}

body.rtl .controls-left,
body.rtl .controls-right {
  flex-direction: row-reverse;
}

body.rtl .volume-control {
  flex-direction: row-reverse;
}

body.rtl .speed-options,
body.rtl .quality-options,
body.rtl .subtitles-options {
  left: 0;
  right: auto;
}

body.rtl .quality-option,
body.rtl .subtitle-option {
  text-align: right;
}

body.rtl .progress-handle {
  left: -8px;
  right: auto;
}

body.rtl .volume-slider .progress-handle {
  left: -6px;
  right: auto;
}

body.rtl .progress-tooltip {
  transform: translateX(50%);
}

body.rtl .pip-indicator {
  left: var(--spacing-lg);
  right: auto;
}

body.rtl .keyboard-shortcuts {
  right: var(--spacing-lg);
  left: auto;
}

/* Hero Section RTL */
body.rtl .hero-content {
  text-align: right;
}

body.rtl .hero-actions {
  flex-direction: row-reverse;
}

body.rtl .home-page--catalog .hero-indicators {
  right: auto;
  left: clamp(1rem, 4vw, 2.5rem);
}

@media (max-width: 640px) {
  body.rtl .home-page--catalog .hero-indicators {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}

/* Category Rows RTL */
body.rtl .category-header {
  flex-direction: row-reverse;
}

body.rtl .category-nav {
  flex-direction: row-reverse;
}

body.rtl .category-scroll {
  direction: rtl;
}

/* Browse Page RTL */
body.rtl .browse-header {
  flex-direction: row-reverse;
}

body.rtl .browse-filters {
  flex-direction: row-reverse;
}

body.rtl .search-input {
  text-align: right;
}

/* Admin Panel RTL */
body.rtl .admin-sidebar {
  left: auto;
  right: 0;
}

body.rtl .admin-main {
  margin-left: 0;
  margin-right: 250px;
}

body.rtl .stats-grid {
  direction: rtl;
}

body.rtl .stats-card {
  text-align: right;
}

body.rtl .stats-icon {
  margin-left: 0;
  margin-right: var(--spacing-lg);
}

body.rtl .table th,
body.rtl .table td {
  text-align: right;
}

body.rtl .table-actions {
  flex-direction: row-reverse;
}

/* Form RTL */
body.rtl .form-group {
  text-align: right;
}

body.rtl .form-row {
  flex-direction: row-reverse;
}

body.rtl .checkbox-wrapper,
body.rtl .radio-wrapper {
  flex-direction: row-reverse;
}

body.rtl .checkbox-wrapper .checkbox,
body.rtl .radio-wrapper .radio {
  margin-left: var(--spacing-sm);
  margin-right: 0;
}

/* Navigation RTL */
body.rtl .breadcrumb {
  flex-direction: row-reverse;
}

body.rtl .breadcrumb-separator {
  transform: scaleX(-1);
}

body.rtl .pagination {
  flex-direction: row-reverse;
}

/* Search RTL */
body.rtl .search-wrapper {
  flex-direction: row-reverse;
}

body.rtl .search-icon {
  left: auto;
  right: var(--spacing-lg);
}

body.rtl .search-input {
  padding-left: var(--spacing-lg);
  padding-right: var(--spacing-4xl);
}

body.rtl .search-results {
  text-align: right;
}

/* Filter RTL */
body.rtl .filter-group {
  text-align: right;
}

body.rtl .filter-tags {
  flex-direction: row-reverse;
}

body.rtl .filter-tag {
  flex-direction: row-reverse;
}

body.rtl .filter-tag .remove-icon {
  margin-left: 0;
  margin-right: var(--spacing-sm);
}

/* Watchlist RTL */
body.rtl .watchlist-item {
  flex-direction: row-reverse;
}

body.rtl .watchlist-content {
  text-align: right;
  margin-left: 0;
  margin-right: var(--spacing-lg);
}

body.rtl .watchlist-actions {
  flex-direction: row-reverse;
}

/* Video Info RTL */
body.rtl .video-info {
  text-align: right;
}

body.rtl .video-meta {
  flex-direction: row-reverse;
}

body.rtl .video-tags {
  flex-direction: row-reverse;
}

body.rtl .video-actions {
  flex-direction: row-reverse;
}

/* Comments RTL */
body.rtl .comment {
  flex-direction: row-reverse;
}

body.rtl .comment-content {
  text-align: right;
  margin-left: 0;
  margin-right: var(--spacing-lg);
}

body.rtl .comment-actions {
  flex-direction: row-reverse;
}

/* Rating RTL */
body.rtl .rating-stars {
  flex-direction: row-reverse;
}

/* Progress RTL */
body.rtl .progress {
  direction: ltr; /* Keep progress bars LTR for consistency */
}

/* Scroll RTL */
body.rtl .horizontal-scroll {
  direction: rtl;
}

body.rtl .scroll-button-left {
  left: auto;
  right: 0;
}

body.rtl .scroll-button-right {
  right: auto;
  left: 0;
}

/* Persian Number Support */
body.rtl .persian-numbers {
  font-family: 'Ravi', sans-serif;
}

/* Mobile RTL Adjustments */
@media (max-width: 768px) {
  body.rtl .mobile-menu {
    left: auto;
    right: 0;
    transform: translateX(100%);
  }
  
  body.rtl .mobile-menu.open {
    transform: translateX(0);
  }
  
  body.rtl .mobile-nav-toggle {
    left: var(--spacing-lg);
    right: auto;
  }
}

@media (max-width: 640px) {
  body.rtl .admin-sidebar {
    right: -250px;
    left: auto;
  }
  
  body.rtl .admin-sidebar.open {
    right: 0;
  }
  
  body.rtl .admin-main {
    margin-right: 0;
  }
}

/* Persian Font Optimizations */
body.rtl {
  font-feature-settings: "kern" 1, "liga" 1;
  text-rendering: optimizeLegibility;
}

/* Persian Typography Spacing */
body.rtl p,
body.rtl li,
body.rtl .text-content {
  line-height: 1.8; /* Better for Persian text */
  letter-spacing: 0.02em;
}

/* Persian Punctuation */
body.rtl .comma::after {
  content: '،'; /* Persian comma */
}

body.rtl .semicolon::after {
  content: '؛'; /* Persian semicolon */
}

body.rtl .question::after {
  content: '؟'; /* Persian question mark */
}

/* Persian Numbers (Optional - if you want to use Persian numerals) */
body.rtl.persian-numerals .number {
  font-feature-settings: "locl" 1;
}

/* Contextual Alternates for Better Persian Typography */
body.rtl .persian-text {
  font-feature-settings: "calt" 1, "ccmp" 1, "liga" 1;
  text-rendering: optimizeLegibility;
  font-variant-ligatures: contextual;
}

/* Persian Calendar Widget (if needed) */
body.rtl .calendar {
  direction: rtl;
}

body.rtl .calendar-header {
  flex-direction: row-reverse;
}

body.rtl .calendar-grid {
  direction: rtl;
}

/* Persian Date Display */
body.rtl .date-display {
  direction: rtl;
  font-family: 'Ravi', sans-serif;
}