/**
 * KetQua module styles (responsive + cleanup)
 * File: modules/ketqua/assets/css/ketqua.css
 */

/* Helpers (thay inline style) */
.kq-region-date {
  font-size: 14px;
  opacity: 0.9;
}

.kq-icon-action-btn {
  font-size: 1.2rem;
  cursor: pointer;
  text-decoration: none;
}

.kq-empty-cell {
  padding: 40px;
}

.kq-placeholder {
  font-size: 0.9rem;
}

/* Prize table: label column */
.kq-prize-label {
  width: 20%;
  vertical-align: middle;
  font-size: 16px;
}

.kq-prize-label--special {
  color: red;
}

.kq-prize-cell {
  padding: 0;
}

.kq-prize-row-flex {
  display: flex;
  flex-wrap: wrap;
}

.kq-prize-inner {
  padding: 15px;
}

.kq-muted-pad {
  padding: 15px;
}

/* Loto comments: avoid inline styles */
#loto-comments-north {
  display: none;
}

.kq-loto-comments {
  display: none;
}

.kq-loto-comments-title {
  font-size: 14px;
  color: #666;
}

.kq-loto-comments-box {
  background: #f8f9fa;
  padding: 10px;
  border-radius: 4px;
  font-size: 13px;
  min-height: 40px;
}

.kq-loto-comments-empty {
  font-size: 12px;
}

/* Thống kê nhanh - theo ảnh mẫu: cột trái hẹp (số dọc), 5 cột phải lưới, hàng xen kẽ */
.kq-quick-stats-card {
  border: 1px solid #dee2e6;
  border-radius: 10px;
}

.kq-quick-stats-card .card-body {
  background: #fff;
}

.kq-quick-stats-card .card-body > h6 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #212529;
}

.kq-quick-stats-table {
  font-size: 0.9rem;
  background: #fff;
  margin-bottom: 1rem;
  table-layout: fixed;
  width: 100%;
}

.kq-quick-stats-table th,
.kq-quick-stats-table td {
  border: 1px solid #dee2e6;
  padding: 10px 12px;
  vertical-align: middle;
}

/* Header: thanh xám đậm, chữ in hoa như ảnh */
.kq-quick-stats-th {
  background: #e9ecef;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-align: center;
  color: #212529;
}

/* Cột trái hẹp (số xếp dọc), 5 cột phải lưới đều */
.kq-quick-stats-table tbody td:first-child {
  width: 14%;
  min-width: 5rem;
  text-align: center;
}

.kq-quick-stats-table tbody td {
  text-align: center;
}

/* Hàng xen kẽ: trắng / xám rất nhạt */
.kq-quick-stats-table tbody tr:nth-child(odd) td {
  background: #fff;
}

.kq-quick-stats-table tbody tr:nth-child(even) td {
  background: #f8f9fa;
}

.kq-quick-stats-card .row.g-2 {
  margin-bottom: 0;
}

/* Bảng Đầu số / Đuôi số: không xuống dòng khi số lần 3 chữ số (103 lần, 125 lần...) */
.kq-quick-stats-head-tail {
  table-layout: auto;
}
.kq-quick-stats-head-tail td {
  white-space: nowrap;
}

/* ============================================
   KQXS RESULTS TABLE — Layout & Typography
   ============================================ */

/* Table structure */
.KQXS-Table {
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
}

/* Colgroup column sizing */
.kq-col-label {
  width: 90px;
}
.kq-col-value {
  width: auto;
}

/* Prize number base styles */
.kq-prize-item {
  display: block;
  text-align: center;
  padding: 8px 4px;
  font-weight: 700;
  font-family: var(--font-number, 'Inter', 'Roboto', system-ui, sans-serif);
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
  letter-spacing: normal;
  line-height: 1.4;
  word-spacing: 4px;
  float: left;
  box-sizing: border-box;
}

/* Font size variants */
.kq-text-md { font-size: 16px; }
.kq-text-lg { font-size: 20px; }
.kq-text-xl { font-size: 28px; font-weight: 800; }

