/* ===== チャットコンテナ ===== */
.chat-container {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 180px);
  min-height: 500px;
  overflow: hidden;
  margin-bottom: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  position: relative;
}

/* グラデーション背景アクセント */
.chat-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

/* ===== チャットヘッダー ===== */
.chat-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--light-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.03) 100%);
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.chat-title i {
  font-size: 2rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: subtleFloat 3s ease-in-out infinite;
}

@keyframes subtleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.chat-title h1 {
  font-size: 1.6rem;
  margin: 0;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chat-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-outline-danger {
  color: var(--danger-color);
  border: 2px solid var(--danger-color);
  background-color: transparent;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-lg);
  font-weight: 600;
  transition: var(--transition);
}

.btn-outline-danger:hover {
  background: var(--danger-color);
  color: white;
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* ===== チャットメッセージエリア ===== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: 
    radial-gradient(circle at 10% 20%, rgba(102, 126, 234, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(118, 75, 162, 0.03) 0%, transparent 50%);
}

.chat-message {
  display: flex;
  gap: 1.25rem;
  max-width: 85%;
  animation: messageSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

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

/* ===== メッセージアバター ===== */
.message-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  position: relative;
}

.message-avatar::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: var(--gradient-primary);
  z-index: -1;
  opacity: 0;
  transition: var(--transition);
}

.chat-message:hover .message-avatar::before {
  opacity: 0.3;
  inset: -6px;
}

.user-message .message-avatar {
  background: var(--gradient-success);
}

.message-avatar i {
  color: white;
  font-size: 1.3rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* ===== メッセージコンテンツ ===== */
.message-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  flex: 1;
}

.message-text {
  padding: 1rem 1.5rem;
  border-radius: var(--radius-lg);
  position: relative;
  line-height: 1.6;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.message-text:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.user-message .message-text {
  background: var(--gradient-primary);
  color: white;
  border-top-right-radius: 8px;
}

.ai-message .message-text {
  background: white;
  color: var(--text-color);
  border-top-left-radius: 8px;
  border: 1px solid var(--light-tertiary);
}

.message-time {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  align-self: flex-end;
  margin-top: 0.25rem;
  font-weight: 500;
}

.user-message .message-time {
  align-self: flex-start;
}

/* ===== チャット入力エリア ===== */
.chat-input-area {
  border-top: 1px solid var(--light-tertiary);
  padding: 1.5rem;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.5), transparent);
}

.chat-input-wrapper {
  position: relative;
  display: flex;
  align-items: flex-end;
  background: white;
  border: 2px solid var(--light-tertiary);
  border-radius: var(--radius-xl);
  padding: 0.75rem;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.chat-input-wrapper:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), var(--shadow-md);
  transform: translateY(-2px);
}

.chat-input {
  flex: 1;
  padding: 0.6rem 1rem;
  font-size: 1rem;
  border: none;
  background-color: transparent;
  max-height: 150px;
  resize: none;
  color: var(--text-color);
  font-family: inherit;
  line-height: 1.5;
}

.chat-input:focus {
  outline: none;
}

.chat-input::placeholder {
  color: var(--text-tertiary);
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: 0.5rem;
}

.input-action-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  position: relative;
  overflow: hidden;
}

.input-action-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--light-secondary);
  opacity: 0;
  transition: var(--transition);
  transform: scale(0);
}

.input-action-btn:hover::before {
  opacity: 1;
  transform: scale(1);
}

.input-action-btn i {
  position: relative;
  z-index: 1;
}

.input-action-btn:hover {
  color: var(--primary-color);
  transform: scale(1.1);
}

.send-btn {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow);
}

.send-btn::before {
  background: rgba(255, 255, 255, 0.2);
}

.send-btn:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: var(--shadow-lg);
  color: white;
}

.send-btn:active {
  transform: scale(1.05);
}

.chat-input-info {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  padding: 0 1rem;
  font-weight: 500;
}

/* ===== タイピングインジケーター ===== */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  color: var(--primary-color);
  font-weight: 600;
  animation: messageSlideIn 0.3s ease-out;
}

.typing-indicator::before {
  content: '✨';
  margin-right: 0.5rem;
  animation: sparkle 1.5s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.typing-dots {
  display: inline-flex;
  margin-left: 0.5rem;
  gap: 0.25rem;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary-color);
  animation: typingBounce 1.4s infinite ease-in-out both;
}

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

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

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

/* ===== マークダウンスタイル ===== */
.markdown-body {
  line-height: 1.7;
  word-break: break-word;
}

.ai-message .markdown-body {
  color: var(--text-color);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin-top: 1.25em;
  margin-bottom: 0.6em;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-color);
}

