/**
 * CORE SPEC - AI制作環境チャットボット Dedicated Styles
 * File: assets/css/ai_pc_advisor.css
 *
 * Scoped under .advisor-main so shared CORE SPEC header, footer, breadcrumb,
 * and SNS share components remain 100% unaffected.
 */

body.advisor-body {
  background-color: #0b0f19;
  color: #f3f5fa;
}

.advisor-main {
  --bg: #090c12;
  --surface: #10151f;
  --line: #262e3c;
  --text: #f3f5fa;
  --muted: #9aa7bc;
  --cyan: #65deee;
  --purple: #a57aff;
  color-scheme: dark;
  width: 100%;
  max-width: 1200px;
  padding: 16px 24px 40px;
  margin: 0 auto;
  box-sizing: border-box;
  color: var(--text);
  font: 15px/1.75 "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", Meiryo, sans-serif;
}

.advisor-main *,
.advisor-main *::before,
.advisor-main *::after {
  box-sizing: border-box;
}

.advisor-main button,
.advisor-main textarea {
  font: inherit;
}

.advisor-main button,
.advisor-main a,
.advisor-main summary {
  touch-action: manipulation;
}

.advisor-main button {
  cursor: pointer;
}

.advisor-main a:not(.cs-breadcrumb a) {
  color: var(--cyan);
  text-decoration: none;
}

.advisor-main a:not(.cs-breadcrumb a):hover {
  text-decoration: underline;
}

.advisor-main button:focus-visible,
.advisor-main a:focus-visible,
.advisor-main summary:focus-visible,
.advisor-main textarea:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}

.advisor-main [hidden] {
  display: none !important;
}

/* Intro Hero */
.advisor-main .intro {
  margin-bottom: 20px;
}

.advisor-main .eyebrow {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--cyan);
  font-weight: 700;
}

.advisor-main h1 {
  font-size: clamp(25px, 4vw, 38px);
  line-height: 1.45;
  letter-spacing: 0.025em;
  font-weight: 900;
  color: #ffffff;
  margin: 10px 0;
}

.advisor-main h1 em {
  font-style: normal;
  color: var(--cyan);
}

.advisor-main .intro p {
  color: var(--muted);
  margin: 8px 0;
  font-size: 14px;
}

/* Native CORE SPEC Custom Chat Shell */
.advisor-main .chat-shell {
  scroll-margin-top: 96px;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.advisor-main .toolbar {
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}

.advisor-main .identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.advisor-main .avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #695482;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(165, 122, 255, 0.15), rgba(101, 222, 238, 0.08));
  color: var(--cyan);
  font-weight: 800;
  flex-shrink: 0;
}

.advisor-main .identity strong {
  font-size: 13px;
  display: block;
  color: #ffffff;
}

.advisor-main .state {
  font-size: 11px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.advisor-main .state::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  flex-shrink: 0;
}

.advisor-main .state.is-busy::before {
  background: #facc15;
  box-shadow: 0 0 8px #facc15;
}

.advisor-main .state.is-warning::before {
  background: #f87171;
  box-shadow: 0 0 8px #f87171;
}