/* Color variants */
.kq-text-red { color: #DC2626 !important; }
.kq-text-gray { color: rgb(239 68 68 / var(--tw-text-opacity, 1)); }
.kq-no-reload { }

/* Row gutters reset */
.row-no-gutters {
  margin-left: 0;
  margin-right: 0;
  overflow: hidden;
}

/* Flex wrap for prize cells — use float-based clearfix instead */
.kq-prize-row-flex {
  overflow: hidden;
}
.kq-prize-row-flex::after {
  content: '';
  display: table;
  clear: both;
}

/* Auto border between adjacent prize cells */
.kq-prize-row-flex > .kq-prize-item {
  border-right: 1px solid #E5E7EB;
  border-bottom: 1px solid #E5E7EB;
}
.kq-prize-row-flex > .kq-prize-item.num-code {
  border: none !important;
  border-right: none !important;
  border-bottom: none !important;
}
.kq-prize-row-flex > .kq-prize-item:last-child {
  border-right: none;
}
/* For single-value prizes (100% width), hide bottom border */
.kq-prize-row-flex > .kq-prize-item[style*="width:100%"] {
  border-right: none;
  border-bottom: none;
}

/* runloto highlight */
.runloto {
  color: #DC2626;
  font-weight: 800;
}

/* ============================================
   RESPONSIVE — Desktop (default)
   ============================================ */
.kq-prize-label {
  width: 15%;
  min-width: 80px;
  vertical-align: middle;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px !important;
}

.kq-prize-cell {
  padding: 0 !important;
}

/* ============================================
   RESPONSIVE — Large Desktop (>= 1400px)
   ============================================ */
@media (min-width: 1400px) {
  .kq-text-md { font-size: 18px; }
  .kq-text-lg { font-size: 22px; }
  .kq-text-xl { font-size: 32px; }
  
  .kq-prize-item {
    padding: 10px 6px;
    letter-spacing: 1px;
    word-spacing: 6px;
  }

  .kq-prize-label {
    font-size: 15px;
    padding: 10px 16px !important;
  }
}

/* ============================================
   RESPONSIVE — Ultra-wide (>= 1920px)
   ============================================ */
@media (min-width: 1920px) {
  .kq-text-md { font-size: 20px; }
  .kq-text-lg { font-size: 24px; }
  .kq-text-xl { font-size: 36px; }
  
  .kq-prize-item {
    padding: 12px 8px;
    letter-spacing: 1.5px;
    word-spacing: 8px;
  }

  .kq-prize-label {
    font-size: 16px;
    padding: 12px 20px !important;
  }
}

/* ============================================
   RESPONSIVE — Tablet (768px - 1023px)
   ============================================ */
@media (max-width: 1023.98px) {
  .kq-text-md { font-size: 14px; }
  .kq-text-lg { font-size: 17px; }
  .kq-text-xl { font-size: 24px; }
  
  .kq-prize-item {
    padding: 7px 3px;
    letter-spacing: 0.5px;
    word-spacing: 3px;
  }

  .kq-prize-label {
    font-size: 13px;
    width: 18%;
    padding: 7px 8px !important;
  }
}

/* ============================================
   RESPONSIVE — Mobile (< 768px)
   ============================================ */
@media (max-width: 767.98px) {
  .kq-text-md { font-size: 12px; }
  .kq-text-lg { font-size: 14px; }
  .kq-text-xl { font-size: 20px; }
  
  .kq-prize-item {
    padding: 5px 2px;
    letter-spacing: 0.3px;
    word-spacing: 2px;
  }

  .kq-prize-label {
    font-size: 12px;
    width: 20%;
    min-width: 60px;
    padding: 5px 6px !important;
  }

  .kq-prize-inner,
  .kq-muted-pad {
    padding: 8px;
  }

  .kq-empty-cell {
    padding: 24px;
  }
}

/* ============================================
   RESPONSIVE — Small Mobile (< 480px)
   ============================================ */
@media (max-width: 479.98px) {
  .kq-text-md { font-size: 11px; }
  .kq-text-lg { font-size: 12px; }
  .kq-text-xl { font-size: 17px; }
  
  .kq-prize-item {
    padding: 4px 1px;
    letter-spacing: 0;
    word-spacing: 1px;
  }

  .kq-prize-label {
    font-size: 11px;
    width: 22%;
    min-width: 50px;
    padding: 4px 4px !important;
  }
}

/* Thống kê nhanh - responsive (mobile & tablet) */
.kq-quick-stats-card {
  overflow-x: hidden;
  max-width: 100%;
}
.kq-quick-stats-card .card-body {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 767.98px) {
  .kq-quick-stats-card {
    margin-left: 0;
    margin-right: 0;
    border-radius: 0.375rem;
  }
  .kq-quick-stats-card .card-body {
    padding: 0.75rem;
  }
  .kq-quick-stats-card .card-body > h6 {
    font-size: 1rem;
  }
  .kq-quick-stats-table {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
  }
  .kq-quick-stats-table th,
  .kq-quick-stats-table td {
    padding: 6px 8px;
  }
  .kq-quick-stats-th {
    font-size: 0.7rem;
    padding: 8px 6px;
    line-height: 1.25;
  }
  .kq-quick-stats-card .row.g-2 {
    margin-left: -0.25rem;
    margin-right: -0.25rem;
  }
  .kq-quick-stats-card .row.g-2 .col-md-6 {
    flex: 0 0 100%;
    max-width: 100%;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }
}
@media (max-width: 575.98px) {
  .kq-quick-stats-card .card-body {
    padding: 0.5rem 0.6rem;
  }
  .kq-quick-stats-table {
    font-size: 0.75rem;
  }
  .kq-quick-stats-table th,
  .kq-quick-stats-table td {
    padding: 5px 6px;
  }
  .kq-quick-stats-th {
    font-size: 0.65rem;
  }
  .kq-quick-stats-table tbody td:first-child {
    min-width: 3.5rem;
  }
}

/* ============================================
   STATION SUB-TABS (MT/MN per-station tabs)
   ============================================ */

/* Sub-tab bar container */
.station-sub-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}
.station-sub-tabs::-webkit-scrollbar {
  display: none;
}

