/* Chat Form Section */
.chat-form-section {
  background: linear-gradient(135deg, #0a0a0a 0%, #141414 100%);
  padding: 1rem 0 0.5rem 0; /* パディングをさらに削減 */
  margin-top: 80px; /* ヘッダーの高さ分のマージン */
  border-bottom: 1px solid #374151;
  min-height: calc(100vh - 80px); /* ファーストビューに収める */
  display: flex;
  align-items: center;
}

.chat-form-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
  width: 100%;
}

.chat-form-header {
  text-align: center;
  margin-bottom: 1rem;
}

.chat-form-title {
  font-size: 48px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.25rem;
  background: linear-gradient(135deg, #f97316, #ea580c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.3;
  text-align: center;
  font-family: __Figtree_6babd9, __Figtree_Fallback_6babd9, sans-serif;
}

.chat-form-subtitle {
  font-size: 0.875rem; /* フォントサイズをさらに削減 */
  color: #9ca3af;
  line-height: 1.3; /* 行間をさらに削減 */
  font-family: __Figtree_6babd9, __Figtree_Fallback_6babd9, sans-serif;
}

.chat-container {
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid #374151;
  border-radius: 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  height: calc(67vh - 80px); /* ファーストビューの2/3からヘッダー分を引く */
  min-height: 400px; /* 最小高さを設定 */
  max-height: 600px; /* 最大高さを設定 */
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  padding: 1rem; /* パディングを削減 */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem; /* ギャップを削減 */
  scroll-behavior: smooth;
  min-height: 200px; /* 最小高さを設定 */
}

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

.chat-messages::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #4b5563;
}

.message {
  display: flex;
  gap: 0.5rem; /* ギャップを削減 */
  max-width: 85%; /* 余白を減らして幅を広げる */
  animation: fadeInUp 0.3s ease-out;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.ai {
  align-self: flex-start;
}

.message-avatar {
  width: 36px; /* サイズを削減 */
  height: 36px; /* サイズを削減 */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.6rem; /* フォントサイズをさらに削減 */
  font-weight: 600;
  text-align: center;
  line-height: 1;
}

.message.user .message-avatar {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #ffffff;
}

.message.ai .message-avatar {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #ffffff;
}

.message-content {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 0.75rem 1rem; /* パディングを削減 */
  color: #ffffff;
  line-height: 1.4; /* 行間を削減 */
  word-wrap: break-word;
  flex: 1; /* コンテンツを最大幅まで広げる */
  font-size: 0.9rem; /* フォントサイズを追加 */
}

.message.user .message-content {
  background: linear-gradient(135deg, #f97316, #ea580c);
  border-color: #f97316;
}

.message.ai .message-content {
  background: rgba(59, 130, 246, 0.1);
  border-color: #3b82f6;
}

.chat-input-container {
  padding: 1rem; /* パディングを削減 */
  border-top: 1px solid #374151;
  background: rgba(0, 0, 0, 0.3);
}

.chat-input-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.chat-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 0.5rem 0.75rem; /* パディングを削減 */
  color: #ffffff;
  font-size: 1rem; /* フォントサイズを削減 */
  resize: none;
  min-height: 40px; /* 高さを削減 */
  max-height: 100px; /* 最大高さを削減 */
  transition: all 0.3s ease;
}

.chat-input:focus {
  outline: none;
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.chat-input::placeholder {
  color: #6b7280;
}

.chat-send-button {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
}

.chat-send-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(249, 115, 22, 0.3);
}

.chat-send-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.send-icon {
  width: 20px;
  height: 20px;
  color: white;
  transition: transform 0.2s ease;
}

/* 改良されたタイピングインジケーター */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 85%;
  animation: fadeInUp 0.3s ease-out;
}

.typing-indicator .message-avatar {
  width: 36px; /* サイズを削減 */
  height: 36px; /* サイズを削減 */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.6rem; /* フォントサイズをさらに削減 */
  font-weight: 600;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #ffffff;
  text-align: center;
  line-height: 1;
}

