/* AI Chat Entry - PUB-001 */
.ai-chat-entry {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 60px 20px 100px;
  position: relative;
  z-index: 10;
}
.ai-chat-entry__glow {
  position: relative;
  width: 100%;
  max-width: 600px;
  padding: 3px;
  border-radius: 52px;
  background: conic-gradient(
    from var(--entry-angle, 0deg),
    #c084fc, #a78bfa, #818cf8, #7c3aed, #a855f7, #c084fc
  );
  animation: entry-glow-spin 3s linear infinite;
}
.ai-chat-entry__glow::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 58px;
  background: conic-gradient(
    from var(--entry-angle, 0deg),
    transparent 25%, rgba(167, 139, 250, 0.3) 50%, transparent 75%
  );
  filter: blur(14px);
  animation: entry-glow-spin 3s linear infinite;
  z-index: -1;
}
@property --entry-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes entry-glow-spin {
  to { --entry-angle: 360deg; }
}
.ai-chat-entry__inner {
  display: flex;
  align-items: center;
  width: 100%;
  background: #fff;
  border: none;
  border-radius: 50px;
  padding: 6px 6px 6px 24px;
  transition: box-shadow 0.3s ease;
}
.ai-chat-entry__glow:focus-within {
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.35);
}
.ai-chat-entry__input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #1a1a1a;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.5;
  padding: 10px 0;
}
.ai-chat-entry__input::placeholder {
  color: rgba(0, 0, 0, 0.35);
}
.ai-chat-entry__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #a855f7;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease;
}
.ai-chat-entry__btn svg {
  flex-shrink: 0;
  min-width: 18px;
}
.ai-chat-entry__btn:hover {
  background: #9333ea;
  color: #fff;
}
/* Responsive - Entry */
@media (max-width: 767px) {
  .ai-chat-entry {
    padding: 40px 16px;
  }
  .ai-chat-entry__inner {
    max-width: 100%;
    padding-left: 18px;
  }
  .ai-chat-entry__input {
    font-size: 16px;
  }
}

/* ===========================================
   AI Chat Modal - PUB-002
   =========================================== */
.ai-chat-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-chat-modal[aria-hidden="true"] {
  display: none;
}
.ai-chat-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.ai-chat-modal__container {
  position: relative;
  display: flex;
  flex-direction: row;
  width: 100%;
  max-width: 960px;
  height: 80vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  z-index: 1;
}
.ai-chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.ai-chat-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}
.ai-chat-modal__title {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
}
.ai-chat-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.ai-chat-modal__close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.8);
}
.ai-chat-modal__body {
  flex: 1 1 0;
  height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
}
.ai-chat-modal__footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

/* ===========================================
   Modal Inner Layout - PUB-003
   =========================================== */

/* Body - scrollable message area */
.ai-chat-modal__body {
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}
.ai-chat-modal__body::-webkit-scrollbar {
  width: 5px;
}
.ai-chat-modal__body::-webkit-scrollbar-track {
  background: transparent;
}
.ai-chat-modal__body::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 3px;
}

/* Messages (dummy for PUB-003, refined in PUB-004) */
.ai-chat-msg {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}
.ai-chat-msg--user {
  align-items: flex-end;
}
.ai-chat-msg--ai {
  align-items: flex-start;
}
.ai-chat-msg__bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.ai-chat-msg--user .ai-chat-msg__bubble {
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-chat-msg--ai .ai-chat-msg__bubble {
  background: #f3f4f6;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}
.ai-chat-msg__time {
  font-size: 11px;
  color: rgba(0,0,0,0.35);
  margin-top: 4px;
  padding-right: 4px;
}
/* Model badge */
.ai-chat-msg__badge {
  font-size: 11px;
  color: rgba(0,0,0,0.4);
  margin-bottom: 4px;
  padding-left: 4px;
}
/* Consecutive messages - reduced gap */
.ai-chat-msg--consecutive {
  margin-top: -6px;
}
.ai-chat-msg--consecutive .ai-chat-msg__badge {
  display: none;
}

/* ===========================================
   Typing Indicator + Streaming Cursor - PUB-006
   =========================================== */

/* Typing indicator (●●●) */
.ai-chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #f3f4f6;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.ai-chat-typing__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  animation: ai-chat-typing-bounce 1.4s infinite ease-in-out both;
}
.ai-chat-typing__dot:nth-child(1) { animation-delay: 0s; }
.ai-chat-typing__dot:nth-child(2) { animation-delay: 0.16s; }
.ai-chat-typing__dot:nth-child(3) { animation-delay: 0.32s; }

@keyframes ai-chat-typing-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Streaming cursor (█) */
.ai-chat-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #1a1a1a;
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: ai-chat-cursor-blink 0.5s step-end infinite alternate;
}

