/* ベース */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    color: #371f1f;
    background-color: #fbf9f9;
    line-height: 1.6;
}

/* アプリケーション部分全体のレイアウト */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* サイドバー */
.sidebar {
    width: 260px;
    background-color: #241e1e;
    color: #f3f4f6;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #392d2d;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0.75rem;
}

.menu-section {
    margin-bottom: 2rem;
}

.menu-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #af9c9c;
    padding: 0 0.75rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    background-color: #9d2126;
    color: #ffffff;
    font-weight: 500;
}

.menu-item .icon {
    font-size: 1.1rem;
}

.menu-item .text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #392d2d;
    background-color: #1d1717;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.profile-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #ffffff;
}

.profile-status {
    font-size: 0.7rem;
    color: #af9c9c;
}

/* メインチャットエリア */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #ffffff;
    position: relative;
    min-width: 0;
}

.chat-header {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    border-bottom: 1px solid #ebe5e5;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    z-index: 10;
}

.chat-title-info h1 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #9d2126;
}


/* チャット履歴のコンテナ */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* メッセージ */
.message {
    display: flex;
    gap: 1.25rem;
    max-width: 850px;
    width: 100%;
    margin: 0 auto;
    min-width: 0;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    /* min-width = バグ対策 */
}

.message-content {
    padding: 1.25rem 1.5rem;
    border-radius: 16px;
    font-size: 0.975rem;
    line-height: 1.7;
    color: #371f1f;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

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

.user-message .message-wrapper {
    flex: 0 1 60%;
}

.user-message .message-content {
    background-color: #f6f3f3;
    border: 1px solid #ebe5e5;
}

.ai-message .message-content {
    box-shadow: none;
    padding: 0 2.5rem;
}

.message-content p {
    margin-bottom: 1rem;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content strong {
    color: #271111;
    font-weight: 600;
}


/* テーブルのスタイル */
.table-container {
    margin: 1.5rem 0;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #ebe5e5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    width: 100%;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.925rem;
    text-align: left;
    min-width: 500px;
}

.comparison-table th,
.comparison-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #ebe5e5;
}

.comparison-table thead th {
    background-color: #fcf8f8;
    color: #3b1e1e;
    font-weight: 700;
    border-bottom: 2px solid #f0e2e2;
}

.comparison-table tbody th {
    background-color: #fdfdfd;
    font-weight: 600;
    color: #553333;
    width: 20%;
    min-width: 120px;
}

.comparison-table tbody td {
    color: #694747;
}

.comparison-table tbody tr:last-child th,
.comparison-table tbody tr:last-child td {
    border-bottom: none;
}

/* 下部入力エリアのスタイル */
.chat-input-container {
    padding: 1.5rem 2rem 2rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #ffffff 40%);
    border-top: 1px solid rgba(229, 231, 235, 0.5);
    z-index: 5;
}

.input-wrapper {
    max-width: 850px;
    margin: 0 auto;
    display: flex;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 28px;
    padding: 0.5rem 1.25rem;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.75rem 0.5rem;
    outline: none;
    font-size: 0.95rem;
    color: #371f1f;
    font-family: inherit;
}

.input-wrapper input::placeholder {
    color: #af9c9c;
}

.send-button {
    background: none;
    border: none;
    color: #af9c9c;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-footer-note {
    text-align: center;
    font-size: 0.725rem;
    color: #af9c9c;
    margin-top: 0.75rem;
}

/* PCで見る人がほとんどなので不要のはずではあるが、一応レスポンシブ */

@media (max-width: 900px) {
    .sidebar {
        width: 80px;
    }

    .sidebar-header h2,
    .menu-section h3,
    .menu-item .text,
    .profile-info {
        display: none;
    }

    .menu-item {
        justify-content: center;
        padding: 0.85rem;
    }

    .sidebar-footer {
        justify-content: center;
    }

    .user-profile {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .sidebar {
        display: none;
        /* スマホ表示時は完全に非表示 */
    }

    .chat-header {
        padding: 0 1rem;
    }

    .chat-container {
        padding: 1rem 0.75rem;
        gap: 1.75rem;
    }

    .message {
        gap: 0rem;
    }

    .avatar {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .message-content {
        padding: 1rem 1rem;
        font-size: 0.925rem;
    }

    .ai-message .message-content {
        padding: 1rem 1rem;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 0.75rem 0.85rem;
    }

    .chat-input-container {
        padding: 1rem;
    }

    .input-wrapper {
        padding: 0.25rem 0.85rem;
    }

    .input-wrapper input {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}