/* ===== K-1 CLASSICS — Unified Design System ===== */

/* --- Base & Typography --- */
body {
  min-width: 0;
  word-wrap: break-word;
  font-size: 1rem;
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif !important;
  background-color: #f0f2f5 !important;
  color: #1a1a1a;
  line-height: 1.7;
}

/* --- Navbar Override --- */
.navbar {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%) !important;
  border-bottom: 3px solid #0d6efd !important;
  box-shadow: 0 2px 12px rgba(0,0,0,.15) !important;
}
.navbar-brand {
  font-weight: 900 !important;
  font-size: 20px !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase;
}

/* --- Content Card (main wrapper) --- */
.content-card {
  background: #fff !important;
  border-radius: 12px !important;
  padding: 2rem 2.5rem !important;
  margin-bottom: 32px !important;
  border: 1px solid #e5e7eb !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.04) !important;
}

/* --- Headings --- */
h2.card-title, h2.card-title-lg {
  font-size: 1.6rem !important;
  font-weight: 800 !important;
  border-bottom: 3px solid #0d6efd !important;
  padding-bottom: 10px !important;
  margin-bottom: 24px !important;
  color: #111 !important;
  letter-spacing: 0.02em;
}
h3 {
  font-size: 1.2rem !important;
  font-weight: 700 !important;
  margin-top: 32px !important;
  margin-bottom: 16px !important;
  border-left: 4px solid #0d6efd !important;
  padding-left: 14px !important;
  color: #1a1a2e !important;
}

/* --- Tables (Bootstrap override) --- */
.table {
  font-size: 0.9rem;
  border-color: #e5e7eb;
}
.table thead th, .table th {
  background: #f8f9fb !important;
  font-weight: 700 !important;
  font-size: 0.82rem !important;
  color: #4a5568 !important;
  letter-spacing: 0.03em;
  text-transform: none;
  border-bottom: 2px solid #dee2e6 !important;
  padding: 10px 14px !important;
  white-space: nowrap;
}
.table td {
  padding: 10px 14px !important;
  vertical-align: middle !important;
  border-color: #f0f1f3 !important;
}
.table-striped > tbody > tr:nth-of-type(odd) > td {
  background-color: #fafbfc !important;
}
.table tbody tr:hover td {
  background-color: #f0f4ff !important;
}
.table a {
  color: #0d6efd;
  font-weight: 600;
  text-decoration: none;
}
.table a:hover {
  color: #0a58ca;
  text-decoration: underline;
}

/* Fix: date cells should not wrap */
td[style*="white-space:nowrap"] {
  white-space: nowrap !important;
}

/* Nested date tables inside td — flatten */
td > .table-responsive {
  margin: 0 !important;
  padding: 0 !important;
}
td > .table-responsive > .table {
  margin: 0 !important;
  border: none !important;
}
td > .table-responsive > .table td {
  border: none !important;
  padding: 0 4px !important;
  background: transparent !important;
}

/* --- Links & Buttons --- */
a { color: #0d6efd; }
a:hover { color: #0a58ca; }
.btn-primary {
  background: #0d6efd !important;
  border-color: #0d6efd !important;
}
.list-group-item {
  transition: background-color 0.15s, border-color 0.15s;
  border-color: #e9ecef !important;
  padding: 12px 16px !important;
}
.list-group-item:hover {
  background-color: #f0f4ff !important;
  border-color: #0d6efd !important;
}

/* --- Profile Cards --- */
.profile-card {
  border-radius: 10px !important;
  border: 1px solid #e5e7eb !important;
  transition: transform 0.2s, box-shadow 0.2s !important;
  overflow: hidden;
}
.profile-card:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.1) !important;
}
.profile-card img {
  border-radius: 50%;
  object-fit: cover;
}

/* --- Info Box (ui-body-a) --- */
.ui-body-a {
  background-color: #f8f9fb !important;
  padding: 1.5rem !important;
  border-radius: 8px !important;
  border-left: 4px solid #0d6efd !important;
  line-height: 1.8 !important;
  font-size: 0.95rem;
  color: #333;
}