@keyframes ai-chat-cursor-blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
}

/* ===========================================
   Welcome Screen - PUB-005
   =========================================== */
.ai-chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 32px 16px 16px;
}
.ai-chat-welcome__intro {
  text-align: center;
}
.ai-chat-welcome__logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-chat-welcome__title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
}
.ai-chat-welcome__desc {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
}
.ai-chat-welcome__specs {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f8f9fa;
  border-radius: 12px;
  padding: 14px 16px;
}
.ai-chat-welcome__spec {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.ai-chat-welcome__spec-icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.ai-chat-welcome__spec-label {
  color: #6b7280;
  min-width: 85px;
  flex-shrink: 0;
}
.ai-chat-welcome__spec-value {
  color: #1a1a1a;
  font-weight: 500;
}
.ai-chat-welcome__greeting {
  font-size: 14px;
  color: #374151;
  text-align: center;
}
.ai-chat-welcome__suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.ai-chat-welcome__chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 20px;
  background: #fff;
  color: #1a1a1a;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.ai-chat-welcome__chip:hover {
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.3);
  color: #2563eb;
}

/* Compose area (footer input) */
.ai-chat-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.ai-chat-compose__input {
  flex: 1;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  outline: none;
  background: #fff;
  color: #1a1a1a;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.2s ease;
}
.ai-chat-compose__input:focus {
  border-color: rgba(0,0,0,0.3);
}
.ai-chat-compose__input::placeholder {
  color: rgba(0,0,0,0.35);
}
.ai-chat-compose__send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.ai-chat-compose__send svg {
  flex-shrink: 0;
  min-width: 18px;
}
.ai-chat-compose__send:hover {
  background: #1d4ed8;
}

/* Stop button (PUB-007) */
.ai-chat-compose__stop {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  cursor: not-allowed;
  flex-shrink: 0;
  opacity: 0.5;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.ai-chat-compose__stop:not([disabled]) {
  cursor: pointer;
  opacity: 1;
}
.ai-chat-compose__stop:not([disabled]):hover {
  background: #dc2626;
}

/* Busy state (PUB-007) */
.ai-chat-compose--busy .ai-chat-compose__input {
  background: #f9fafb;
  color: rgba(0,0,0,0.35);
}
.ai-chat-compose--busy .ai-chat-compose__send {
  display: none;
}
.ai-chat-compose--busy .ai-chat-compose__stop {
  display: flex;
}

/* Responsive - Modal */
@media (max-width: 767px) {
  .ai-chat-modal__container {
    max-width: 100%;
    height: 100%;
    border-radius: 0;
  }
  .ai-chat-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 10;
    width: 280px;
    box-shadow: 4px 0 16px rgba(0,0,0,0.1);
  }
  /* P7-CSS-001: iOS 자동 줌 방지 */
  .ai-chat-compose__input {
    font-size: 16px;
  }
  /* 모바일: 모델 드롭다운 숨김 (헤더에 AI Assistant 표시로 충분) */
  .ai-chat-model-bar {
    display: none !important;
  }
  /* 모바일: X 닫기 버튼 강화 */
  .ai-chat-modal__close {
    width: 40px;
    height: 40px;
  }
}

/* Connection Banner - ERR-003 */
.ai-chat-connection-banner {
  background: #fef3c7;
  color: #92400e;
  padding: 6px 16px;
  font-size: 13px;
  text-align: center;
  border-bottom: 1px solid #fde68a;
  animation: ai-chat-banner-pulse 2s ease-in-out infinite;
}
.ai-chat-connection-banner__text {
  display: inline-block;
}
@keyframes ai-chat-banner-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Send Failed State - OPT-002 */
.ai-chat-msg--failed .ai-chat-msg__bubble {
  opacity: 0.6;
}
.ai-chat-msg__fail-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: #ef4444;
  justify-content: flex-end;
}
.ai-chat-msg__retry-btn {
  background: none;
  border: 1px solid #ef4444;
  color: #ef4444;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ai-chat-msg__retry-btn:hover {
  background: #ef4444;
  color: #fff;
}