.markdown-body h1 { 
  font-size: 1.6rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.markdown-body h2 { 
  font-size: 1.4rem;
}

.markdown-body h3 { 
  font-size: 1.2rem;
}

.markdown-body h4 { 
  font-size: 1.05rem;
}

.markdown-body p {
  margin-bottom: 1em;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 2em;
  margin-bottom: 1.2em;
}

.markdown-body li {
  margin-bottom: 0.4em;
}

.markdown-body li + li {
  margin-top: 0.3em;
}

.markdown-body blockquote {
  padding: 0.75rem 1.25rem;
  color: var(--text-secondary);
  border-left: 4px solid var(--primary-color);
  margin: 1em 0;
  background: var(--light-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
}

.markdown-body code {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Consolas', monospace;
  font-size: 0.9em;
  padding: 0.25em 0.5em;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  color: var(--primary-dark);
  font-weight: 600;
}

.markdown-body pre {
  margin: 1.2em 0;
  background: var(--dark-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  overflow: auto;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--dark-secondary);
  position: relative;
}

.markdown-body pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: var(--dark-secondary);
  border-bottom: 1px solid var(--dark-tertiary);
}

.markdown-body pre code {
  display: block;
  padding: 2rem 0 0 0;
  background: transparent;
  color: #e2e8f0;
  font-weight: 400;
  line-height: 1.6;
}

.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5em 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.markdown-body table th,
.markdown-body table td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--light-tertiary);
  text-align: left;
}

.markdown-body table th {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  font-weight: 700;
  color: var(--text-color);
}

.markdown-body table tr:hover {
  background: var(--light-secondary);
}

.markdown-body img {
  max-width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin: 1em 0;
}

.markdown-body hr {
  height: 2px;
  background: var(--gradient-primary);
  border: none;
  margin: 1.5em 0;
  border-radius: var(--radius-full);
}

.markdown-body a {
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: var(--transition-fast);
}

.markdown-body a:hover {
  border-bottom-color: var(--primary-color);
}

/* ===== ストリーミング効果 ===== */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 18px;
  background: var(--gradient-primary);
  margin-left: 3px;
  animation: blink 0.9s infinite;
  vertical-align: middle;
  border-radius: var(--radius-full);
}

/* ===== モーダル ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 32, 44, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-container {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 650px;
  max-height: 85vh;
  overflow: hidden;
  position: relative;
  z-index: 1;
  animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--light-tertiary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.modal-header h3 {
  margin: 0;
  font-weight: 700;
  font-size: 1.3rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--light-secondary);
  color: var(--danger-color);
  transform: rotate(90deg);
}

.modal-body {
  padding: 2rem;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--light-tertiary);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  background: var(--light-color);
}

/* ===== ファイルアップロード ===== */
.file-upload-area {
  border: 2px dashed var(--light-tertiary);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  transition: var(--transition);
  margin-bottom: 1.5rem;
  background: var(--light-color);
  position: relative;
  overflow: hidden;
}

.file-upload-area::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(102, 126, 234, 0.1);
  transform: translate(-50%, -50%);
  transition: var(--transition);
}

.file-upload-area:hover::before,
.file-upload-area.drag-over::before {
  width: 200%;
  height: 200%;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
  border-color: var(--primary-color);
  background: rgba(102, 126, 234, 0.05);
  transform: scale(1.02);
}

.file-input {
  display: none;
}

.file-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.file-upload-label i {
  font-size: 3.5rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: var(--transition);
}

.file-upload-area:hover .file-upload-label i {
  transform: scale(1.1);
}

.file-upload-hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: white;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  position: relative;
  box-shadow: var(--shadow);
  border: 1px solid var(--light-tertiary);
  transition: var(--transition);
}

.file-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.file-item i {
  font-size: 1.4rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.file-name {
  font-size: 0.95rem;
  font-weight: 600;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-color);
}

.file-remove {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  margin-left: 0.5rem;
  font-size: 1.1rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.file-remove:hover {
  background: var(--danger-color);
  color: white;
  transform: rotate(90deg);
}

/* ===== ウェルカムメッセージ ===== */
.welcome-message {
  text-align: center;
  padding: 3rem 2rem;
  animation: fadeInUp 0.6s ease-out;
}

.welcome-message .welcome-icon {
  font-size: 4rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
  display: inline-block;
  animation: subtleFloat 3s ease-in-out infinite;
}

.welcome-message h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-message p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.6;
}

