* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: #f7f7f8;
    color: #353740;
    line-height: 1.6;
}

.container {
    max-width: 1200px; /* 幅を広げる */
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 10px 6px 10px; /* さらに上下余白を縮小 */
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%; /* 横幅を統一 */
    margin: 0 auto;
    border-radius: 0 0 10px 10px;
}

.header h1 {
    font-size: 1.5rem;
    margin-bottom: 2px;
    font-weight: 600;
}

.header p {
    opacity: 0.9;
    font-size: 0.85rem;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 0; /* フレックスボックスで高さを適切に計算 */
}

.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
}

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

.bot-message {
    justify-content: flex-start;
    position: relative;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background-color: #f1f3f4;
    color: #353740;
    border-bottom-left-radius: 4px;
    border: 1px solid #e1e3e4;
}

/* フィードバックボタンがあるボットメッセージの場合の調整 */
.bot-message .message-content.has-feedback {
    /* 特別な調整は不要 */
}

.message-content p {
    margin-bottom: 8px;
}

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

.sources {
    margin-top: 15px;
    padding: 12px;
    background-color: #f8f9fa;
    border-left: 4px solid #667eea;
    border-radius: 8px;
}

.sources h4 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 0.9rem;
    font-weight: 600;
}

.source-item {
    margin-bottom: 10px;
    padding: 8px;
    background-color: white;
    border-radius: 6px;
    border: 1px solid #e1e3e4;
    transition: all 0.3s ease;
}

.source-item:last-child {
    margin-bottom: 0;
}

.source-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.source-header {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.source-citation-number {
    background: #667eea;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    margin-right: 8px;
    display: inline-block;
    min-width: 24px;
    text-align: center;
}

.source-content {
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.4;
}

.source-url {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e1e3e4;
}

.source-url a {
    color: #667eea;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}

.source-url a:hover {
    text-decoration: underline;
}

.input-container {
    padding: 8px 12px;
    background-color: white;
    border-top: 1px solid #e1e3e4;
    flex-shrink: 0; /* フォーム部分のサイズを固定 */
}

/* フォーム全体の統一スタイル */
.form-section {
    margin-bottom: 10px;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    display: block;
    margin-bottom: 4px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background-color: #ffffff;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input::placeholder, .form-textarea::placeholder {
    color: #9ca3af;
}

.form-textarea {
    resize: vertical;
    min-height: 38px; /* 質問欄と同じ高さに調整 */
    height: 38px; /* 初期高さを明示的に設定 */
}

/* 補足情報テキストエリアの具体的な設定 */
#remarksInput {
    height: 38px !important;
    min-height: 38px !important;
}

/* 都道府県選択の個別調整 */
.prefecture-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.prefecture-selector .form-label {
    margin-bottom: 0;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 120px;
}

.prefecture-selector .form-select {
    flex: 1;
}

.required {
    color: #dc3545;
    font-weight: 600;
    margin-left: 5px;
}

/* 補足情報セクションの個別調整 */
.remarks-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.remarks-section .form-label {
    margin-bottom: 0;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 120px;
}

.remarks-section .form-textarea {
    flex: 1;
}

.char-count {
    display: none; /* 文字数カウント非表示 */
}

/* 質問入力セクション */
.question-section {
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.question-section .form-label {
    margin-bottom: 0;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 120px;
}

.question-section.clickable {
    cursor: pointer;
    border: 2px dashed #e1e3e4;
    border-radius: 8px;
    padding: 10px;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
}

.question-section.clickable:hover {
    border-color: #667eea;
    background-color: #f0f2ff;
}

.question-section .input-wrapper {
    flex: 1;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

#questionInput {
    flex: 1;
}

#sendButton {
    background-color: #667eea;
    border: 2px solid #667eea;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
    flex-shrink: 0;
}

#sendButton:hover {
    background-color: #5a67d8;
    border-color: #5a67d8;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#sendButton:active {
    transform: translateY(1px);
}

#sendButton:disabled {
    background-color: #9ca3af;
    border-color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

.loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #9ca3af;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

/* スクロールバーのスタイル */
.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track {
    background: #f1f3f4;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #c1c5c9;
    border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: #a1a5a9;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .header {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    /* モバイルでのフィードバックボタン調整 */
    .feedback-buttons {
        gap: 4px;
        margin-top: 8px;
        padding-top: 6px;
    }
    
    .feedback-btn {
        padding: 3px 6px;
        font-size: 0.6rem;
    }
}

/* 法令名リンクのスタイル */
.source-header a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.source-header a:hover {
    color: #45a049;
    text-decoration: underline;
}

/* 詳細情報ボタンのスタイル */
.debug-info button {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 10px;
    transition: background-color 0.2s ease;
}

.debug-info button:hover {
    background-color: #5a6268;
}

/* 引用番号のスタイル */
.source-citation-number {
    color: #007bff;
    font-weight: bold;
    margin-right: 8px;
}

.citation-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin: 0 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    vertical-align: super;
    line-height: 1;
}

.citation-number:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* リンクアイコンのスタイル */
.source-header span:has(+ span:contains('🔗')) {
    font-size: 12px;
    color: #666;
    margin-left: 4px;
}