/* Session Management - SESS-001 */
.ai-chat-sessions-btn,
.ai-chat-new-chat-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}
.ai-chat-sessions-btn:hover,
.ai-chat-new-chat-btn:hover { background: rgba(0,0,0,0.05); }
/* Sidebar */
.ai-chat-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #f8f9fa;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ai-chat-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
}
.ai-chat-sidebar__close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.ai-chat-sidebar__close:hover { color: #374151; background: rgba(0,0,0,0.05); }
.ai-chat-sidebar__new {
  display: block;
  width: calc(100% - 24px);
  margin: 12px 12px 8px;
  padding: 10px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}
.ai-chat-sidebar__new:hover { background: #1d4ed8; }
.ai-chat-sidebar__list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.ai-chat-sidebar__settings {
  border-top: 1px solid #e5e7eb;
  padding: 12px;
}
.ai-chat-sidebar__settings-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.ai-chat-sidebar__settings-input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  resize: none;
  outline: none;
  box-sizing: border-box;
}
.ai-chat-sidebar__settings-input:focus { border-color: #2563eb; }
.ai-chat-sidebar__settings-save {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 6px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  color: #374151;
}
.ai-chat-sidebar__settings-save:hover { background: #e5e7eb; }
.ai-chat-session-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  gap: 8px;
  font-size: 13px;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}
.ai-chat-session-item:hover { background: #f0f0f0; }
.ai-chat-session-item--active { background: #e8f0fe; border-left-color: #2563eb; font-weight: 500; }
.ai-chat-session-item__title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-chat-session-item__title[contenteditable] {
  outline: 1px solid #2563eb;
  border-radius: 2px;
  padding: 0 4px;
}
.ai-chat-session-item__delete {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  line-height: 1;
  border-radius: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.ai-chat-session-item:hover .ai-chat-session-item__delete { opacity: 1; }
.ai-chat-session-item__delete:hover { color: #ef4444; background: #fef2f2; }

/* Action Buttons - ACTION-001 */
.ai-chat-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.ai-chat-msg--ai:hover .ai-chat-actions { opacity: 1; }
.ai-chat-actions__btn {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 12px;
  color: #9ca3af;
  display: flex;
  align-items: center;
}
.ai-chat-actions__btn:hover { background: #f3f4f6; color: #6b7280; }
.ai-chat-actions__btn--active { border-color: #2563eb; color: #2563eb; }

/* Tool Card UI - TPART-002/003/004 */
.ai-chat-tool-card {
  margin: 6px 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
}
.ai-chat-tool-card__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #f9fafb;
  cursor: pointer;
}
.ai-chat-tool-card__icon { font-size: 14px; }
.ai-chat-tool-card__name { font-weight: 500; flex: 1; }
.ai-chat-tool-card__state { font-size: 11px; color: #9ca3af; }
.ai-chat-tool-card__state--running { color: #f59e0b; animation: tool-pulse 1.5s ease-in-out infinite; }
@keyframes tool-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.ai-chat-tool-card__state--completed { color: #10b981; }
.ai-chat-tool-card__state--error { color: #ef4444; }
.ai-chat-tool-card__chevron { transition: transform 0.2s; }
.ai-chat-tool-card__chevron--open { transform: rotate(90deg); }
.ai-chat-tool-card__body {
  padding: 8px 10px;
  border-top: 1px solid #f3f4f6;
  font-size: 12px;
  color: #6b7280;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* Reasoning Part - REASON-001 */
.ai-chat-reasoning {
  margin: 4px 0 8px;
}
.ai-chat-reasoning__toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  color: #9ca3af;
  cursor: pointer;
  transition: background 0.15s;
}
.ai-chat-reasoning__toggle:hover { background: #f9fafb; }
.ai-chat-reasoning__toggle svg { transition: transform 0.2s; }
.ai-chat-reasoning__toggle--open svg { transform: rotate(90deg); }
.ai-chat-reasoning__content {
  margin-top: 6px;
  padding: 8px 12px;
  background: #f9fafb;
  border-left: 3px solid #d1d5db;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  font-style: italic;
  color: #6b7280;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

/* File Inline Preview - FILE-003 */
.ai-chat-file-inline {
  margin: 6px 0;
}
.ai-chat-file-inline__img {
  max-width: 240px;
  max-height: 180px;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.ai-chat-file-inline__img:hover { opacity: 0.85; }
.ai-chat-file-inline__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #2563eb;
  text-decoration: none;
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.ai-chat-file-inline__link:hover { background: #f3f4f6; }

/* File Upload - FILE-002 */
.ai-chat-compose__row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  width: 100%;
}
.ai-chat-compose__attach {
  display: none;
}
.ai-chat-compose__attach:hover { color: #6b7280; background: rgba(0,0,0,0.05); }
.ai-chat-file-preview {
  display: none !important;
}
.ai-chat-file-thumb {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.ai-chat-file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ai-chat-file-thumb__name {
  font-size: 8px;
  text-align: center;
  padding: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-chat-file-thumb__remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: none;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
}
.ai-chat-compose--dragover {
  outline: 2px dashed #2563eb;
  outline-offset: -2px;
  background: rgba(37, 99, 235, 0.05);
}

/* Custom Instruction Settings - PROMPT-002 */
.ai-chat-settings-section {
  padding: 8px 16px 12px;
  border-top: 1px solid #e5e7eb;
}
.ai-chat-settings-section__label {
  font-size: 11px;
  color: #6b7280;
  font-weight: 600;
  margin-bottom: 4px;
}
.ai-chat-settings-section__input {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  resize: vertical;
  font-family: inherit;
}
.ai-chat-settings-section__save {
  margin-top: 4px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 11px;
  cursor: pointer;
}
.ai-chat-settings-section__save:hover { background: #1d4ed8; }

/* Model Selector - MODEL-002 */
.ai-chat-model-bar {
  display: none;
}
.ai-chat-model-select {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: border-color 0.15s;
}
.ai-chat-model-select:hover { border-color: #9ca3af; }
.ai-chat-model-dropdown {
  position: absolute;
  bottom: 100%;
  left: 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  min-width: 200px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
}
.ai-chat-model-dropdown__group {
  padding: 4px 0;
  border-bottom: 1px solid #f3f4f6;
}
.ai-chat-model-dropdown__group:last-child { border-bottom: none; }
.ai-chat-model-dropdown__label {
  padding: 4px 12px;
  font-size: 10px;
  color: #9ca3af;
  text-transform: uppercase;
  font-weight: 600;
}
.ai-chat-model-dropdown__item {
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-chat-model-dropdown__item:hover { background: #f3f4f6; }
.ai-chat-model-dropdown__item--active { color: #2563eb; font-weight: 500; }

/* Skeleton Loading - SESS-002 */
.ai-chat-skeleton {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-chat-skeleton__line {
  height: 16px;
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  border-radius: 8px;
  animation: ai-chat-shimmer 1.5s infinite;
  width: 80%;
}
.ai-chat-skeleton__line--short { width: 40%; }
@keyframes ai-chat-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Infinite Scroll - PAGE-002 */
.ai-chat-history-loader {
  display: flex;
  justify-content: center;
  padding: 12px 0;
}
/* Markdown Rendering - MD-001 */
.ai-chat-msg__bubble--md { font-size: 14px !important; line-height: 1.5 !important; }
.ai-chat-msg__bubble--md p { margin: 0 0 8px; font-size: inherit; }
.ai-chat-msg__bubble--md p:last-child { margin-bottom: 0; }
.ai-chat-msg__bubble--md h1,
.ai-chat-msg__bubble--md h2,
.ai-chat-msg__bubble--md h3 {
  margin: 12px 0 6px;
  font-size: 1em;
  font-weight: 600;
}
.ai-chat-msg__bubble--md h1 { font-size: 15px; }
.ai-chat-msg__bubble--md h2 { font-size: 14.5px; }
.ai-chat-msg__bubble--md code {
  background: rgba(0,0,0,0.06);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: 'Fira Code', 'Consolas', monospace;
}
.ai-chat-msg__bubble--md pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.5;
}
.ai-chat-msg__bubble--md pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}
.ai-chat-msg__bubble--md ul,
.ai-chat-msg__bubble--md ol {
  margin: 4px 0;
  padding-left: 20px;
}
.ai-chat-msg__bubble--md li { margin: 2px 0; }
.ai-chat-msg__bubble--md a {
  color: #2563eb;
  text-decoration: underline;
}
.ai-chat-msg__bubble--md blockquote {
  border-left: 3px solid #d1d5db;
  margin: 8px 0;
  padding: 4px 12px;
  color: #6b7280;
  font-size: 14px;
  font-weight: normal;
  font-style: normal;
  line-height: 1.5;
  letter-spacing: normal;
}
.ai-chat-msg__bubble--md table {
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 14px;
  width: 100%;
}
.ai-chat-msg__bubble--md th,
.ai-chat-msg__bubble--md td {
  border: 1px solid #d1d5db;
  padding: 4px 8px;
  text-align: left;
}
.ai-chat-msg__bubble--md th {
  background: #f3f4f6;
  font-weight: 600;
}
.ai-chat-msg__bubble--md strong { font-weight: 600; }
.ai-chat-msg__bubble--md em { font-style: italic; }

/* Code Copy Button - MD-002 */
.ai-chat-code-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #9ca3af;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  opacity: 0;
}
pre:hover .ai-chat-code-copy { opacity: 1; }
.ai-chat-code-copy:hover {
  background: rgba(255,255,255,0.2);
  color: #e5e7eb;
}

.ai-chat-history-end {
  text-align: center;
  padding: 12px 0;
  font-size: 12px;
  color: #9ca3af;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 8px;
}
