/* =====================
   RESET & BASE
   ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Georgia', serif;
  font-size: 14px;
  color: #222;
  background: #fff;
  line-height: 1.5;
}

a { color: #1a3a7a; text-decoration: underline; }
a:hover { color: #2050a0; }

/* =====================
   HEADER
   ===================== */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 26px 28px 19px;
  border-bottom: 3px solid #1a3a7a;
  gap: 20px;
  background: #fafafa;
}

.header-inner h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #1a3a7a;
  letter-spacing: -0.5px;
  line-height: 1.15;
}

.subtitle {
  font-size: 13px;
  color: #444;
  max-width: 640px;
  margin-bottom: 4px;
}

.subtitle-note {
  font-size: 12px;
  color: #555;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.lang-switcher {
  display: flex;
  gap: 2px;
}

.lang-btn {
  background: none;
  border: 1px solid #bbb;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: sans-serif;
  border-radius: 3px;
  cursor: pointer;
  color: #555;
  letter-spacing: 0.5px;
  transition: background 0.15s, color 0.15s;
}
.lang-btn:hover { background: #e8f0fb; border-color: #1a3a7a; color: #1a3a7a; }
.lang-btn.active { background: #1a3a7a; color: #fff; border-color: #1a3a7a; }

.cendai-logo-link {
  display: block;
  margin-bottom: 4px;
}
.cendai-logo {
  width: 200px;
  height: auto;
  display: block;
}

.subscribe-box {
  display: flex;
  gap: 6px;
}

.subscribe-box input {
  border: 1px solid #bbb;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 3px;
  width: 200px;
  font-family: sans-serif;
}

.btn-subscribe {
  background: #6b3fa0;
  color: #fff;
  border: none;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 3px;
  cursor: pointer;
  font-family: sans-serif;
}
.btn-subscribe:hover { background: #5a3090; }

.csv-box {
  text-align: right;
}

.btn-csv {
  background: none;
  border: none;
  color: #1a3a7a;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  font-family: Georgia, serif;
}
.btn-csv:hover { color: #2050a0; }

.hero-actions {
  margin-top: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.btn-hero-submit {
  background: #1a3a7a;
  color: #fff;
  border: none;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: sans-serif;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-hero-submit:hover { background: #2050a0; }
.hero-note {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.7);
  font-style: italic;
}

.last-updated {
  font-size: 11px;
  color: #888;
  margin-top: 4px;
}

/* =====================
   LAYOUT
   ===================== */
.layout {
  display: flex;
  min-height: calc(100vh - 130px);
}

/* =====================
   SIDEBAR
   ===================== */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  padding: 18px 16px;
  border-right: 1px solid #ddd;
  overflow-y: auto;
}

.search-wrap input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #bbb;
  border-radius: 3px;
  font-size: 13px;
  font-family: sans-serif;
}

.btn-graphs {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  background: #1a3a7a;
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: sans-serif;
}
.btn-graphs:hover { background: #2050a0; }

.filter-section {
  margin-top: 18px;
}

.filter-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
  color: #333;
  margin-bottom: 8px;
  font-family: sans-serif;
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid #ccc;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  background: #fff;
  color: #333;
  user-select: none;
  font-family: sans-serif;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.tag:hover { background: #f0e0e0; border-color: #999; }
.tag.active { background: #1a3a7a; color: #fff; border-color: #1a3a7a; }

select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #bbb;
  border-radius: 3px;
  font-size: 13px;
  font-family: sans-serif;
  background: #fff;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 6px;
  font-family: sans-serif;
}

input[type="range"] {
  width: 100%;
  margin-top: 6px;
  accent-color: #1a3a7a;
}

.reset-section { border-top: 1px solid #eee; padding-top: 14px; }

.btn-reset {
  background: none;
  border: 1px solid #bbb;
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 3px;
  cursor: pointer;
  font-family: sans-serif;
  color: #555;
}
.btn-reset:hover { background: #f5f5f5; }

/* =====================
   CONTENT / TABLE
   ===================== */
.content {
  flex: 1;
  overflow-x: auto;
  padding: 16px 20px;
}

.table-meta {
  font-size: 12px;
  color: #666;
  margin-bottom: 10px;
  font-family: sans-serif;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: #fff;
  border-bottom: 2px solid #222;
  padding: 8px 10px;
  text-align: left;
  font-family: sans-serif;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: bottom;
}

.sortable { cursor: pointer; }
.sortable:hover { color: #1a3a7a; }
.sort-arrow { font-size: 10px; }

tbody tr { border-bottom: 1px solid #e8e8e8; }
tbody tr:hover { background: #fafafa; }

tbody td {
  padding: 10px 10px;
  vertical-align: top;
  font-size: 13px;
}

.col-case { min-width: 180px; max-width: 240px; }
.col-court { min-width: 150px; }
.col-date { min-width: 80px; white-space: nowrap; }
.col-party { min-width: 110px; }
.col-tool { min-width: 110px; }
.col-nature { min-width: 160px; }
.col-outcome { min-width: 180px; }
.col-penalty { min-width: 90px; text-align: right; }

.case-link {
  color: #1a3a7a;
  text-decoration: underline;
  font-weight: normal;
}

.source-row td {
  padding: 2px 10px 6px;
  font-size: 11px;
  color: #888;
  font-style: italic;
  border-bottom: none;
}
.source-row td a { color: #888; font-size: 11px; }

/* Nature tags */
.nature-block { margin-bottom: 4px; }
.nature-cat {
  display: inline-block;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 7px;
  border: 1px solid #bbb;
  border-radius: 3px;
  background: #f8f8f8;
  margin-bottom: 1px;
  font-family: sans-serif;
}
.nature-sub {
  font-size: 11px;
  color: #555;
  font-family: sans-serif;
}

.info-icon {
  cursor: help;
  color: #888;
  font-size: 12px;
}

.no-results {
  text-align: center;
  color: #888;
  padding: 40px;
  font-family: sans-serif;
  font-size: 14px;
}

/* =====================
   MODAL / GRAPHS
   ===================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #fff;
  border-radius: 6px;
  padding: 28px 32px;
  max-width: 860px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-content h2 {
  font-size: 18px;
  margin-bottom: 20px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #555;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.chart-box {
  border: 1px solid #eee;
  border-radius: 4px;
  padding: 16px;
}

.chart-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  font-family: sans-serif;
  color: #333;
}

/* =====================
   SUBMIT FORM
   ===================== */
.submit-intro {
  font-size: 13px;
  color: #555;
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.form-row {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}

.form-row label {
  font-size: 12px;
  font-weight: 700;
  font-family: sans-serif;
  margin-bottom: 4px;
  color: #333;
}

.form-row input[type="text"],
.form-row input[type="date"],
.form-row input[type="email"],
.form-row select {
  padding: 7px 9px;
  border: 1px solid #bbb;
  border-radius: 3px;
  font-size: 13px;
  font-family: sans-serif;
}

.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.check-grid label {
  font-weight: 400;
  font-size: 13px;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  display: flex;
  margin-bottom: 0;
}

.captcha-row { margin-top: 8px; }

input[type="file"] {
  width: 100%;
  padding: 6px 0;
  font-size: 13px;
  cursor: pointer;
}
.file-hint {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.submit-msg {
  font-size: 13px;
  font-family: sans-serif;
  margin: 8px 0;
}
.submit-msg.success { color: #1e7a36; }
.submit-msg.error { color: #1a3a7a; }

.form-actions { margin-top: 12px; }

.btn-primary {
  background: #1a3a7a;
  color: #fff;
  border: none;
  padding: 9px 18px;
  font-size: 14px;
  border-radius: 3px;
  cursor: pointer;
  font-family: sans-serif;
  font-weight: 600;
}
.btn-primary:hover { background: #2050a0; }
.btn-primary:disabled { opacity: .6; cursor: default; }

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .site-header { flex-direction: column; }
  .header-right { align-items: flex-start; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid #ddd; }
  .charts-grid { grid-template-columns: 1fr; }
}