/* Sub-tab button */
.station-sub-tab-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 9999px;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  line-height: 1.4;
}
.station-sub-tab-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #eff6ff;
}
.station-sub-tab-btn.active {
  background: #111827;
  color: #fff;
  border-color: #111827;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Station tab pane */
.station-tab-pane {
  display: none;
}
.station-tab-pane.active {
  display: block;
}

/* Single-station result table */
.single-station-table {
  width: 100%;
  border-collapse: collapse;
}
.single-station-table .prize-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  border-bottom: 1px solid #e5e7eb;
}
.single-station-table .prize-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 6px;
  background: #f9fafb;
  border-right: 1px solid #e5e7eb;
  white-space: nowrap;
  color: #374151;
}
.single-station-table .prize-numbers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  padding: 4px;
  text-align: center;
  min-height: 36px;
}

/* Single station prize items — larger and more readable */
.single-station-table .kq-prize-item {
  float: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
}

/* Single station header */
.single-station-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f3f4f6;
  border-bottom: 2px solid #111827;
}
.single-station-header .station-name {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
}
.single-station-header .station-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #6b7280;
}

/* ── Responsive: Mobile defaults to per-station tab ── */
@media (max-width: 767.98px) {
  .station-sub-tab-btn {
    padding: 5px 12px;
    font-size: 12px;
  }
  .station-sub-tabs {
    padding: 6px 8px;
    gap: 4px;
  }
  .single-station-table .prize-row {
    grid-template-columns: 70px 1fr;
  }
  .single-station-table .prize-label {
    font-size: 12px;
    padding: 6px 4px;
  }
  .single-station-header {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 4px;
  }
  .single-station-header .station-name {
    font-size: 14px;
  }
}

@media (max-width: 479.98px) {
  .single-station-table .prize-row {
    grid-template-columns: 56px 1fr;
  }
  .single-station-table .prize-label {
    font-size: 11px;
    padding: 4px 2px;
  }
}

/* ── Dark mode support for station sub-tabs ── */
.dark .station-sub-tabs {
  background: #1e293b;
  border-color: #334155;
}
.dark .station-sub-tab-btn {
  background: #0f172a;
  color: #94a3b8;
  border-color: #334155;
}
.dark .station-sub-tab-btn:hover {
  border-color: #3b82f6;
  color: #3b82f6;
  background: #1e3a5f;
}
.dark .station-sub-tab-btn.active {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #e2e8f0;
}
.dark .single-station-table .prize-row {
  border-color: #334155;
}
.dark .single-station-table .prize-label {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}
.dark .single-station-header {
  background: #1e293b;
  border-color: #e2e8f0;
}
.dark .single-station-header .station-name {
  color: #e2e8f0;
}


