/**
 * RTL Overrides for WCMS Product Suite
 *
 * This stylesheet provides RTL (Right-to-Left) adjustments for Persian/Arabic layouts.
 * It overrides LTR defaults while maintaining visual consistency.
 *
 * @package WCMS_Product_Suite
 * @since 1.0.0
 */

/* ========================================
   Base RTL Overrides
======================================== */

.wcms-comments-wrapper,
.wcms-rating-wrapper {
	direction: rtl;
	text-align: right;
}

/* ========================================
   Common Components
======================================== */

/* Toast */
.wcms-toast {
	left: auto;
	right: 50%;
	transform: translateX(50%);
}

.wcms-toast.visible {
	transform: translateX(50%) translateY(0);
}

/* Modal */
.wcms-modal-close {
	left: var(--wcms-spacing-lg);
	right: auto;
}

/* Buttons with icons */
.wcms-btn svg,
.wcms-btn-icon svg {
	margin-left: var(--wcms-spacing-xs);
	margin-right: 0;
}

/* ========================================
   Ratings Module RTL
======================================== */

/* Percentage bar fill direction */
.wcms-percentage-bar-fill {
	border-radius: 0 var(--wcms-radius-full) var(--wcms-radius-full) 0;
}

/* Rating option layout */
.wcms-rating-option-content {
	flex-direction: row-reverse;
}

.wcms-rating-option .wcms-rating-circle {
	margin-left: var(--wcms-spacing-md);
	margin-right: 0;
}

/* Stats alignment */
.wcms-rating-stats {
	text-align: left;
}

/* ========================================
   Comments Module RTL
======================================== */

/* Thread lines */
.wcms-reply-thread::before {
	left: auto;
	right: 24px;
	border-left: none;
	border-right: 2px solid var(--wcms-gray-200);
}

.wcms-reply-thread .wcms-comment-item::before {
	left: auto;
	right: 24px;
	border-left: none;
	border-right: 2px solid var(--wcms-gray-200);
	border-bottom: 2px solid var(--wcms-gray-200);
	border-radius: 0 0 0 var(--wcms-radius-lg);
}

/* Comment avatar */
.wcms-comment-avatar {
	margin-left: var(--wcms-spacing-md);
	margin-right: 0;
}

/* Reply thread indent */
.wcms-reply-thread {
	padding-left: 0;
	padding-right: 56px;
	margin-left: 0;
	margin-right: 0;
}

/* Comment actions */
.wcms-comment-actions {
	flex-direction: row-reverse;
}

.wcms-action-btn + .wcms-action-btn {
	margin-left: 0;
	margin-right: var(--wcms-spacing-sm);
}

/* Vote count */
.wcms-vote-count {
	margin-left: 0;
	margin-right: var(--wcms-spacing-xs);
}

/* Sort dropdown */
.wcms-sort-menu {
	left: auto;
	right: 0;
}

/* Input container attachments */
.wcms-attachment-remove {
	left: auto;
	right: -8px;
}

/* Comment input actions */
.wcms-input-actions {
	flex-direction: row-reverse;
}

.wcms-input-tools {
	margin-right: 0;
	margin-left: auto;
}

/* Rating pills in comments */
.wcms-rating-pill {
	margin-left: 0;
	margin-right: var(--wcms-spacing-xs);
}

.wcms-rating-pills {
	flex-direction: row-reverse;
}

/* User meta */
.wcms-comment-user-meta {
	flex-direction: row-reverse;
}

.wcms-user-badge {
	margin-left: 0;
	margin-right: var(--wcms-spacing-xs);
}

/* Report button */
.wcms-action-report {
	margin-left: 0;
	margin-right: auto;
}

/* Image modal close button */
.wcms-image-modal-close {
	left: var(--wcms-spacing-lg);
	right: auto;
}

/* ========================================
   Admin Panel RTL
======================================== */

.wcms-admin-wrap {
	direction: rtl;
	text-align: right;
}

/* Admin tabs */
.wcms-admin-tabs {
	flex-direction: row-reverse;
}

/* Admin card actions */
.wcms-card-actions {
	flex-direction: row-reverse;
}

/* Form groups */
.wcms-form-group label {
	text-align: right;
}

/* Admin table */
.wcms-admin-table th,
.wcms-admin-table td {
	text-align: right;
}

.wcms-admin-table th:last-child,
.wcms-admin-table td:last-child {
	text-align: left;
}

/* Stat cards */
.wcms-stat-card {
	text-align: right;
}

.wcms-stat-icon {
	margin-left: var(--wcms-spacing-md);
	margin-right: 0;
}

/* ========================================
   Animations RTL
======================================== */

@keyframes wcms-slide-in-rtl {
	from {
		transform: translateX(20px);
		opacity: 0;
	}
	to {
		transform: translateX(0);
		opacity: 1;
	}
}

.wcms-comment-item {
	animation: wcms-slide-in-rtl 0.3s ease-out;
}

/* ========================================
   Responsive RTL Adjustments
======================================== */

@media (max-width: 768px) {
	/* Mobile thread lines */
	.wcms-reply-thread {
		padding-right: 40px;
	}

	.wcms-reply-thread::before {
		right: 16px;
	}

	.wcms-reply-thread .wcms-comment-item::before {
		right: 16px;
	}

	/* Mobile comment actions */
	.wcms-comment-actions {
		flex-wrap: wrap;
	}

	/* Mobile modal */
	.wcms-modal-content {
		margin: var(--wcms-spacing-md);
	}
}

@media (max-width: 480px) {
	/* Small screen adjustments */
	.wcms-reply-thread {
		padding-right: 32px;
	}

	.wcms-comment-avatar {
		width: 36px;
		height: 36px;
	}

	/* Input section */
	.wcms-input-actions {
		flex-wrap: wrap;
		gap: var(--wcms-spacing-sm);
	}
}
