/**
 * CharaTomo アクセシビリティ対応CSS
 * WCAG 2.1 AA準拠のアクセシビリティ機能
 */

/* 高コントラストモード */
.high-contrast {
    filter: contrast(1.5) brightness(1.2);
}

.high-contrast .voice-controls {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}

.high-contrast .voice-btn {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}

.high-contrast .voice-btn:hover:not(:disabled) {
    background: #fff !important;
    color: #000 !important;
}

.high-contrast .voice-control-label {
    color: #fff !important;
    font-weight: bold !important;
}

.high-contrast .voice-control-value {
    background: #000 !important;
    color: #fff !important;
    border: 1px solid #fff !important;
}

/* 大きなボタンモード */
.large-buttons .voice-btn {
    padding: 20px 30px !important;
    font-size: 18px !important;
    min-width: 120px !important;
    min-height: 60px !important;
}

.large-buttons .voice-control-range input[type="range"] {
    height: 12px !important;
}

.large-buttons .voice-control-range input[type="range"]::-webkit-slider-thumb {
    width: 30px !important;
    height: 30px !important;
}

.large-buttons .voice-control-range input[type="range"]::-moz-range-thumb {
    width: 30px !important;
    height: 30px !important;
}

/* フォーカス表示の強化 */
.voice-btn:focus,
.voice-control-range input:focus,
.voice-setting-select:focus {
    outline: 3px solid #007bff !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25) !important;
}

/* キーボードナビゲーション対応 */
.voice-controls[tabindex="0"]:focus {
    outline: 3px solid #007bff !important;
    outline-offset: 2px !important;
}

/* スクリーンリーダー対応 */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* 音声状態の視覚的表示 */
.voice-status-indicator {
    position: relative;
    display: inline-block;
}

.voice-status-indicator::after {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #28a745;
    border: 2px solid #fff;
    animation: pulse 2s infinite;
}

.voice-status-indicator.playing::after {
    background: #007bff;
}

.voice-status-indicator.paused::after {
    background: #ffc107;
}

.voice-status-indicator.error::after {
    background: #dc3545;
}

/* アニメーション制御 */
@media (prefers-reduced-motion: reduce) {

    .voice-btn,
    .voice-control-range input[type="range"],
    .voice-status-indicator::after {
        animation: none !important;
        transition: none !important;
    }
}

/* 色覚異常対応 */
.colorblind-friendly .voice-btn-primary {
    background: #0066cc !important;
    border: 2px solid #003d7a !important;
}

.colorblind-friendly .voice-btn-secondary {
    background: #666666 !important;
    border: 2px solid #333333 !important;
}

.colorblind-friendly .voice-btn-settings {
    background: #0099cc !important;
    border: 2px solid #006699 !important;
}

/* テキストサイズ調整 */
.text-large {
    font-size: 1.2em !important;
}

.text-extra-large {
    font-size: 1.5em !important;
}

/* 音声設定モーダルのアクセシビリティ */
.voice-settings-modal .modal-content {
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

.voice-settings-modal .form-control:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

.voice-settings-modal .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

/* エラーメッセージの表示 */
.voice-error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 12px;
    margin: 10px 0;
    font-weight: bold;
}

.voice-error-message::before {
    content: "⚠️ ";
    font-size: 1.2em;
}

/* 成功メッセージの表示 */
.voice-success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 12px;
    margin: 10px 0;
    font-weight: bold;
}

.voice-success-message::before {
    content: "✅ ";
    font-size: 1.2em;
}

/* ローディング表示のアクセシビリティ */
.voice-loading {
    position: relative;
}

.voice-loading::after {
    content: "読み込み中...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 1000;
}

/* モバイルアクセシビリティ */
@media (max-width: 768px) {
    .large-buttons .voice-btn {
        padding: 15px 25px !important;
        font-size: 16px !important;
        min-width: 100px !important;
        min-height: 50px !important;
    }

    .voice-controls {
        padding: 20px !important;
    }

    .voice-control-item {
        margin-bottom: 20px !important;
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    .voice-controls {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%) !important;
        color: #ecf0f1 !important;
    }

    .voice-btn {
        color: #ecf0f1 !important;
    }

    .voice-control-label {
        color: #ecf0f1 !important;
    }

    .voice-control-value {
        background: rgba(236, 240, 241, 0.2) !important;
        color: #ecf0f1 !important;
    }
}

/* 印刷対応 */
@media print {

    .voice-controls,
    .voice-settings-modal {
        display: none !important;
    }
}