/* Review Text Direction Styles */
/* Ensures proper text direction and justify alignment for review content */

/* Base text direction classes */
.text-rtl {
    direction: rtl !important;
}

.text-ltr {
    direction: ltr !important;
}

/* Justify alignment with direction support */
.text-justify-rtl {
    direction: rtl !important;
    text-align: justify !important;
    text-align-last: right !important;
}

.text-justify-ltr {
    direction: ltr !important;
    text-align: justify !important;
    text-align-last: left !important;
}

/* Review text content specific styles */
.review-text-content {
    /* Ensure justify alignment is always applied */
    text-align: justify !important;
    
    /* Better line spacing for justified text */
    line-height: 1.6 !important;
    
    /* Word spacing for better justification */
    word-spacing: 0.1em !important;
    
    /* Hyphenation for better text flow */
    hyphens: auto !important;
    -webkit-hyphens: auto !important;
    -moz-hyphens: auto !important;
    -ms-hyphens: auto !important;
}

/* RTL specific adjustments */
.review-text-content.text-rtl,
.review-text-content.text-justify-rtl {
    direction: rtl !important;
    text-align: justify !important;
    text-align-last: right !important;
    
    /* RTL-specific font adjustments - but NOT for Word-formatted content */
    /* CRITICAL: Do NOT override font-family for elements with inline style font-family (Word formatting) */
    /* Allow Word formatting (B Nazanin, IRLotus, etc.) to be preserved */
}

/* Only apply default font if element doesn't have font-family in inline style (Word formatting) */
.review-text-content.text-rtl:not([style*="font-family"]),
.review-text-content.text-justify-rtl:not([style*="font-family"]),
.review-text-content.text-rtl *:not([style*="font-family"]),
.review-text-content.text-justify-rtl *:not([style*="font-family"]) {
    font-family: 'Tahoma', 'Arial Unicode MS', 'Arial', sans-serif !important;
}

/* LTR specific adjustments */
.review-text-content.text-ltr,
.review-text-content.text-justify-ltr {
    direction: ltr !important;
    text-align: justify !important;
    text-align-last: left !important;
    
    /* LTR-specific font adjustments - but NOT for Word-formatted content */
    /* CRITICAL: Do NOT override font-family for elements with inline style font-family (Word formatting) */
    /* Allow Word formatting (B Nazanin, IRLotus, etc.) to be preserved */
}

/* Only apply default font if element doesn't have font-family in inline style (Word formatting) */
.review-text-content.text-ltr:not([style*="font-family"]),
.review-text-content.text-justify-ltr:not([style*="font-family"]),
.review-text-content.text-ltr *:not([style*="font-family"]),
.review-text-content.text-justify-ltr *:not([style*="font-family"]) {
    font-family: 'Crimson Text', 'Times New Roman', serif !important;
}

/* Publisher content preservation */
.review-text-content.publisher-content {
    /* Preserve existing inline styles but ensure justify alignment */
    text-align: justify !important;
}

/* Ensure publisher content respects text direction */
.review-text-content.publisher-content.text-rtl,
.review-text-content.publisher-content.text-justify-rtl {
    direction: rtl !important;
    text-align: justify !important;
    text-align-last: right !important;
}

.review-text-content.publisher-content.text-ltr,
.review-text-content.publisher-content.text-justify-ltr {
    direction: ltr !important;
    text-align: justify !important;
    text-align-last: left !important;
}

/* Fallback content styling */
.review-text-content.fallback-content {
    text-align: center !important;
    direction: ltr !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .review-text-content {
        /* Slightly reduced line height on mobile for better readability */
        line-height: 1.5 !important;
        
        /* Adjust word spacing for mobile */
        word-spacing: 0.05em !important;
    }
}

/* Print styles */
@media print {
    .review-text-content {
        text-align: justify !important;
        line-height: 1.4 !important;
    }
}

/* Debug styles (remove in production) */
.review-text-content[data-detected-language] {
    /* Add subtle border for debugging */
    /* border-left: 2px solid #007bff; */
}

.review-text-content[data-detected-language="persian-arabic"] {
    /* border-left-color: #28a745; */
}

.review-text-content[data-detected-language="english"] {
    /* border-left-color: #dc3545; */
}

.review-text-content[data-detected-language="mixed"] {
    /* border-left-color: #ffc107; */
}
