/**
 * Magzen Plugin RTL Styles
 * Right-to-left language support
 */

/* ==========================================================================
   Base RTL Layout
   ========================================================================== */

.magzen-rtl {
    direction: rtl;
}

.magzen-rtl * {
    text-align: inherit;
}

/* ==========================================================================
   Archive RTL Adjustments
   ========================================================================== */

/* Badge positioning */
.magzen-rtl .magzen-issue-badge {
    right: auto;
    left: 10px;
}

/* Meta spacing */
.magzen-rtl .magzen-issue-meta {
    direction: rtl;
}

.magzen-rtl .magzen-issue-meta span {
    margin-right: 0;
    margin-left: 15px;
}

.magzen-rtl .magzen-meta-icon {
    margin-right: 0;
    margin-left: 5px;
}

/* Actions alignment */
.magzen-rtl .magzen-issue-actions {
    direction: rtl;
    justify-content: flex-start;
}

/* Card content alignment */
.magzen-rtl .magzen-issue-content {
    text-align: right;
}

.magzen-rtl .magzen-issue-title {
    text-align: right;
}

.magzen-rtl .magzen-issue-excerpt {
    text-align: right;
}

/* ==========================================================================
   Viewer RTL Adjustments
   ========================================================================== */

/* Header layout */
.magzen-rtl .magzen-viewer-header {
    direction: rtl;
}

.magzen-rtl .magzen-issue-info {
    text-align: right;
}

.magzen-rtl .magzen-viewer-title {
    text-align: right;
}

.magzen-rtl .magzen-viewer-meta {
    direction: rtl;
    justify-content: flex-start;
}

.magzen-rtl .magzen-viewer-actions {
    direction: rtl;
}

/* Navigation layout */
.magzen-rtl .magzen-viewer-navigation {
    direction: rtl;
}

.magzen-rtl .magzen-other-issues {
    direction: rtl;
}

.magzen-rtl .magzen-nav-label {
    margin-right: 0;
    margin-left: 10px;
    text-align: right;
}

/* Icon flipping */
.magzen-rtl .magzen-nav-icon {
    transform: scaleX(-1);
}

.magzen-rtl .magzen-download-icon,
.magzen-rtl .magzen-fullscreen-icon {
    margin-right: 0;
    margin-left: 8px;
}

/* ==========================================================================
   Button RTL Adjustments
   ========================================================================== */

.magzen-rtl .magzen-btn {
    direction: rtl;
}

/* Flex direction for button content */
.magzen-rtl .magzen-btn {
    flex-direction: row-reverse;
}

/* ==========================================================================
   Error States RTL
   ========================================================================== */

.magzen-rtl .magzen-archive-empty,
.magzen-rtl .magzen-viewer-error {
    text-align: center; /* Keep centered for errors */
}

.magzen-rtl .magzen-error-content {
    text-align: center;
}

.magzen-rtl .magzen-fallback-content {
    text-align: center;
}

/* ==========================================================================
   Grid RTL Adjustments
   ========================================================================== */

.magzen-rtl .magzen-archive-grid {
    direction: rtl;
}

/* Ensure grid items flow correctly in RTL */
.magzen-rtl .magzen-issue-card {
    direction: ltr; /* Reset direction for card content */
}

.magzen-rtl .magzen-issue-card .magzen-issue-content {
    direction: rtl; /* But keep content RTL */
}

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

@media (max-width: 768px) {
    .magzen-rtl .magzen-viewer-header {
        align-items: flex-end;
    }
    
    .magzen-rtl .magzen-viewer-actions {
        justify-content: flex-end;
    }
    
    .magzen-rtl .magzen-viewer-navigation {
        align-items: flex-end;
    }
    
    .magzen-rtl .magzen-other-issues {
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .magzen-rtl .magzen-issue-meta span {
        margin-left: 0;
    }
    
    .magzen-rtl .magzen-nav-label {
        margin-left: 0;
        text-align: right;
    }
    
    .magzen-rtl .magzen-issue-meta {
        align-items: flex-end;
    }
    
    .magzen-rtl .magzen-viewer-actions,
    .magzen-rtl .magzen-other-issues {
        align-items: stretch;
    }
}

/* ==========================================================================
   PDF Viewer RTL
   ========================================================================== */

.magzen-rtl .magzen-pdf-viewer {
    direction: ltr; /* Keep PDF viewer LTR for proper display */
}

.magzen-rtl .magzen-pdf-iframe {
    direction: ltr;
}

/* ==========================================================================
   Loading States RTL
   ========================================================================== */

.magzen-rtl .magzen-loading {
    direction: ltr; /* Keep loading spinner LTR */
    text-align: center;
}
