/**
 * app-effects.css
 *
 * エフェクト・アニメーション関連のCSS
 * - Tooltip Styles
 * - AI Button Hover Effects
 * - AI Features Animations
 *
 * 元々 index_body-app.php / index_body.php にインラインで記述されていたものを外部化
 */

/* ========================================
   Tooltip Styles
   ======================================== */
.theme-button-tooltip {
    position: relative;
}

.theme-button-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 10px;
    white-space: nowrap;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10000;
}

.theme-button-tooltip:hover::after {
    opacity: 1;
}

/* ========================================
   AI Button Hover Effects
   ======================================== */
.ai-popup-btn:hover {
    background: #e9ecef !important;
    transform: translateX(4px);
}

#floatingAiButton:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 28px rgba(255, 215, 0, 0.6);
}

#floatingAiButton:active {
    transform: scale(0.95);
}

/* ========================================
   AI Features Animations
   ======================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

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

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

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

.ai-chat-modal {
    animation: slideUp 0.3s ease;
}

.toast-notification {
    animation: slideIn 0.3s ease;
}

/* ========================================
   Shake Animations
   ======================================== */

/* Horizontal Shake Animations */
@keyframes shake-horizontal-subtle {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

@keyframes shake-horizontal-normal {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
    20%, 40%, 60%, 80% { transform: translateX(6px); }
}

@keyframes shake-horizontal-strong {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

/* Vertical Shake Animations */
@keyframes shake-vertical-subtle {
    0%, 100% { transform: translateY(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateY(-3px); }
    20%, 40%, 60%, 80% { transform: translateY(3px); }
}

@keyframes shake-vertical-normal {
    0%, 100% { transform: translateY(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateY(-6px); }
    20%, 40%, 60%, 80% { transform: translateY(6px); }
}

@keyframes shake-vertical-strong {
    0%, 100% { transform: translateY(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateY(-10px); }
    20%, 40%, 60%, 80% { transform: translateY(10px); }
}

/* Both Direction Shake Animations */
@keyframes shake-both-subtle {
    0%, 100% { transform: translate(0, 0); }
    10%, 30%, 50%, 70%, 90% { transform: translate(-3px, -3px); }
    20%, 40%, 60%, 80% { transform: translate(3px, 3px); }
}

@keyframes shake-both-normal {
    0%, 100% { transform: translate(0, 0); }
    10%, 30%, 50%, 70%, 90% { transform: translate(-6px, -6px); }
    20%, 40%, 60%, 80% { transform: translate(6px, 6px); }
}

@keyframes shake-both-strong {
    0%, 100% { transform: translate(0, 0); }
    10%, 30%, 50%, 70%, 90% { transform: translate(-10px, -10px); }
    20%, 40%, 60%, 80% { transform: translate(10px, 10px); }
}

/* Toast-specific Shake Animations (preserves translateX(-50%) centering) */
@keyframes shake-toast-subtle {
    0%, 100% { transform: translateX(-50%); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(calc(-50% - 1px)); }
    20%, 40%, 60%, 80% { transform: translateX(calc(-50% + 1px)); }
}

@keyframes shake-toast-normal {
    0%, 100% { transform: translateX(-50%); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(calc(-50% - 1px)); }
    20%, 40%, 60%, 80% { transform: translateX(calc(-50% + 1px)); }
}

@keyframes shake-toast-strong {
    0%, 100% { transform: translateX(-50%); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(calc(-50% - 1px)); }
    20%, 40%, 60%, 80% { transform: translateX(calc(-50% + 1px)); }
}

/* Shake Animation Classes */
.animate-shake-horizontal-subtle {
    animation: shake-horizontal-subtle 0.5s ease-in-out;
}

/* Toast-specific overrides */
#voice-transcript-toast.animate-shake-horizontal-subtle {
    animation: shake-toast-subtle 0.1s ease-in-out;
}

#voice-transcript-toast.animate-shake-horizontal-normal {
    animation: shake-toast-normal 0.1s ease-in-out;
}

#voice-transcript-toast.animate-shake-horizontal-strong {
    animation: shake-toast-strong 0.1s ease-in-out;
}

.animate-shake-horizontal-normal {
    animation: shake-horizontal-normal 0.5s ease-in-out;
}

.animate-shake-horizontal-strong {
    animation: shake-horizontal-strong 0.5s ease-in-out;
}

.animate-shake-vertical-subtle {
    animation: shake-vertical-subtle 0.5s ease-in-out;
}

.animate-shake-vertical-normal {
    animation: shake-vertical-normal 0.5s ease-in-out;
}

.animate-shake-vertical-strong {
    animation: shake-vertical-strong 0.5s ease-in-out;
}

.animate-shake-both-subtle {
    animation: shake-both-subtle 0.5s ease-in-out;
}

.animate-shake-both-normal {
    animation: shake-both-normal 0.5s ease-in-out;
}

.animate-shake-both-strong {
    animation: shake-both-strong 0.5s ease-in-out;
}

/* ========================================
   Voice Transcript Toast
   ======================================== */

/* 音声認識テキスト表示トースト */
#voice-transcript-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);

    /* 固定サイズ（2025/12/08決定） */
    width: 300px;
    max-width: 90vw;
    height: 100px;

    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 12px 16px; /* 上下のパディング調整 */
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4; /* 行間を狭める */
    z-index: 9999;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);

    display: flex;
    align-items: center; /* 中央揃え */
    justify-content: center;
    overflow: hidden;

    /* 初期状態は非表示 */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#voice-transcript-toast.visible {
    opacity: 1;
    pointer-events: auto;
}

/* テキスト表示エリア */
#voice-transcript-text {
    width: 100%;
    max-height: 100%;
    display: flex;
    align-items: flex-start; /* 上揃え */
    justify-content: center;
    overflow-y: auto;
    overflow-x: hidden;
    word-wrap: break-word;
    text-align: left; /* 左揃え */
    padding: 8px 4px; /* 上下に余白 */
    line-height: 1.5; /* 行間を調整 */
}

/* スクロールバーのスタイル */
#voice-transcript-text::-webkit-scrollbar {
    width: 4px;
}

#voice-transcript-text::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

#voice-transcript-text::-webkit-scrollbar-track {
    background: transparent;
}

/* 準備中テキスト */
.voice-preparing-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    animation: voice-preparing-fade 0.8s ease-in-out infinite;
}

@keyframes voice-preparing-fade {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.3; }
}

/* ボケ→クリア アニメーション（AI解析中の演出）- 1文字ずつ適用 */
@keyframes char-blur-clear {
    0% {
        filter: blur(3px);
        opacity: 0.3;
    }
    100% {
        filter: blur(0px);
        opacity: 1;
    }
}

/* 文字単位でアニメーション適用 */
.transcript-char {
    display: inline-block;
    animation: char-blur-clear 0.6s ease-out both;
}

/* 入力中のカーソル（フェード＋グローの組み合わせ） */
.voice-input-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: white;
    margin-left: 3px;
    vertical-align: middle;
    transform: translateY(-2px);
    animation: cursor-fade-glow 1.5s ease-in-out infinite;
}

/* フェード＋グローアニメーション */
@keyframes cursor-fade-glow {
    0% {
        opacity: 0;
        box-shadow: 0 0 0px rgba(255, 255, 255, 0);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
    }
    100% {
        opacity: 0;
        box-shadow: 0 0 0px rgba(255, 255, 255, 0);
    }
}
