/**
 * 音声入力コンポーネント用CSS
 * マイクボタンのスタイルと録音中のアニメーション
 */

/* マイクボタンの基本スタイル - 改善版 */
.mic-trigger-btn {
    min-width: 110px;
    height: 38px;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

/* ボタン内のテキスト */
.mic-trigger-btn .voice-btn-text {
    display: inline;
}

/* 小さい画面ではテキストを非表示にしてアイコンのみ */
@media (max-width: 768px) {
    .mic-trigger-btn {
        min-width: 42px;
        padding: 0.5rem;
    }
    
    .mic-trigger-btn .voice-btn-text {
        display: none;
    }
}

/* マイクボタンのホバーエフェクト - 強化版 */
.mic-trigger-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* btn-info 状態のホバー */
.mic-trigger-btn.btn-info:hover:not(:disabled) {
    background-color: #0099ff !important;
    border-color: #0099ff !important;
    transform: translateY(-2px) scale(1.02);
}

/* マイクボタンのアクティブ状態 */
.mic-trigger-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* 録音中のアニメーション - 強化版 */
.mic-trigger-btn.recording {
    animation: pulse-recording 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
}

@keyframes pulse-recording {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(220, 53, 69, 0);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
        transform: scale(1);
    }
}

/* 録音中のボタン自体も強調 */
.mic-trigger-btn.btn-danger.recording {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    font-weight: 600;
}

/* 録音中のアイコン点滅 */
.mic-trigger-btn.recording i {
    animation: blink-icon 1s ease-in-out infinite;
}

@keyframes blink-icon {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 無効化状態 */
.mic-trigger-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* textareaと並べたときの高さ調整 */
.d-flex.align-items-start .mic-trigger-btn {
    margin-top: 0;
}

/* モーダル内での配置調整 */
.modal-body .d-flex .mic-trigger-btn {
    flex-shrink: 0;
}

/* 小さい画面での調整 */
@media (max-width: 576px) {
    .mic-trigger-btn {
        min-width: 38px;
        height: 38px;
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
}

/* マイクボタンのツールチップ風スタイル（オプション） */
.mic-trigger-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 4px;
    margin-bottom: 5px;
    pointer-events: none;
    z-index: 1000;
}

/* 音声入力対応の入力欄の視覚的ヒント（オプション） */
.voice-input {
    position: relative;
}

/* 音声入力が有効な入力欄の左側に小さなマイクアイコンを表示（オプション） */
.voice-input[data-voice-input-initialized="true"] {
    /* 必要に応じてスタイルを追加 */
}

/* フォーカス時のハイライト */
.voice-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* トースト通知のアニメーション */
.alert.fade.show {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* スピナーアニメーション（処理中表示） */
.fa-spinner.fa-spin {
    animation: fa-spin 1s infinite linear;
}

@keyframes fa-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* レスポンシブデザイン: モバイルでのマイクボタン配置 */
@media (max-width: 768px) {
    .d-flex.align-items-start {
        flex-wrap: wrap;
    }
    
    .mic-trigger-btn {
        margin-top: 8px;
        margin-left: 0 !important;
    }
}

/* ダークモード対応（オプション） */
@media (prefers-color-scheme: dark) {
    .mic-trigger-btn {
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    .mic-trigger-btn:hover:not(:disabled) {
        box-shadow: 0 4px 6px rgba(255, 255, 255, 0.1);
    }
}

/* アクセシビリティ: キーボードフォーカス時のスタイル */
.mic-trigger-btn:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
    .mic-trigger-btn {
        border-width: 2px;
    }
    
    .mic-trigger-btn.recording {
        border-color: #dc3545;
        border-width: 3px;
    }
}