/* --- Badges --- */
.badge {
  font-weight: 600 !important;
  font-size: 0.75rem !important;
  padding: 4px 10px !important;
  border-radius: 4px !important;
}

/* --- Footer-like bottom area --- */
.text-muted {
  color: #8898aa !important;
}

/* --- Responsive Tables (custom grid) --- */
.responsive-table {
  margin-bottom: 1.5rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}
.responsive-table-header,
.responsive-table-row {
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  align-items: center;
}
.responsive-table-header {
  background: #f8f9fb;
  font-weight: 700;
  color: #4a5568;
  font-size: 0.85rem;
}
.responsive-table-row {
  border-top: 1px solid #f0f1f3;
}
.responsive-table-row:first-child { border-top: none; }
.responsive-table-cell {
  padding: 0.5rem 0.75rem;
  word-break: break-word;
}
.responsive-table-cell.header-cell {
  font-size: 0.85rem;
  color: #4a5568;
}
@media (min-width: 992px) {
  .responsive-table-header,
  .responsive-table-row {
    grid-template-columns: repeat(var(--columns, 1), minmax(0, 1fr));
  }
}
@media (max-width: 991.98px) {
  .responsive-table-header { display: none; }
  .responsive-table-row { grid-template-columns: 1fr; }
  .responsive-table-cell {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #e9ecef;
  }
  .responsive-table-cell:last-child { border-bottom: none; }
  .responsive-table-cell::before {
    content: attr(data-label);
    font-weight: 700;
    margin-right: 0.75rem;
    color: #4a5568;
    flex-shrink: 0;
    min-width: 110px;
    white-space: nowrap;
  }
  .content-card {
    padding: 1.2rem 1rem !important;
  }
}
.responsive-table .responsive-table-cell > .table-responsive { width: 100%; }

/* --- Global Image Responsiveness --- */
img, picture, svg, iframe, embed, object, video {
  max-width: 100%;
  height: auto;
}

.container, .row, .col, .card, .content-card, .ui-body-a {
  box-sizing: border-box;
}
a, button, input, textarea, select {
  word-break: break-word;
}

/* --- Legacy Typography Normalization --- */
.style4, .style6 { font-size: 0.875rem !important; }
.style5, .style7, .style9 { font-size: 1rem !important; line-height: 1.6 !important; }

/* --- Year Page Event Tables --- */
td[style*="text-align:right"] {
  font-weight: 600;
  color: #333;
}

/* ===== Layout Table → Visual Card Conversion =====
   Most tables are layout tables for fight cards (no <th>, 1-3 cols).
   These CSS rules transform them into clean card-style blocks
   without touching the HTML structure. */

/* Remove heavy borders from inner layout tables */
.table-responsive .table.table-bordered,
.content-card .table.table-bordered {
  border: none !important;
  border-collapse: separate !important;
  border-spacing: 0 8px !important;
  background: transparent !important;
  margin-bottom: 12px !important;
}
.table-responsive .table.table-bordered td,
.content-card .table.table-bordered td {
  border: none !important;
  background: #f8f9fb !important;
  padding: 10px 16px !important;
  vertical-align: middle !important;
}
.table-responsive .table.table-bordered tr,
.content-card .table.table-bordered tr {
  background: transparent !important;
}
/* First row in a fight card = match title (usually spans full width) */
.table-responsive .table.table-bordered tbody tr:first-child td {
  background: #eef2ff !important;
  font-weight: 700 !important;
  color: #1a1a2e !important;
  border-radius: 6px !important;
  font-size: 0.9rem !important;
}
/* Fight matchup row: fighter vs fighter */
.table-responsive .table.table-bordered tbody tr td:first-child {
  border-radius: 6px 0 0 6px !important;
}
.table-responsive .table.table-bordered tbody tr td:last-child {
  border-radius: 0 6px 6px 0 !important;
}
/* Single-cell rows (result line) */
.table-responsive .table.table-bordered tbody tr:last-child td {
  font-size: 0.85rem !important;
  color: #555 !important;
  background: #f0f1f3 !important;
  border-radius: 6px !important;
}
/* "vs" middle cell */
.table-responsive .table.table-bordered td:only-of-type,
.table-responsive .table.table-bordered tbody tr td[align="center"] {
  text-align: center;
  font-weight: 800;
  color: #888;
  font-size: 0.8rem;
  padding: 6px 8px !important;
  background: transparent !important;
}

