/**
 * Subtitle Sync Pro - Styles
 * 
 * Styles for subtitle containers, captions, and error messages.
 * 
 * @version 2.3.0
 */

/* ============================================
   Base Container Styles
   ============================================ */

.arsub-container {
    position: relative;
    margin: 1em 0;
    font-family: "Tahoma", "Segoe UI", "Arial", sans-serif;
    max-width: 100%;
}

/* ============================================
   Video Player Styles
   ============================================ */

.ssp-video-player {
    width: 100%;
    height: auto;
    display: block;
    background: #000;
}

/* ============================================
   Caption Container
   ============================================ */

.arsub-captions {
    position: relative;
    margin-top: 8px;
    padding: 0;
    background: transparent;
    color: #ffffff;
    border-radius: 4px;
    font-size: 1.1em;
    line-height: 1.5;
    text-align: right;
    direction: rtl;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-height: 1.5em;
    transition: opacity 0.2s ease-in-out;
}

/* ============================================
   Text Alignment Variants
   ============================================ */

/* RTL alignment */
.arsub-captions[dir="rtl"] {
    text-align: right;
    direction: rtl;
}

/* LTR alignment */
.arsub-captions[dir="ltr"] {
    text-align: left;
    direction: ltr;
}

/* Center alignment - container is ltr but text is centered */
[data-text-align="center"] .arsub-captions {
    text-align: center;
    direction: ltr;
}

/* ============================================
   Subtitle Text Span Styles
   ============================================ */

.arsub-captions span {
    display: inline-block;
    max-width: 95%;
    padding: 4px 8px;
    border-radius: 3px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ============================================
   Error Message Styles
   ============================================ */

.arsub-error {
    display: inline-block;
    color: #d32f2f;
    padding: 8px 12px;
    background: #ffebee;
    border-left: 4px solid #f44336;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    margin: 10px 0;
    line-height: 1.4;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablets */
@media screen and (max-width: 768px) {
    .arsub-captions {
        font-size: 1em;
        margin-top: 6px;
    }

    .arsub-captions span {
        padding: 3px 6px;
        font-size: 0.95em;
    }

    .arsub-error {
        font-size: 0.85em;
        padding: 6px 10px;
    }
}

/* Mobile devices */
@media screen and (max-width: 480px) {
    .arsub-container {
        margin: 0.5em 0;
    }

    .arsub-captions {
        font-size: 0.9em;
        margin-top: 4px;
        line-height: 1.4;
    }

    .arsub-captions span {
        padding: 3px 5px;
        max-width: 98%;
        font-size: 0.9em;
    }

    .arsub-error {
        font-size: 0.8em;
        padding: 5px 8px;
    }

    /* Adjust font size for very small screens */
    .arsub-captions[data-responsive="true"] span {
        font-size: clamp(12px, 3.5vw, 16px);
    }
}

/* ============================================
   Accessibility Improvements
   ============================================ */

/* Focus styles for keyboard navigation */
.arsub-captions:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

/* Screen reader only class */
.ssp-screen-reader {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   Animation and Transitions
   ============================================ */

/* Smooth fade-in for subtitles */
@keyframes ssp-fade-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.arsub-captions span {
    animation: ssp-fade-in 0.2s ease-in-out;
}

/* ============================================
   High Contrast Mode Support
   ============================================ */

@media (prefers-contrast: high) {
    .arsub-captions span {
        border: 1px solid currentColor;
    }

    .arsub-error {
        border-width: 3px;
        font-weight: bold;
    }
}

/* ============================================
   Reduced Motion Support
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .arsub-captions span {
        animation: none;
    }

    .arsub-captions {
        transition: none;
    }
}

/* ============================================
   Print Styles (hide subtitles when printing)
   ============================================ */

@media print {
    .arsub-captions {
        display: none !important;
    }
}
