/* ==========================================================================
   LIVE配信研究所 - インタラクティブ機能CSS
   AIチャットボット、ツールモーダル、フォーム
   ========================================================================== */

/* ==========================================================================
   AIチャットボット（#ai-chatbot, .chatbot-float-btn）
   ========================================================================== */

/* フローティングAIボタン */
.chatbot-float-btn {
    position: fixed;
    top: 80px;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.3), 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1003;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.chatbot-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(255, 107, 107, 0.4), 0 6px 25px rgba(0, 0, 0, 0.4);
}

/* PC版でのフローティングチャットボットボタン非表示 */
@media (min-width: 769px) {
    .chatbot-float-btn {
        display: none !important;
    }
}

/* AIチャットボット本体 */
.ai-chatbot {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(20px);
    border: none;
    border-radius: 0;
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.2);
    z-index: 1002;
    transform: translateY(-20px) scale(0.8);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* PC版でのチャットボットウィンドウ */
@media (min-width: 769px) {
    .ai-chatbot {
        top: auto;
        left: auto;
        bottom: 2rem;
        right: 2rem;
        width: 400px;
        height: 600px;
        border-radius: 20px;
        border: 2px solid #FF6B6B;
        box-shadow: 0 10px 40px rgba(255, 107, 107, 0.3), 0 10px 40px rgba(0, 0, 0, 0.3);
        transform: translateY(20px) scale(0.9);
    }
    
    .ai-chatbot.active {
        transform: translateY(0) scale(1);
    }
}

.ai-chatbot.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

.chatbot-header {
    padding: 1rem;
    border-bottom: 1px solid #FF6B6B;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(78, 205, 196, 0.1));
    flex-shrink: 0;
}

/* PC版でのチャットボットヘッダー */
@media (min-width: 769px) {
    .chatbot-header {
        padding: 1.2rem;
        border-radius: 18px 18px 0 0;
    }
}

.ai-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.3);
}

.chatbot-title h3 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
    color: #FF6B6B;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.3);
}

.status-indicator {
    font-size: 0.8rem;
    color: #4ECDC4;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.3);
}

.chatbot-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #FF6B6B;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chatbot-close:hover {
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
    transform: scale(1.1);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: rgba(10, 10, 26, 0.3);
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.message {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ai-message .message-content {
    background: rgba(78, 205, 196, 0.1);
    border: 1px solid #4ECDC4;
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.2);
}

.user-message {
    justify-content: flex-end;
}

.user-message .message-content {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid #FF6B6B;
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.2);
}

.message-content {
    padding: 0.8rem;
    border-radius: 15px;
    max-width: 250px;
    word-wrap: break-word;
    color: #FFFFFF;
}

/* PC版でのメッセージサイズ */
@media (min-width: 769px) {
    .message-content {
        max-width: 320px;
        padding: 1rem;
    }
}

.chatbot-input-container {
    border-top: 1px solid #FF6B6B;
    background: rgba(10, 10, 26, 0.5);
    flex-shrink: 0;
}

.chatbot-input {
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
    position: sticky;
    bottom: 0;
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(15px);
    border-top: 1px solid rgba(255, 107, 107, 0.3);
}

/* PC版でのチャットボット入力エリア */
@media (min-width: 769px) {
    .chatbot-input {
        padding: 1.2rem;
        border-radius: 0 0 18px 18px;
        border-top: 1px solid rgba(255, 107, 107, 0.3);
    }
}

.chatbot-input input,
.chatbot-input textarea {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #4ECDC4;
    border-radius: 10px;
    padding: 0.5rem;
    color: #FFFFFF;
    transition: all 0.3s ease;
    font-size: 16px;
    -webkit-appearance: none;
    font-family: inherit;
}

.chatbot-input input:focus {
    outline: none;
    border-color: #FF6B6B;
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.3);
}

.chatbot-input button {
    background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
    border: none;
    border-radius: 10px;
    padding: 0.5rem 1rem;
    color: #FFFFFF;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.3);
    transition: all 0.3s ease;
}

.chatbot-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.3);
}

/* チャットボットの選択肢スタイル */
.chatbot-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    width: 100%;
}

.chatbot-option-btn {
    background: rgba(78, 205, 196, 0.1);
    border: 1px solid #4ECDC4;
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.2);
    color: #FFFFFF;
    padding: 0.6rem 0.8rem;
    border-radius: 15px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    font-family: inherit;
}

/* PC版でのチャットボット選択肢ボタン */
@media (min-width: 769px) {
    .chatbot-option-btn {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
        border-radius: 12px;
    }
}

.chatbot-option-btn:hover {
    background: rgba(78, 205, 196, 0.2);
    border-color: #FF6B6B;
    transform: translateY(-2px);
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.3);
}

/* ==========================================================================
   ツールモーダル（.tool-modal）
   ========================================================================== */

.tool-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tool-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 107, 107, 0.2);
}

.modal-header h3 {
    margin: 0;
    color: #2C3E50;
    font-size: 1.5rem;
}

.modal-close {
    background: rgba(255, 107, 107, 0.1);
    border: 2px solid #FF6B6B;
    font-size: 1.5rem;
    color: #FF6B6B;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    z-index: 1000;
    position: relative;
}

.modal-close:hover {
    background: #FF6B6B;
    color: white;
    transform: scale(1.1);
}