.advisor-main .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.advisor-main .secondary {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 11px;
  background: transparent;
  color: #c8d1df;
  font-size: 12px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.advisor-main .secondary:hover {
  border-color: var(--cyan);
  color: #ffffff;
}

.advisor-main .secondary.stop-btn {
  border-color: rgba(248, 113, 113, 0.55);
  color: #fca5a5;
}

.advisor-main .secondary.stop-btn:hover {
  border-color: #f87171;
  background: rgba(248, 113, 113, 0.1);
}

/* Chat Area & Messages */
.advisor-main .chat-area {
  background: #0b1019;
  display: flex;
  flex-direction: column;
}

.advisor-main .chat-messages {
  height: clamp(420px, 54dvh, 640px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}

.advisor-main .msg {
  display: flex;
  gap: 12px;
  max-width: 86%;
  animation: csAdvisorFadeIn 0.18s ease-out;
}

@keyframes csAdvisorFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.advisor-main .msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.advisor-main .msg-bot {
  align-self: flex-start;
}

.advisor-main .msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 2px;
}

.advisor-main .msg-bot .msg-avatar {
  border: 1px solid #695482;
  background: linear-gradient(135deg, rgba(165, 122, 255, 0.15), rgba(101, 222, 238, 0.08));
  color: var(--cyan);
}

.advisor-main .msg-user .msg-avatar {
  border: 1px solid #2b4c59;
  background: #132630;
  color: var(--cyan);
  font-size: 11px;
}

.advisor-main .msg-bubble {
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.advisor-main .msg-bot .msg-bubble {
  background: #131a27;
  border: 1px solid #253042;
  color: var(--text);
  border-top-left-radius: 4px;
}

.advisor-main .msg-user .msg-bubble {
  background: linear-gradient(135deg, #162c38, #182235);
  border: 1px solid #2f5568;
  color: #ffffff;
  border-top-right-radius: 4px;
  white-space: pre-wrap;
}

.advisor-main .msg-bubble p {
  margin: 0 0 10px;
}

.advisor-main .msg-bubble p:last-child {
  margin-bottom: 0;
}

.advisor-main .msg-bubble h3,
.advisor-main .msg-bubble h4 {
  margin: 14px 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.advisor-main .msg-bubble h3:first-child,
.advisor-main .msg-bubble h4:first-child {
  margin-top: 0;
}

.advisor-main .msg-bubble ul,
.advisor-main .msg-bubble ol {
  margin: 8px 0 10px;
  padding-left: 20px;
}

.advisor-main .msg-bubble ul {
  list-style: disc;
}

.advisor-main .msg-bubble ol {
  list-style: decimal;
}

.advisor-main .msg-bubble li {
  margin: 4px 0;
}

.advisor-main .msg-bubble strong {
  color: #ffffff;
  font-weight: 700;
}

.advisor-main .msg-bubble code {
  background: #090d14;
  border: 1px solid #263144;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--cyan);
}

.advisor-main .msg-bubble a {
  color: var(--cyan);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.advisor-main .msg-unverified-url {
  color: var(--muted);
  font-size: 13px;
}

.advisor-main .msg-table-wrap {
  overflow-x: auto;
  margin: 10px 0;
  -webkit-overflow-scrolling: touch;
}

.advisor-main .msg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.advisor-main .msg-table th,
.advisor-main .msg-table td {
  border: 1px solid #2a3548;
  padding: 7px 10px;
  text-align: left;
}

.advisor-main .msg-table th {
  background: #192233;
  color: #ffffff;
}

.advisor-main .typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
}

.advisor-main .typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  opacity: 0.4;
  animation: csAdvisorBlink 1.2s infinite;
}

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

.advisor-main .typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes csAdvisorBlink {
  0%, 100% {
    opacity: 0.25;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

/* Composer */
.advisor-main .chat-composer {
  padding: 14px 20px;
  background: #0e1420;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  align-items: stretch;
  position: relative;
}

.advisor-main .chat-composer textarea {
  scroll-margin-top: 96px;
  flex: 1;
  field-sizing: content;
  height: auto;
  width: 100%;
  min-block-size: 2.75lh;
  max-block-size: 8lh;
  background: #090d15;
  border: 1px solid #2d384c;
  border-radius: 10px;
  color: var(--text);
  padding: 10px 14px;
  resize: none;
  line-height: 1.6;
  font-size: 14px;
}

.advisor-main .chat-composer textarea:focus {
  border-color: var(--cyan);
  outline: none;
}

.advisor-main .send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  border: 0;
  background: linear-gradient(135deg, var(--cyan), #4bc2d6);
  color: #061318;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.advisor-main .send-btn:hover:not(:disabled) {
  opacity: 0.92;
}

.advisor-main .send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.advisor-main .composer-meta {
  padding: 0 22px 10px;
  background: #0e1420;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  gap: 10px;
  flex-wrap: wrap;
}

.advisor-main .char-count.is-over {
  color: #f87171;
  font-weight: 700;
}

.advisor-main .privacy-disclosure {
  padding: 8px 22px 12px;
  background: #0c111b;
  border-top: 1px solid rgba(38, 46, 60, 0.65);
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}

.advisor-main .privacy-disclosure a {
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Starter Cards & Welcome */
.advisor-main .welcome {
  border-top: 1px solid var(--line);
  padding: 20px 24px 16px;
  background: radial-gradient(ellipse at 0 0, rgba(117, 80, 188, 0.08), transparent 60%);
}

.advisor-main .message {
  max-width: none;
  margin-bottom: 14px;
}

.advisor-main .message h2 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 4px;
}

.advisor-main .message p {
  color: #bdc7d7;
  font-size: 12px;
  margin: 0;
}

.advisor-main .starters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.advisor-main .starter {
  min-width: 0;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid #303a4c;
  border-radius: 8px;
  background: #141b28;
  color: var(--text);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.advisor-main .starter:hover:not(:disabled) {
  background: #1a2434;
  border-color: rgba(101, 222, 238, 0.6);
}

.advisor-main .starter:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.advisor-main .starter small,
.advisor-main .starter > span,
.advisor-main .custom > span {
  display: none;
}

.advisor-main .starter strong {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  margin: 0;
  color: var(--text);
}

.advisor-main .starter strong span {
  color: var(--cyan);
}

.advisor-main .custom {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px dashed #424052;
  border-radius: 8px;
  padding: 10px 12px;
  color: #c8b0f5;
  background: rgba(165, 122, 255, 0.04);
  font-size: 12px;
  line-height: 1.6;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.advisor-main .custom:hover {
  border-color: rgba(165, 122, 255, 0.55);
  background: rgba(165, 122, 255, 0.09);
}

.advisor-main .starter-help {
  color: var(--muted);
  font-size: 11px;
  margin: 10px 0 0;
}

.advisor-main .feedback {
  font-size: 12px;
  color: var(--cyan);
  margin: 8px 0 0;
  min-height: 21px;
}

.advisor-main .feedback:empty {
  display: none;
}

.advisor-main .notes {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
}

/* Self-Research Quick Links & FAQ */
.advisor-main .resources {
  margin-top: 28px;
}

.advisor-main .resources summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #c7d0de;
  padding: 6px 0;
}

.advisor-main .quick-links {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.advisor-main .quick-links a {
  font-size: 12px;
  display: block;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(16, 21, 31, 0.7);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.advisor-main .quick-links a:hover {
  border-color: rgba(101, 222, 238, 0.5);
  background: rgba(22, 31, 46, 0.9);
  text-decoration: none;
}

.advisor-main .link-badge {
  font-size: 10px;
  margin-left: 8px;
  color: var(--muted);
}

/* FAQ WebKit disclosure marker reset & offline utility parity (matches spec_analyzer.html FAQ format) */
.advisor-main .cs-faq__list summary {
  list-style: none;
}

.advisor-main .cs-faq__list summary::-webkit-details-marker {
  display: none;
}

.advisor-main .cs-faq__list summary:hover {
  color: #22d3ee;
}

.advisor-main .cs-faq__list details[open] > summary > .group-open\:rotate-45 {
  transform: rotate(45deg);
}

.advisor-main .cs-faq__list details > .pb-4 {
  padding-bottom: 1rem;
}

/* Accessibility & Anti-bot Honeypot */
.advisor-main .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.advisor-main .hp-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (min-width: 1400px) {
  .advisor-main {
    padding-top: 24px;
  }
}

@media (max-width: 700px) {
  .advisor-main {
    padding: 10px 14px 32px;
  }
  .advisor-main .eyebrow {
    font-size: 9px;
  }
  .advisor-main h1 {
    font-size: 25px;
  }
  .advisor-main .intro {
    margin-bottom: 16px;
  }
  .advisor-main .intro p {
    font-size: 12px;
  }
  .advisor-main .toolbar {
    padding: 14px 16px;
  }
  .advisor-main .actions {
    width: 100%;
  }
  .advisor-main .chat-messages {
    height: 56dvh;
    min-height: 360px;
    padding: 16px;
  }
  .advisor-main .msg {
    max-width: 94%;
  }
  .advisor-main .chat-composer {
    padding: 12px 14px;
  }
  /* Prevent iOS Safari input auto-zoom on tap */
  .advisor-main .chat-composer textarea {
    font-size: 16px;
  }
  .advisor-main .composer-meta,
  .advisor-main .privacy-disclosure {
    padding-left: 14px;
    padding-right: 14px;
  }
  .advisor-main .welcome {
    padding: 16px;
  }
  .advisor-main .starters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .advisor-main .starter,
  .advisor-main .custom {
    padding: 9px 10px;
  }
  .advisor-main .starter strong,
  .advisor-main .custom {
    font-size: 11px;
  }
}

@media (max-width: 380px) {
  .advisor-main .starters {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .advisor-main *,
  .advisor-main *::before,
  .advisor-main *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
