/* ==========================================================================
   Be-Biblio (ISBNでブラウジング) - Modern Style System
   ========================================================================== */

:root {
  /* カラーパレット */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #eff6ff;
  --color-accent: #0284c7;
  --color-accent-subtle: #e0f2fe;

  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-hover: #f1f5f9;
  --color-surface-border: #e2e8f0;

  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
  --color-text-subtle: #94a3b8;

  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;
  --color-error: #ef4444;
  --color-error-bg: #fef2f2;

  /* シャドウ */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
  --shadow-glow: 0 0 15px rgba(37, 99, 235, 0.2);

  /* タイポグラフィ */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;

  /* 角丸 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* トランジション */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* レイアウトコンテナ */
.app-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

/* サイトヘッダー */
.site-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 32px 0 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.header-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.35);
}

.brand-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-subtitle {
  font-size: 13px;
  font-weight: 500;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-tag.api-tag {
  background: rgba(14, 165, 233, 0.15);
  color: #7dd3fc;
  border-color: rgba(14, 165, 233, 0.3);
}

.site-desc {
  font-size: 14px;
  color: #cbd5e1;
  margin: 0;
  line-height: 1.5;
}

/* メインコンテンツエリア */
.main-content {
  flex: 1;
  padding: 32px 0 48px;
}

.browse-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 28px;
  align-items: start;
}

@media (max-width: 900px) {
  .browse-grid {
    grid-template-columns: 1fr;
  }
}

/* カード基底 */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

/* 入力・コントロールパネル */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 24px;
}

.panel-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.char-counter {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.char-counter.limit-reached {
  color: var(--color-error);
  background: var(--color-error-bg);
  font-weight: 700;
  animation: pulse-warn 1s infinite alternate;
}

@keyframes pulse-warn {
  from { opacity: 0.8; }
  to { opacity: 1; }
}

.input-helper-text {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.isbn-textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--color-text-main);
  background-color: #ffffff;
  border: 1.5px solid var(--color-surface-border);
  border-radius: var(--radius-md);
  resize: vertical;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.isbn-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.isbn-textarea::placeholder {
  color: var(--color-text-subtle);
}

/* アクションボタン群 */
.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
  flex: 2;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: #f8fafc;
  color: var(--color-text-main);
  border-color: var(--color-surface-border);
  flex: 1;
}

.btn-secondary:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-outline {
  width: 100%;
  background-color: transparent;
  color: var(--color-accent);
  border-color: #bae6fd;
  background-color: var(--color-accent-subtle);
  font-size: 13px;
  padding: 8px 14px;
}

.btn-outline:hover {
  background-color: #bae6fd;
  border-color: #7dd3fc;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

/* ステータスカード */
.status-card {
  background: #f8fafc;
  border: 1px solid var(--color-surface-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.status-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.status-idle {
  background: #e2e8f0;
  color: #475569;
}

.status-loading {
  background: #dbeafe;
  color: #1d4ed8;
  animation: pulse 1.5s infinite;
}

.status-success {
  background: var(--color-success-bg);
  color: #065f46;
}

.status-warning {
  background: var(--color-warning-bg);
  color: #92400e;
}

.status-error {
  background: var(--color-error-bg);
  color: #991b1b;
}

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

.now-input-wrap {
  position: relative;
}

.now-input {
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  background-color: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  outline: none;
}

.remaining-count {
  font-size: 11.5px;
  color: var(--color-text-muted);
  text-align: right;
}

/* セキュリティ仕様インジケーター */
.security-note {
  font-size: 11px;
  color: var(--color-text-muted);
  background: #f1f5f9;
  border-left: 3px solid #0284c7;
  padding: 8px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.4;
}

/* 右カラム：書籍表示エリア */
.display-area {
  min-height: 500px;
}

/* ウェルカムカード */
.welcome-card {
  text-align: center;
  padding: 48px 32px;
}

.welcome-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.welcome-card h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 8px;
}

.welcome-card p {
  color: var(--color-text-muted);
  font-size: 14.5px;
  max-width: 520px;
  margin: 0 auto 24px;
}

.welcome-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 540px;
  margin: 0 auto 32px;
  text-align: left;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f8fafc;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-surface-border);
  font-size: 13.5px;
}

.step-number {
  background: var(--color-primary);
  color: #ffffff;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ローディングカード */
.loading-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 60px 24px;
  text-align: left;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 4px;
}

.loading-text p {
  font-size: 13px;
  color: var(--color-text-muted);
}

.mono-badge {
  font-family: var(--font-mono);
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

/* 該当なし・エラーカード */
.not-found-card, .error-card, .empty-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 36px 28px;
}

.not-found-icon, .error-icon, .empty-icon {
  font-size: 36px;
  line-height: 1;
}

.not-found-content h3, .error-content h3, .empty-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.not-found-desc, .error-detail {
  font-size: 13.5px;
  color: var(--color-text-muted);
  margin: 10px 0 16px;
}

/* 書籍詳細カード */
.book-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 300ms ease-out;
}

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

.book-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--color-surface-border);
  padding-bottom: 16px;
}

.badge-openbd {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.book-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--color-text-main);
  letter-spacing: -0.01em;
}

.book-series {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-accent);
}

.book-body {
  background: #f8fafc;
  border: 1px solid var(--color-surface-border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
}

.book-meta-list {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px 18px;
  font-size: 14px;
  align-items: baseline;
}

.book-meta-list dt {
  color: var(--color-text-muted);
  font-weight: 600;
  text-align: right;
  letter-spacing: 0.02em;
}

.book-meta-list dd {
  color: var(--color-text-main);
  font-weight: 500;
  word-break: break-word;
  line-height: 1.5;
}

/* 内容紹介・目次セクション */
.book-details-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-top: 1px solid var(--color-surface-border);
  padding-top: 20px;
}

.detail-block {
  background: #f8fafc;
  border: 1px solid var(--color-surface-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.detail-block-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-block-text {
  font-size: 13.5px;
  line-height: 1.7;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
}

.review-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.review-list li {
  font-size: 13px;
  color: #475569;
  position: relative;
  padding-left: 14px;
}

.review-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--color-accent);
  font-weight: bold;
}

/* サイトフッター */
.site-footer {
  margin-top: auto;
  background-color: #ffffff;
  border-top: 1px solid var(--color-surface-border);
  padding: 32px 0 24px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  text-decoration: underline;
  color: var(--color-primary-hover);
}

.footer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid #f1f5f9;
  padding-top: 16px;
}

.copyright {
  margin: 0;
}