/* スマホ版でのモーダル閉じるボタンの改善 */
@media (max-width: 768px) {
    .modal-close {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
        top: 10px;
        right: 10px;
        position: absolute;
        z-index: 1001;
    }
    
    .modal-header {
        padding-top: 2rem;
    }
}

/* 計算・最適化結果の表示改善 */
.calculation-result, .schedule-result {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 77, 159, 0.3);
    animation: resultFadeIn 0.5s ease;
}

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

/* ボタンのホバー効果改善 */
.calculate-btn:hover, .optimize-btn:hover {
    background: #e91e63 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 77, 159, 0.4) !important;
}

.modal-body {
    padding: 2rem;
}

.tool-content h4 {
    color: #2C3E50;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2C3E50;
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #FF6B6B;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

/* ツール計算ボタン */
.calculate-btn,
.optimize-btn {
    background: #ff4d9f;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 15px;
    cursor: pointer;
    width: 100%;
    margin-bottom: 1rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 15px rgba(255, 77, 159, 0.3);
    transition: all 0.3s ease;
    font-size: 1rem;
    min-height: 48px;
}

.calculate-btn:hover,
.optimize-btn:hover {
    background: #e91e63;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 77, 159, 0.4);
}

/* 計算結果エリア */
.calculation-result,
.schedule-result {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: #2d3748;
    border-radius: 15px;
    border: 1px solid #ff4d9f;
    color: white;
    animation: resultFadeIn 0.5s ease;
}

/* 免責事項 */
.disclaimer {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #ffc107;
    border-radius: 5px;
}

.disclaimer h6 {
    margin: 0 0 0.5rem 0;
    color: #ffc107;
    font-size: 0.9rem;
}

.disclaimer p {
    margin: 0;
    font-size: 0.8rem;
    color: #888;
    line-height: 1.4;
}

/* 結果フェードインアニメーション */
@keyframes resultFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   モバイル専用調整
   ========================================================================== */

@media (max-width: 768px) {
    .chatbot-float-btn {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    .ai-chatbot {
        width: 90vw;
        top: 90px;
        left: 50%;
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
        transform: translateX(-50%) scale(0.9);
        right: auto;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    .ai-chatbot.active {
        transform: translateX(-50%) scale(1);
    }
    
    .chatbot-messages {
        height: auto !important;
        max-height: calc(100vh - 180px) !important;
    }
    
    .message-content {
        max-width: 220px !important;
        font-size: 0.9rem !important;
        padding: 0.6rem !important;
    }
    
    .chatbot-input {
        padding: 0.8rem !important;
        position: sticky !important;
        bottom: 0 !important;
        background: rgba(10, 10, 26, 0.95) !important;
        backdrop-filter: blur(10px) !important;
    }
    
    .chatbot-input input {
        font-size: 0.9rem !important;
        padding: 0.6rem !important;
        border-radius: 8px !important;
        min-height: 44px !important;
        touch-action: manipulation !important;
    }
    
    .chatbot-input button {
        padding: 0.6rem 1rem !important;
        font-size: 0.9rem !important;
        min-height: 44px !important;
        touch-action: manipulation !important;
    }
    
    /* モーダル調整 */
    .modal-content {
        width: 98%;
        max-width: 98%;
        max-height: 85vh;
        margin: 1vh auto;
        border-radius: 15px;
    }
    
    .modal-header {
        padding: 1rem 1.5rem;
        border-bottom: 1px solid rgba(255, 107, 107, 0.2);
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
        margin: 0;
    }
    
    .modal-body {
        padding: 1rem 1.5rem;
        max-height: calc(85vh - 120px);
        overflow-y: auto;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.3rem;
        display: block;
    }
    
    .form-group input,
    .form-group select {
        font-size: 16px; /* iOS自動ズーム防止 */
        padding: 0.8rem;
        border: 1px solid #ddd;
        border-radius: 8px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .calculate-btn,
    .optimize-btn {
        padding: 1rem;
        font-size: 1rem;
        border-radius: 12px;
        margin-bottom: 1rem;
        min-height: 48px;
        touch-action: manipulation;
    }
    
    /* 結果表示エリアの調整 */
    .calculation-result,
    .schedule-result {
        margin-top: 1rem;
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    /* 注意事項の調整 */
    .disclaimer {
        margin-top: 1rem;
        padding: 0.8rem;
        font-size: 0.8rem;
    }
}

/* 超小型デバイス用の追加調整 */
@media (max-width: 375px) {
    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .modal-header {
        padding: 0.8rem 1rem;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .modal-body {
        padding: 0.8rem 1rem;
    }
    
    .form-group input,
    .form-group select {
        padding: 0.7rem;
        font-size: 15px;
    }
    
    .calculate-btn,
    .optimize-btn {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
}

/* キーボード表示時の調整 */
@media (max-height: 600px) {
    .ai-chatbot {
        height: 100vh;
        width: 100vw;
    }
    
    .chatbot-messages {
        flex: 1;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }
    
    .chatbot-input {
        position: sticky;
        bottom: 0;
        background: rgba(10, 10, 26, 0.98);
        backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 107, 107, 0.5);
    }
    
    .chatbot-input input,
    .chatbot-input textarea {
        font-size: 16px;
        -webkit-appearance: none;
        font-family: inherit;
    }
}