/* モデル選択エリア */
.model-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.model-selector .form-label {
    margin-bottom: 0;
    white-space: nowrap;
    min-width: 100px;
}

.model-selector .form-select {
    flex: 1;
}

/* デバッグモード選択エリア */
.debug-mode-selector {
    margin-bottom: 8px;
    padding: 4px 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.debug-mode-selector label {
    font-size: 12px;
    font-weight: 400;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    margin: 0;
}

.debug-mode-selector input[type="checkbox"] {
    margin-right: 6px;
    transform: scale(0.9);
}

/* デバッグ情報表示エリア */
.debug-info {
    margin-top: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.debug-info h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    user-select: none;
}

.debug-info h4:hover {
    color: #007bff;
}

.debug-content {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
}

.debug-content > div {
    margin-bottom: 8px;
}

.debug-content strong {
    color: #495057;
}

.debug-content small {
    font-size: 11px;
}

/* 全検索結果の表示 */
.debug-content .all-docs-title {
    font-weight: bold;
    cursor: pointer;
    margin: 10px 0 5px 0;
    color: #007bff;
    user-select: none;
}

.debug-content .all-docs-title:hover {
    text-decoration: underline;
}

/* フィードバックボタンのスタイル */
.feedback-buttons {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #e9ecef;
}

.feedback-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 16px;
    background-color: white;
    color: #495057;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.feedback-btn:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.feedback-btn:active {
    transform: translateY(0);
}

.feedback-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.good-btn:hover:not(:disabled) {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.bad-btn:hover:not(:disabled) {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
} 

/* 画像表示用のスタイル */
.source-images {
    margin-top: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.source-images h5 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 14px;
}

.image-container {
    display: inline-block;
    margin: 5px;
    text-align: center;
    vertical-align: top;
}

.source-image {
    max-width: 200px;
    max-height: 150px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.source-image:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.image-caption {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

/* 画像モーダル */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.image-modal-content {
    position: relative;
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
}

.image-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
}

.image-modal-close:hover {
    color: #000;
}

.modal-image {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 4px;
}

.modal-caption {
    text-align: center;
    margin-top: 10px;
    font-weight: bold;
    color: #495057;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .source-image {
        max-width: 150px;
        max-height: 100px;
    }
    
    .image-modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
        max-height: calc(100% - 20px);
    }
} 

/* 全データ削除ボタン用 */
.card-actions.danger-zone {
  margin-top: 24px;
  text-align: right;
}
.danger-btn {
  background: #e74c3c;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.danger-btn:hover {
  background: #c0392b;
} 

/* モデル選択チェックボックス */
/* モデルドロップダウンコンテナ */
.model-dropdown-container {
    position: relative;
    margin-bottom: 10px;
}

/* モデルドロップダウン */
.model-dropdown {
    position: relative;
    display: inline-block;
    width: 100%;
    min-width: 200px;
}

/* ドロップダウンボタン */
.model-dropdown-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
    width: 100%;
    min-width: 200px;
    box-sizing: border-box;
}

.model-dropdown-button:hover {
    border-color: #adb5bd;
    background-color: #f8f9fa;
}

.model-dropdown-button.active {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.model-dropdown-text {
    color: #495057;
    font-size: 14px;
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-dropdown-arrow {
    color: #6c757d;
    transition: transform 0.2s ease;
}

.model-dropdown-button.active .model-dropdown-arrow {
    transform: rotate(180deg);
}

/* ドロップダウンメニュー */
.model-dropdown-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    margin-bottom: 2px;
}

.model-dropdown-menu.show {
    display: block;
}

/* ドロップダウンアイテム */
.model-dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f1f3f4;
}

.model-dropdown-item:last-child {
    border-bottom: none;
}

.model-dropdown-item:hover {
    background-color: #f8f9fa;
}

.model-dropdown-item input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.1);
}

.model-dropdown-item label {
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    margin: 0;
    flex: 1;
}

/* 選択されたモデル表示エリア */
.selected-models-display {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 20px;
}

.selected-model-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background-color: #007bff;
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.selected-model-tag .remove-model {
    margin-left: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    line-height: 1;
}

.selected-model-tag .remove-model:hover {
    opacity: 0.8;
}

.model-selection-info {
    margin-top: 5px;
    color: #6c757d;
    font-size: 12px;
}

/* 複数モデル回答の表示 */
.multi-model-answers {
    margin-top: 20px;
}

.model-answer-section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background-color: #f8f9fa;
}

.model-answer-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #dee2e6;
}

.model-answer-title {
    font-size: 18px;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.model-provider-badge {
    margin-left: 10px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.model-provider-badge.openai {
    background-color: #10a37f;
    color: white;
}

.model-provider-badge.gemini {
    background-color: #4285f4;
    color: white;
}

.model-answer-content {
    margin-bottom: 15px;
}

.model-answer-content p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.model-sources-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.model-sources-title {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
}

/* 既存のスタイルとの調整 */
.model-selector .form-label {
    margin-bottom: 10px;
} 