/* Video Captions/Closed Captions Styles */
.captions-control-btn,
.captions-settings-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.captions-control-btn:hover,
.captions-settings-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.captions-control-btn.active {
    background: rgba(255, 107, 53, 0.2);
    border-color: rgba(255, 107, 53, 0.5);
    color: #ff6b35;
}

.captions-control-btn span,
.captions-settings-btn span {
    display: none;
}

/* Captions Display */
.captions-display {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    pointer-events: none;
    transition: all 0.3s ease;
    max-width: 80%;
    text-align: center;
}

.captions-display.position-top {
    top: 20px;
    bottom: auto;
}

.captions-display.position-middle {
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
}

.captions-display.position-bottom {
    bottom: 60px;
    top: auto;
    transform: translateX(-50%);
}

.captions-text {
    display: inline-block;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    border-radius: 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    animation: captionFadeIn 0.3s ease-out;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

@keyframes captionFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Captions Settings Modal */
.captions-settings-modal {
    max-width: 500px;
    max-height: 90vh;
    width: 90vw;
    background: #0a0a0a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
}

.captions-settings-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    border-bottom: 1px solid #333;
}

.captions-settings-modal .modal-header h2 {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.captions-settings-modal .modal-header h2 svg {
    color: #ff6b35;
}

.captions-settings-modal .modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.captions-settings-modal .modal-body::-webkit-scrollbar {
    width: 6px;
}

.captions-settings-modal .modal-body::-webkit-scrollbar-track {
    background: #111;
}

.captions-settings-modal .modal-body::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

/* Settings Sections */
.settings-section {
    margin-bottom: 32px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
}

/* Language Selector */
.language-selector select {
    width: 100%;
    padding: 12px;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.language-selector select:focus {
    border-color: #ff6b35;
}

.language-selector select option {
    background: #111;
    color: #fff;
}

.language-selector select option:disabled {
    color: #666;
}

/* Appearance Settings */
.appearance-settings {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-group label {
    color: #ccc;
    font-size: 14px;
    font-weight: 500;
}

/* Font Size Controls */
.font-size-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: #111;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #333;
}

.font-size-controls button {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.font-size-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.font-size-controls button:active {
    transform: scale(0.95);
}

#fontSizeDisplay {
    color: #ff6b35;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

/* Color Picker */
.color-picker {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker input[type="color"] {
    width: 50px;
    height: 40px;
    background: transparent;
    border: 2px solid #333;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-picker input[type="color"]:hover {
    border-color: #ff6b35;
    transform: scale(1.05);
}

.color-picker input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Position Selector */
.position-selector {
    display: flex;
    gap: 16px;
    background: #111;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #333;
}

.position-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.position-selector label:hover {
    color: #fff;
}

.position-selector input[type="radio"] {
    accent-color: #ff6b35;
}

/* Accessibility Settings */
.accessibility-settings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 8px;
    border-radius: 6px;
    background: #111;
    border: 1px solid #333;
}

.checkbox-label:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.checkbox-label input[type="checkbox"] {
    accent-color: #ff6b35;
    width: 18px;
    height: 18px;
}

/* Settings Actions */
.settings-actions {
    display: flex;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid #333;
}

.btn-primary {
    flex: 1;
    padding: 12px 20px;
    background: linear-gradient(135deg, #ff6b35, #ff9558);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ff7a45, #ffa468);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-secondary {
    flex: 1;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Captions Preview */
.captions-preview {
    margin-top: 20px;
    padding: 16px;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
}

.captions-preview h4 {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px 0;
}

.preview-captions {
    position: relative;
    height: 120px;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
}

.preview-captions .captions-display {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90%;
}

.preview-captions .captions-text {
    font-size: 14px;
}

/* High Contrast Mode */
.captions-display.high-contrast .captions-text {
    background: #000;
    color: #fff;
    border: 2px solid #fff;
    text-shadow: none;
}

/* Loading State */
.captions-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #666;
    font-size: 14px;
    padding: 20px;
}

.captions-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #333;
    border-top-color: #ff6b35;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error State */
.captions-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #ff4336;
    font-size: 14px;
    padding: 20px;
    background: rgba(255, 67, 54, 0.1);
    border: 1px solid rgba(255, 67, 54, 0.3);
    border-radius: 6px;
    margin: 16px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .captions-settings-modal {
        width: 95vw;
        max-height: 95vh;
    }

    .captions-settings-modal .modal-header {
        padding: 16px 20px;
    }

    .captions-settings-modal .modal-header h2 {
        font-size: 18px;
    }

    .captions-settings-modal .modal-body {
        padding: 20px;
    }

    .captions-text {
        font-size: 14px;
        padding: 6px 10px;
    }

    .position-selector {
        flex-direction: column;
        gap: 8px;
    }

    .font-size-controls {
        padding: 8px;
    }

    .settings-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .captions-display {
        max-width: 90%;
        bottom: 50px;
    }

    .captions-text {
        font-size: 12px;
        padding: 4px 8px;
    }

    .captions-control-btn span,
    .captions-settings-btn span {
        display: inline;
    }

    .captions-settings-modal .modal-body {
        padding: 16px;
    }

    .setting-group label {
        font-size: 12px;
    }

    .checkbox-label {
        padding: 6px;
        font-size: 12px;
    }
}

/* Focus States */
.captions-control-btn:focus,
.captions-settings-btn:focus {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

/* Animation for caption changes */
.captions-text.updating {
    animation: captionUpdate 0.2s ease-out;
}

@keyframes captionUpdate {
    0% {
        opacity: 0.3;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .captions-text,
    .captions-display,
    .captions-control-btn,
    .captions-settings-btn {
        animation: none;
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .captions-text {
        background: #000;
        color: #fff;
        border: 1px solid #fff;
        text-shadow: none;
    }

    .captions-control-btn,
    .captions-settings-btn {
        border-width: 2px;
        border-color: #fff;
    }
}

/* Print styles */
@media print {
    .captions-display,
    .captions-control-btn,
    .captions-settings-btn {
        display: none !important;
    }
}

/* Performance optimizations */
.captions-text {
    will-change: transform, opacity;
    contain: layout style paint;
}

/* Tooltip styles */
.captions-control-btn[title]:hover::after,
.captions-settings-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    margin-bottom: 4px;
}

/* Captions indicator */
.captions-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 107, 53, 0.9);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    z-index: 101;
}

/* Language indicator */
.language-indicator {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 101;
    text-transform: uppercase;
}