/* ===== アニメーション ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* ===== レスポンシブ ===== */
@media (max-width: 768px) {
  .chat-container {
    height: calc(100vh - 140px);
    border-radius: var(--radius-lg);
  }
  
  .chat-header {
    padding: 1.25rem 1.5rem;
  }
  
  .chat-title h1 {
    font-size: 1.3rem;
  }
  
  .chat-title i {
    font-size: 1.6rem;
  }
  
  .chat-messages {
    padding: 1.5rem;
    gap: 1.25rem;
  }
  
  .chat-message {
    max-width: 92%;
  }
  
  .message-avatar {
    width: 38px;
    height: 38px;
  }
  
  .message-avatar i {
    font-size: 1.1rem;
  }
  
  .message-text {
    padding: 0.9rem 1.25rem;
  }
  
  .chat-input-area {
    padding: 1.25rem;
  }
  
  .input-action-btn {
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 480px) {
  .chat-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .chat-actions {
    align-self: flex-end;
  }
  
  .chat-messages {
    padding: 1rem;
  }
  
  .message-text {
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
  }
  
  .welcome-message {
    padding: 2rem 1rem;
  }
  
  .welcome-message .welcome-icon {
    font-size: 3rem;
  }
  
  .welcome-message h2 {
    font-size: 1.6rem;
  }
  
  .welcome-message p {
    font-size: 1rem;
  }
}

/* ===== 特殊効果 ===== */

/* ホバー時の輝き効果 */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.card-button:hover .card-icon,
.message-avatar:hover {
  position: relative;
}

.card-button:hover .card-icon::after,
.message-avatar:hover::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: shimmer 2s infinite;
}

/* スムーズなスクロール */
.chat-messages {
  scroll-behavior: smooth;
}

/* メッセージグループの間隔 */
.chat-message + .chat-message {
  margin-top: 0;
}

/* コードブロックのコピーボタン（将来の拡張用） */
.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--dark-secondary);
  border-radius: var(--radius) var(--radius) 0 0;
}

/* リアクションボタン（将来の拡張用） */
.message-reactions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.reaction-btn {
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--light-secondary);
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition-fast);
}

.reaction-btn:hover {
  background: var(--light-tertiary);
  transform: scale(1.1);
}

/* タイピングドット（改良版） */
.typing-dots::after {
  content: '';
  display: none;
}

.typing-dots {
  display: inline-flex !important;
}

/* ===== チャットレイアウト（サイドバー付き） ===== */
.chat-layout {
  display: flex;
  gap: 1.5rem;
  height: calc(100vh - 180px);
  min-height: 500px;
}

/* ===== チャットルームサイドバー ===== */
.chatroom-sidebar {
  width: 320px;
  min-width: 280px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  position: relative;
  transition: var(--transition);
}

/* グラデーション背景アクセント */
.chatroom-sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--light-tertiary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.03) 100%);
}

.sidebar-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.btn-icon-primary,
.btn-icon-secondary {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-icon-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow);
}

.btn-icon-primary:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: var(--shadow-lg);
}

.btn-icon-secondary {
  background: var(--light-secondary);
  color: var(--text-secondary);
  margin-right: 0.5rem;
}

.btn-icon-secondary:hover {
  background: var(--light-tertiary);
  color: var(--primary-color);
  transform: scale(1.05);
}

.sidebar-toggle {
  display: none;
}

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

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

.chatroom-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.chatroom-loading i {
  font-size: 2rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chatroom-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  background: white;
  border: 1px solid transparent;
}

.chatroom-item:hover {
  background: var(--light-secondary);
  border-color: var(--light-tertiary);
  transform: translateX(4px);
}

.chatroom-item.active {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.08) 100%);
  border-color: var(--primary-color);
  box-shadow: var(--shadow);
}

.chatroom-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: var(--gradient-primary);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.chatroom-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.chatroom-item:hover .chatroom-icon {
  transform: scale(1.1);
}

.chatroom-info {
  flex: 1;
  min-width: 0;
}

.chatroom-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-color);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chatroom-time {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.chatroom-actions {
  display: none;
  align-items: center;
  gap: 0.25rem;
}

.chatroom-item:hover .chatroom-actions {
  display: flex;
}

.chatroom-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
}

.chatroom-action-btn:hover {
  background: var(--light-tertiary);
  color: var(--primary-color);
  transform: scale(1.1);
}

.chatroom-action-btn.delete:hover {
  color: var(--danger-color);
}

/* チャットコンテナの調整 */
.chat-layout .chat-container {
  flex: 1;
  min-width: 0;
}

/* モーダルの追加スタイル */
.modal-sm .modal-container {
  max-width: 450px;
}

.text-danger {
  color: var(--danger-color);
}

/* ===== レスポンシブ（サイドバー対応） ===== */
@media (max-width: 1024px) {
  .chatroom-sidebar {
    width: 280px;
    min-width: 260px;
  }

  .chatroom-item {
    padding: 0.75rem 0.875rem;
  }

  .chatroom-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  .chat-layout {
    position: relative;
  }

  .chatroom-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    z-index: 10;
    transform: translateX(-100%);
  }

  .chatroom-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex !important;
  }

  .chat-layout .chat-container {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .chatroom-sidebar {
    width: 280px;
  }

  .chatroom-item {
    padding: 0.75rem;
  }

  .chatroom-name {
    font-size: 0.9rem;
  }
}