.typing-indicator .message-content {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid #3b82f6;
  border-radius: 12px;
  padding: 0.75rem 1rem; /* パディングを削減 */
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.typing-dots {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #3b82f6;
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
}

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

.typing-text {
  color: #9ca3af;
  font-size: 0.8rem; /* フォントサイズを削減 */
  margin-left: 0.5rem;
}

@keyframes typingDot {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

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

/* 送信中のボタンアニメーション */
.chat-send-button.sending {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  cursor: not-allowed;
  animation: pulse 1.5s infinite;
}

.chat-send-button.sending .send-icon {
  animation: rotate 1s linear infinite;
}

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

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.welcome-message {
  text-align: center;
  color: #9ca3af;
  font-size: 0.8rem; /* フォントサイズを削減 */
  padding: 1rem 0.75rem; /* パディングをさらに削減 */
  border: 1px dashed #374151;
  border-radius: 8px;
  margin: 0.25rem 0; /* マージンをさらに削減 */
}

.welcome-message p {
  margin: 0.2rem 0; /* 段落間のマージンを削減 */
}

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

.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #ef4444;
  color: #ef4444;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin: 0.5rem 0;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .chat-form-section {
    padding: 1rem 0 0.5rem 0;
    margin-top: 70px;
    min-height: calc(100vh - 70px);
  }
  
  .chat-form-title {
    font-size: 36px;
  }
  
  .animated-text {
    font-size: 20px;
  }
  
  .chat-form-subtitle {
    font-size: 0.8rem;
  }
  
  .chat-container {
    height: calc(67vh - 70px);
    min-height: 350px;
    max-height: 500px;
  }
  
  .message {
    max-width: 90%;
  }
  
  .chat-messages {
    padding: 0.75rem;
  }
  
  .chat-input-container {
    padding: 0.75rem;
  }
  
  .message-content {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .chat-form-section {
    margin-top: 60px;
    padding: 0.75rem 0 0.25rem 0;
    min-height: calc(100vh - 60px);
  }
  
  .chat-form-title {
    font-size: 36px;
  }
  
  .animated-text {
    font-size: 18px;
  }
  
  .chat-form-subtitle {
    font-size: 0.75rem;
  }
  
  .chat-container {
    height: calc(67vh - 60px);
    min-height: 320px;
    max-height: 450px;
  }
  
  .message {
    max-width: 95%;
  }
  
  .chat-form-header {
    margin-bottom: 0.75rem;
  }
  
  .chat-messages {
    padding: 0.5rem;
  }
  
  .chat-input-container {
    padding: 0.5rem;
  }
  
  .message-content {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
  }
  
  .message-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.55rem;
  }
}

/* ファイルアップロード関連のスタイル */
.file-button {
  background: #6b7280;
  border: none;
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
}

.file-button:hover {
  background: #4b5563;
  transform: translateY(-1px);
}

.file-icon {
  width: 20px;
  height: 20px;
  color: white;
}

.file-preview {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  max-height: 120px;
  overflow-y: auto;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

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

.file-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.file-name {
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  color: #6b7280;
  font-size: 0.75rem;
}

.file-remove {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.75rem;
  transition: background 0.2s ease;
}

.file-remove:hover {
  background: #dc2626;
}

.file-message {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.file-message .file-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-message .file-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-message .file-icon-small {
  width: 16px;
  height: 16px;
  color: #6b7280;
}

.file-message .file-name {
  font-size: 0.875rem;
  color: #374151;
}

.animated-text {
  display: block;
  font-size: 22px;
  font-weight: bold;
  color: #ffffff;
  background: none;
  -webkit-text-fill-color: #ffffff;
  animation: slideUpFromBottom 0.5s ease-in-out;
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
  text-align: center;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
  min-height: 1.5rem;
  font-family: __Figtree_6babd9, __Figtree_Fallback_6babd9, sans-serif;
}

.animated-word {
  display: inline-block;
  color: #f97316;
  background: linear-gradient(135deg, #f97316, #ea580c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: slideUp 0.5s ease-in-out;
  min-width: 120px;
  text-align: left;
  transition: opacity 0.25s ease-in-out, transform 0.25s ease-in-out;
}

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

@keyframes slideUpFromBottom {
  0% {
    opacity: 0;
    transform: translateY(15px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
} 