/* ==========================================================================
   株式会社Arcwise - AI経営統合コマンドセンター (超高速・プレミアムダークデザイン)
   ========================================================================== */

:root {
  --bg-dark: #0a0e17;
  --bg-card: rgba(15, 23, 42, 0.75);
  --border-glass: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(6, 182, 212, 0.3);
  
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-violet: #8b5cf6;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-gold: #fbbf24;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #64748b;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  --shadow-glow: 0 0 25px rgba(6, 182, 212, 0.15);
}

/* ライブパルス・動的ステータスドット */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: livePulse 1.5s infinite ease-in-out;
  margin-right: 6px;
  vertical-align: middle;
}

@keyframes livePulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes tickerMove {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

.ticker-content {
  display: inline-block;
  white-space: nowrap;
  animation: tickerMove 30s linear infinite;
}

/* サイバーターミナル・カチャカチャ動的ストリーム */
.cyber-terminal {
  background: #050811;
  border: 1px solid rgba(6, 182, 212, 0.4);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  color: #10b981;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8), 0 0 15px rgba(6, 182, 212, 0.15);
  height: 180px;
  overflow-y: auto;
  line-height: 1.6;
}

.terminal-line {
  margin-bottom: 4px;
  word-break: break-all;
  display: flex;
  gap: 8px;
}

.terminal-time {
  color: var(--accent-cyan);
  font-weight: 700;
}

.terminal-prompt {
  color: var(--accent-amber);
}

.terminal-cmd {
  color: #38bdf8;
}

.blinking-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background-color: var(--accent-green);
  animation: blink 0.8s infinite;
  vertical-align: middle;
  margin-left: 4px;
}

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

/* マイク音声入力ボタン 録音中スタイル */
.mic-btn.recording {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
  animation: micPulse 1.2s infinite ease-in-out;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}

@keyframes micPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  50% { transform: scale(1.06); box-shadow: 0 0 12px 6px rgba(239, 68, 68, 0.3); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
}

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

body {
  background: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(6, 182, 212, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* スクロールバー */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* 全体レイアウト */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ヘッダー */
.top-header {
  height: 64px;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-glow {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
  border-radius: 8px;
  box-shadow: 0 0 15px var(--accent-cyan);
}

.brand-title h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #fff, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-title p {
  font-size: 0.68rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.header-status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
}

.status-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.status-chip i {
  width: 14px;
  height: 14px;
  color: var(--accent-cyan);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.status-dot.green {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.chip-label {
  color: var(--text-muted);
}
.chip-value {
  font-weight: 700;
}
.chip-value.highlight {
  color: var(--accent-cyan);
}
.chip-link {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
}

/* アプリボディ */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* サイドバー */
.sidebar-nav {
  width: 260px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 12px;
  flex-shrink: 0;
}

.nav-section-title {
  font-size: 0.68rem;
  color: var(--text-dark);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 12px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer !important;
  pointer-events: auto !important;
  user-select: none;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
  margin-bottom: 2px;
}

.nav-item i {
  width: 18px;
  height: 18px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.2), rgba(139, 92, 246, 0.1));
  border-color: rgba(6, 182, 212, 0.4);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--accent-cyan);
}

.nav-badge {
  margin-left: auto;
  background: var(--accent-red);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
}

.sidebar-footer {
  border-top: 1px solid var(--border-glass);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: 0.2s;
}

.sidebar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* メインビュー */
.content-view-container {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block !important;
  animation: fadeIn 0.2s ease-out;
}

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

/* ガラスカード */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.section-banner {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.section-banner.cyan-glow { border-left: 4px solid var(--accent-cyan); }
.section-banner.violet-glow { border-left: 4px solid var(--accent-violet); }
.section-banner.green-glow { border-left: 4px solid var(--accent-green); }
.section-banner.gold-glow { border-left: 4px solid var(--accent-gold); }

.banner-text h2 {
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.banner-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.banner-stat {
  text-align: right;
}

.stat-number {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* KPI グリッド */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  padding: 20px;
  transition: transform 0.2s, border-color 0.2s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(6, 182, 212, 0.4);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.kpi-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-icon {
  width: 20px;
  height: 20px;
  color: var(--accent-cyan);
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
}

.kpi-subtext {
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.kpi-subtext.positive { color: var(--accent-green); }

.dashboard-grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.chart-box {
  padding: 20px;
}

.box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.box-header h3 {
  font-size: 0.98rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ボタンバリエーション */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: #fff;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.3);
}
.primary-btn:hover { opacity: 0.9; transform: translateY(-1px); }

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--border-glass);
}
.secondary-btn:hover { background: rgba(255, 255, 255, 0.15); }

.green-btn {
  background: linear-gradient(135deg, var(--accent-green), #059669);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.violet-btn {
  background: linear-gradient(135deg, var(--accent-violet), #7c3aed);
  color: #fff;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}

.gold-btn {
  background: linear-gradient(135deg, var(--accent-gold), #d97706);
  color: #000;
  font-weight: 800;
}

.mini-btn {
  padding: 4px 10px;
  font-size: 0.72rem;
  border-radius: 4px;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  cursor: pointer;
}
.mini-btn:hover { background: rgba(255, 255, 255, 0.15); }

.full-width { width: 100%; }

/* バッジ & チップ */
.dir-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
}
.dir-badge.high { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }
.dir-badge.info { background: rgba(6, 182, 212, 0.2); color: var(--accent-cyan); }

.badge-outline {
  padding: 4px 10px;
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

/* チャット UI */
.chat-window-container {
  display: flex;
  flex-direction: column;
  height: 520px;
}

.chat-messages-container {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.5;
}

.message-bubble.ai {
  align-self: flex-start;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--border-glass);
  border-bottom-left-radius: 2px;
}

.message-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.msg-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 0.75rem;
  opacity: 0.8;
}

.chat-input-area {
  padding: 14px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  gap: 10px;
}

.chat-input-area textarea {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 0.88rem;
  resize: none;
}
.chat-input-area textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

/* ドキュメント生成カード */
.doc-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.doc-btn {
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: 0.2s;
}
.doc-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-cyan);
}

/* モーダル */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.modal-overlay.active {
  display: flex !important;
  pointer-events: auto !important;
}

.modal-card {
  width: 90%;
  max-width: 650px;
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.close-modal-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: #fff;
  font-family: monospace;
  font-size: 0.85rem;
  resize: none;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

/* トースト */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast-item {
  padding: 12px 18px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}
.toast-item.show {
  opacity: 1;
  transform: translateY(0);
}
.toast-item.cyan { border-left: 4px solid var(--accent-cyan); }
.toast-item.green { border-left: 4px solid var(--accent-green); }
.toast-item.violet { border-left: 4px solid var(--accent-violet); }
.toast-item.amber { border-left: 4px solid var(--accent-amber); }

/* レスポンシブ */
@media (max-width: 900px) {
  .sidebar-nav { width: 70px; padding: 12px 6px; }
  .nav-item span, .nav-section-title, .brand-title p, .sidebar-footer { display: none; }
  .dashboard-grid-2col { grid-template-columns: 1fr; }
}
