/* ============================================================
   style.css  - リアルタイム文字起こし フロントエンド
   ダークテーマ / レスポンシブ対応
   ============================================================ */

/* ---- リセット & ベース ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  background-color: #1a1a2e;
  color: #e0e0e0;
  font-family: 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- ヘッダー ---- */
header {
  background-color: #16213e;
  border-bottom: 1px solid #0f3460;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #e0e0e0;
  letter-spacing: 0.04em;
}

/* ---- ステータスインジケーター ---- */
#status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #a0a0b0;
}

#status::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background-color: #888;
}

/* 接続中 - 緑丸（点滅） */
#status.connected {
  color: #4caf93;
}
#status.connected::before {
  background-color: #4caf50;
  animation: pulse 2s ease-in-out infinite;
}

/* 切断 - 赤丸 */
#status.disconnected {
  color: #e07070;
}
#status.disconnected::before {
  background-color: #e53935;
  animation: none;
}

/* 再接続中 - 黄丸（点滅） */
#status.reconnecting {
  color: #f0c060;
}
#status.reconnecting::before {
  background-color: #ffb300;
  animation: pulse 0.8s ease-in-out infinite;
}

/* ---- パルスアニメーション ---- */
@keyframes pulse {
  0%   { opacity: 1;   transform: scale(1); }
  50%  { opacity: 0.4; transform: scale(0.85); }
  100% { opacity: 1;   transform: scale(1); }
}

/* ---- メインエリア ---- */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px;
  gap: 16px;
}

/* ---- 文字起こし表示エリア ---- */
#transcript {
  flex: 1;
  background-color: #0f172a;
  border: 1px solid #1e3a5f;
  border-radius: 8px;
  padding: 20px 24px;
  overflow-y: auto;
  min-height: 300px;
  max-height: calc(100vh - 220px);
  font-size: 1.1rem;
  line-height: 1.8;
  word-break: break-word;
  scroll-behavior: smooth;
}

/* 文字起こしテキストの各段落 */
#transcript p {
  margin-bottom: 0.6em;
  color: #e0e0e0;
  transition: color 0.2s ease;
}

/* 暫定テキスト（is_final: false） */
#transcript p.pending {
  color: #7a8aaa;
  font-style: italic;
}

/* 空のときのプレースホルダー */
#transcript:empty::before {
  content: '文字起こしテキストがここに表示されます...';
  color: #3a4a6a;
  font-style: italic;
}

/* ---- エラーバナー ---- */
#error-msg {
  display: none;
  background-color: #7f1d1d;
  color: #fca5a5;
  border: 1px solid #b91c1c;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 0.9rem;
  flex-shrink: 0;
}

#error-msg.visible {
  display: block;
}

/* ---- ボタンバー ---- */
#controls {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

button {
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
  letter-spacing: 0.04em;
}

button:active {
  transform: scale(0.97);
}

#btn-clear {
  background-color: #374151;
  color: #d1d5db;
}

#btn-clear:hover {
  background-color: #4b5563;
}

#btn-copy {
  background-color: #1d4ed8;
  color: #e0e8ff;
}

#btn-copy:hover {
  background-color: #2563eb;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---- スクロールバー（Webkit） ---- */
#transcript::-webkit-scrollbar {
  width: 6px;
}
#transcript::-webkit-scrollbar-track {
  background: #0f172a;
}
#transcript::-webkit-scrollbar-thumb {
  background-color: #2d4a7a;
  border-radius: 3px;
}
#transcript::-webkit-scrollbar-thumb:hover {
  background-color: #3b63a0;
}

/* ---- レスポンシブ ---- */
@media (max-width: 900px) {
  header {
    padding: 12px 16px;
  }

  main {
    padding: 14px 16px;
    gap: 12px;
  }

  #transcript {
    padding: 16px;
    font-size: 1rem;
    max-height: calc(100vh - 200px);
  }

  header h1 {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1rem;
  }

  #controls {
    flex-direction: column;
  }

  button {
    width: 100%;
    text-align: center;
  }
}
