@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700;800&display=swap");

:root {
  --primary: #9c0032;
  --primary-light: #d61c4e;
  --secondary: #ffb100;
  --dark: #1a1a1a;
  --light: #fdfdfd;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-600: #6c757d;
  --success: #28a745;
  --danger: #dc3545;
  --white: #ffffff;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg:
    0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --radius: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Be Vietnam Pro", sans-serif;
  background-color: #f0f2f5;
  color: var(--dark);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 12px;
}

/* --- Header --- */
.main-header {
  background: linear-gradient(135deg, var(--primary) 0%, #600020 100%);
  color: var(--white);
  padding: 40px 0 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
  border-bottom-left-radius: 40px;
  border-bottom-right-radius: 40px;
  box-shadow: var(--shadow-lg);
  margin-bottom: -30px;
  z-index: 10;
}

.main-header::before {
  content: "";
  position: absolute;
  top: -50px;
  right: -50px;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}

.date-display {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(5px);
  padding: 6px 16px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.main-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
  font-size: 1rem;
  opacity: 0.85;
  font-weight: 400;
}

/* --- Navigation Tabs --- */
.tabs-container {
  display: flex;
  background: var(--white);
  padding: 6px;
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  gap: 4px;
  position: relative;
  z-index: 20;
}

.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  border-radius: 14px;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  background-color: var(--gray-100);
  color: var(--primary);
}

.tab-btn.active {
  background-color: var(--primary);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(156, 0, 50, 0.3);
}

/* --- Cards --- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.section-title {
  color: var(--primary);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--gray-100);
  position: relative;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--secondary);
}

/* --- Prediction Table --- */
.result-display {
  margin-top: 10px;
}

#full-prediction-container {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  min-height: 600px;
}

.prediction-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}

.prediction-table thead th {
  background: var(--gray-100);
  color: var(--dark);
  padding: 14px 10px;
  font-weight: 700;
  font-size: 0.95rem;
  border-bottom: 2px solid var(--gray-200);
}

.prediction-table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--gray-100);
  text-align: center;
  font-weight: 600;
}

.prediction-table tr:last-child td {
  border-bottom: none;
}

.prize-name {
  background-color: var(--gray-100);
  color: var(--gray-600);
  font-size: 0.85rem;
  font-weight: 700;
  width: 60px;
}

.station-header {
  color: var(--primary) !important;
  background: #fff5f7 !important;
  border-bottom: 2px solid var(--primary-light) !important;
}

.prize-numbers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 12px;
  font-size: 1.15rem;
  color: #222;
}

.prize-numbers.special {
  color: var(--primary);
  font-size: 1.5rem;
  font-weight: 800;
}

.prize-numbers.g8 {
  color: var(--primary-light);
  font-weight: 700;
}

/* Loto Head/Tail Table */
.loto-header {
  background-color: var(--primary) !important;
  color: var(--white) !important;
  font-weight: 700 !important;
  padding: 8px !important;
}

.head-col {
  background-color: var(--gray-100);
  color: var(--primary);
  font-weight: 800;
  width: 45px;
}

.tail-col {
  text-align: left !important;
  padding-left: 15px !important;
  font-family: monospace;
  font-size: 1.05rem;
  letter-spacing: 1px;
}

/* --- Display Options Bar --- */
.display-options {
  background-color: #2d3436;
  padding: 12px 20px;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  margin-top: -1px;
}

.options-group {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.options-group label {
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.options-group label:hover {
  color: var(--secondary);
}

.options-group input[type="radio"] {
  accent-color: var(--secondary);
  width: 18px;
  height: 18px;
}

/* --- Sổ Mơ (Dream Book) --- */
.somo-search-container {
  margin-bottom: 24px;
  position: relative;
}

.somo-search-container input {
  width: 100%;
  padding: 16px 20px 16px 50px;
  border: 2px solid var(--gray-200);
  border-radius: 30px;
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  background: white;
  box-shadow: var(--shadow-sm);
}

.somo-search-container::before {
  content: "🔍";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  opacity: 0.5;
}

.somo-search-container input:focus {
  border-color: var(--primary-light);
  outline: none;
  box-shadow: 0 0 0 4px rgba(214, 28, 78, 0.1);
}

#somo-table-container {
  max-height: 600px;
  overflow-y: auto;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  background: white;
  position: relative;
}

.somo-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.somo-virtual-content {
  position: relative;
  width: 100%;
}

.somo-table thead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--gray-100);
}

.somo-table th {
  padding: 15px;
  font-weight: 700;
  text-align: left;
  border-bottom: 2px solid var(--gray-200);
  background: var(--gray-100);
}

.somo-table td {
  padding: 0 15px;
  border-bottom: 1px solid var(--gray-100);
  height: 50px; /* Fixed height for virtualization */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.somo-row-container {
  position: absolute;
  left: 0;
  width: 100%;
}

.somo-table tr:hover {
  background-color: #fff9fa;
}

.somo-table td:last-child {
  color: var(--primary);
  font-weight: 800;
  font-size: 1.1rem;
}

/* --- Embed Section --- */
.section-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.form-select-sm {
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid var(--gray-200);
  font-weight: 600;
  outline: none;
  background: var(--white);
  color: var(--primary);
  cursor: pointer;
  transition: var(--transition);
}

.form-select-sm:focus {
  border-color: var(--primary-light);
}

#embed-container {
  border-radius: 12px;
  overflow: hidden;
  background: white;
  min-height: 500px;
  border: 1px solid var(--gray-200);
}

/* --- Misc --- */
.time-warning {
  background: #fff8eb;
  color: #856404;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #ffeeba;
  font-weight: 600;
  text-align: center;
  margin-bottom: 20px;
}

.note {
  font-size: 0.85rem;
  color: var(--gray-600);
  text-align: center;
  margin-top: 15px;
}

.seo-content {
  margin: 40px 0;
}

.seo-content h2 {
  font-size: 1.3rem;
  margin-bottom: 15px;
  color: var(--primary);
}

.seo-content p {
  color: var(--gray-600);
  font-size: 0.95rem;
  margin-bottom: 15px;
  line-height: 1.7;
}

/* --- Footer --- */
.main-footer {
  background: #1e272e;
  color: #d1d8e0;
  padding: 60px 0;
  text-align: center;
  border-top-left-radius: 40px;
  border-top-right-radius: 40px;
}

.main-footer h3 {
  color: white;
  margin-bottom: 15px;
}

.copyright {
  margin-top: 30px;
  font-size: 0.8rem;
  opacity: 0.5;
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
  .main-header {
    padding: 30px 0 50px;
  }
  .main-header h1 {
    font-size: 1.7rem;
  }
  .tabs-container {
    padding: 4px;
  }
  .tab-btn {
    padding: 10px 5px;
    font-size: 0.85rem;
  }
  .card {
    padding: 16px;
  }
  .prize-numbers {
    font-size: 1rem;
    gap: 4px 8px;
  }
  .prize-numbers.special {
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  .header-controls {
    flex-direction: column;
    gap: 15px;
  }
  .options-group {
    gap: 12px;
  }
  .options-group label {
    font-size: 0.8rem;
  }
  .prediction-table td {
    padding: 8px 4px;
    font-size: 0.85rem;
  }
  .prize-name {
    width: 45px;
    font-size: 0.75rem;
  }
}