/* Winner/Loser markers */
.table-responsive .table.table-bordered td {
  line-height: 1.6;
}

/* Nested table-responsive wrappers: clean up margins */
.table-responsive .table-responsive {
  margin-bottom: 0 !important;
  padding: 0 !important;
}
.table-responsive > .table-responsive > .table {
  margin: 0 !important;
}

/* Empty table cells/rows: hide */
.table-responsive .table.table-bordered td:empty {
  display: none;
}
.table-responsive .table.table-bordered tr:has(td:empty:only-child) {
  display: none;
}

/* --- Event info header (★日時... line) --- */
.table-responsive .table.table-bordered td[colspan] {
  background: #1a1a2e !important;
  color: #fff !important;
  font-weight: 700 !important;
  padding: 14px 20px !important;
  border-radius: 8px !important;
  font-size: 0.9rem !important;
  line-height: 1.8 !important;
}

/* --- Database report page tables --- */
.content-card .table {
  font-size: 0.9rem !important;
}
.content-card .table img {
  border-radius: 6px;
  margin: 4px 0;
}

/* ===== Event Detail: Semantic Fight Cards ===== */
.event-info {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  color: #fff;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
}
.ei-item { display: flex; align-items: center; gap: 6px; }
.ei-label { font-size: 13px; opacity: 0.7; }
.ei-val { font-size: 15px; font-weight: 600; }

.fight-card-block {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
  transition: box-shadow .15s;
}
.fight-card-block:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.fight-title {
  background: #f0f4ff;
  color: #1a1a2e;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid #dde4f0;
}
.fight-matchup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 20px;
  flex-wrap: wrap;
}
.fight-matchup .fighter {
  flex: 1;
  min-width: 120px;
  font-size: 15px;
  line-height: 1.6;
}
.fight-matchup .fighter:last-child {
  text-align: right;
}
.fight-matchup .fighter.winner {
  font-weight: 700;
  color: #1a6ed8;
}
.fight-matchup .fighter.loser {
  color: #888;
}
.fight-matchup .fighter a {
  font-weight: 700;
}
.fight-matchup .vs {
  font-weight: 900;
  font-size: 13px;
  color: #c0c0c0;
  letter-spacing: 0.1em;
  flex-shrink: 0;
  width: 40px;
  text-align: center;
}
.fight-result {
  background: #f8f9fb;
  color: #555;
  font-size: 13px;
  padding: 8px 18px;
  border-top: 1px solid #f0f1f3;
}
.fight-comment-header {
  font-weight: 700;
  font-size: 16px;
  color: #1a1a2e;
  padding: 20px 0 8px;
  border-bottom: 2px solid #0d6efd;
  margin: 24px 0 12px;
}

@media (max-width: 640px) {
  .event-info { flex-direction: column; padding: 16px; }
  .fight-matchup { flex-direction: column; gap: 8px; text-align: center !important; }
  .fight-matchup .fighter { text-align: center !important; }
  .fight-matchup .fighter:last-child { text-align: center !important; }
}

/* --- Scroll-to-top hint --- */
@media (max-width: 640px) {
  body { padding-top: 70px !important; }
  .navbar-brand { font-size: 16px !important; }
  /* Stack fight matchup cells on mobile */
  .table-responsive .table.table-bordered td {
    display: block !important;
    width: 100% !important;
    border-radius: 0 !important;
  }
  .table-responsive .table.table-bordered tbody tr:first-child td {
    border-radius: 6px 6px 0 0 !important;
  }
  .table-responsive .table.table-bordered tbody tr:last-child td {
    border-radius: 0 0 6px 6px !important;
  }
}
