/* ========================================
   グローバルスタイル
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* カラーパレット */
    --primary-color: #1e3a5f;
    --primary-light: #2d4a6f;
    --secondary-color: #FF6B35;
    --bot-bg: #f0f2f5;
    --user-bg: #FF6B35;
    --white: #FFFFFF;
    --text-dark: #2c2c2c;
    --text-gray: #6b6b6b;
    --border-color: #e5e5e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ========================================
   チャットコンテナ
======================================== */
.chat-container {
    width: 100%;
    max-width: 600px;
    height: 80vh;
    min-height: 600px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ========================================
   ヘッダー
======================================== */
.chat-header {
    background: var(--primary-color);
    color: var(--white);
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.bot-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.bot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-info {
    flex: 1;
}

.bot-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.bot-status {
    font-size: 0.85rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   メッセージエリア
======================================== */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f9fafb;
}

.messages-area::-webkit-scrollbar {
    width: 6px;
}

.messages-area::-webkit-scrollbar-track {
    background: transparent;
}

.messages-area::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* メッセージ */
.message {
    display: flex;
    gap: 10px;
    animation: messageSlide 0.3s ease-out;
}

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

.message.bot {
    align-items: flex-start;
}

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

.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message.user .message-avatar {
    background: var(--secondary-color);
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.bot .message-bubble {
    background: var(--white);
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message.user .message-bubble {
    background: var(--user-bg);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

/* ========================================
   オプションボタン
======================================== */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    max-width: 80%;
}

/* 都道府県選択用の3列表示 */
.options-container.two-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 95%;
}

.options-container.two-columns .option-button {
    text-align: center;
    padding: 10px 8px;
    font-size: 0.85rem;
}

.option-button {
    background: var(--white);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.option-button:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: translateX(5px);
}

.option-button:active {
    transform: scale(0.98);
}

/* ========================================
   入力エリア
======================================== */
.input-area {
    padding: 20px;
    background: var(--white);
    border-top: 1px solid var(--border-color);
}

.input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-field {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s;
}

.input-field::placeholder {
    color: #999;
    opacity: 1;
    font-size: 0.9rem;
}

.input-field:focus {
    border-color: var(--primary-color);
}

.send-button {
    width: 45px;
    height: 45px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.2rem;
}

.send-button:hover {
    background: var(--primary-light);
    transform: scale(1.05);
}

.send-button:active {
    transform: scale(0.95);
}

/* ========================================
   タイピングインジケーター
======================================== */
.typing-indicator {
    padding: 10px 20px;
    display: flex;
    gap: 5px;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-gray);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   チェックボックスリスト
======================================== */
.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    max-width: 80%;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.checkbox-item:hover {
    border-color: var(--primary-color);
    background: #f8f9fa;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-item label {
    flex: 1;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-item.checked {
    border-color: var(--primary-color);
    background: #e3f2fd;
}

.submit-button {
    margin-top: 15px;
    padding: 14px 30px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.submit-button:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
}

.submit-button:active {
    transform: translateY(0);
}

.submit-button:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   レスポンシブ
======================================== */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .chat-container {
        max-width: 100%;
        height: 100vh;
        min-height: 100vh;
        border-radius: 0;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .options-container,
    .checkbox-list {
        max-width: 90%;
    }
}
