html, body {
  min-height: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f7fb;
  margin: 0;
  padding: 0;
}

/* Header */
.app-header-main {
    background: #fff;
    color: #fff;
    padding: 20px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

/* Main Container */
.main-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container2 {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  flex-wrap: wrap;
  gap: 10px;
}

.header-title {
  flex: 1;
  min-width: 0;
}

.header-title img {
  max-width: 100%;
  height: auto;
}

.buttonMySite {
  background: #e5e9f0;
  color: #333;
  border: 0;
  border-radius: 8px;
  font-weight: 500;
  font-size: 15px;
  padding: 0 20px;
  height: 44px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Mobile (mặc định) */
.main-content {
  flex: 1;
  padding: 10px 20px;
}

/* Tablet */
@media (min-width: 768px) {
  .main-content {
    padding: 20px 50px;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .main-content {
    padding: 30px 150px;
  }
}

/* Wheel Section */
.wheel-section {
  padding: 20px 10px 10px;
}

.wheel-container-main {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

.wheel-wrapper-main {
  position: relative;
  width: 100%;
  max-width: 500px;
  aspect-ratio: 1;
}

#wheelCanvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid #0c3f73;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  background: #0c3f73;
}

.wheel-pointer-main {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-bottom: 30px solid #0c3f73;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
  z-index: 10;
}

.wheel-center-main {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid #0c3f73;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  z-index: 5;
}

.center-text-main {
  font-weight: 700;
  color: #0c3f73;
  font-size: 18px;
  text-align: center;
}

.wheel-info {
  text-align: center;
  margin-bottom: 20px;
}

.remaining-text {
  font-size: 16px;
  color: #333;
  margin: 0;
  font-weight: 600;
}

.wheel-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.btn-load, .btn-spin-main {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-load {
  background: #e5e9f0;
  color: #333;
}

.btn-load:hover {
  background: #d0d5dc;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-spin-main {
  background: #0c3f73;
  color: #fff;
}

.btn-spin-main:hover:not(:disabled) {
  background: #0a325d;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(12,63,115,0.3);
}

.btn-spin-main:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.reload-page-section {
  text-align: center;
}

.btn-reload-page {
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 6px;
}

/* Cards */
.card-modern {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  border: 1px solid #e5e9f0;
  overflow: hidden;
  transition: all 0.3s ease;
}

.card-modern:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

.card-header-modern {
  background: #f8f9fa;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e9f0;
}

.card-title-modern {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 700;
  color: #0c3f73;
}

.card-subtitle-modern {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
}

.card-body-modern {
  padding: 20px;
}

/* Làm khung \"Danh sách người tham gia\" cao bằng khung vòng quay */
/* Hàng trên: làm khung danh sách người tham gia cao bằng khung vòng quay */
.row-top-equal {
  align-items: stretch;
}

.row-top-equal > .col-lg-6 {
  display: flex;
}

.wheel-section,
.card-participants {
  flex: 1;
}

.wheel-section,
.card-participants {
  width: 100%;
}

/* Chiều cao tối thiểu để 2 khung cân nhau (giảm bớt khoảng trống dưới nút) */
.wheel-section,
.card-participants {
  min-height: 540px;
}

/* Khi số lượng người vượt quá thì cho scroll trong vùng bảng, giữ header và nút bên dưới */
.participants-table-scroll {
  max-height: 260px;
  overflow-y: auto;
}

/* Tables */
.table-participants, .table-winners {
  margin-bottom: 0;
  font-size: 14px;
}

.table-participants thead, .table-winners thead {
  background: #f8f9fa;
}

.table-participants th, .table-winners th {
  font-weight: 600;
  color: #0c3f73;
  border-bottom: 2px solid #0c3f73;
  padding: 12px 8px;
  font-size: 13px;
}

.table-participants td, .table-winners td {
  padding: 10px 8px;
  vertical-align: middle;
  border-bottom: 1px solid #e5e9f0;
}

.table-participants tbody tr:hover, .table-winners tbody tr:hover {
  background: #f8f9fa;
  transition: background 0.2s ease;
}

.table-participants tbody tr.winner-highlight {
  background: #fff3cd;
  animation: highlight-flash 0.5s ease-out;
}

@keyframes highlight-flash {
  0% { background-color: #ffc107; }
  100% { background-color: #fff3cd; }
}

.btn-add-info {
  margin-top: 15px;
  padding: 10px 20px;
  background: #e5e9f0;
  color: #333;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

.btn-add-info:hover {
  background: #d0d5dc;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Chart */
.chart-container {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 260px;
  padding: 20px 0;
  gap: 15px;
}

.chart-bar {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  max-width: 80px;
}

.bar-value {
  position: absolute;
  top: -30px;
  font-weight: 700;
  font-size: 16px;
  color: #0c3f73;
  min-height: 20px;
}

.bar-fill {
  width: 65%;
  background: #e5e9f0;
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease;
  min-height: 40px;
  position: relative;
}

.bar-fill::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30px;
  background: #ffc107;
  border-radius: 4px 4px 0 0;
}

.bar-label {
  margin-top: 8px;
  font-weight: 600;
  font-size: 14px;
  color: #333;
  text-align: center;
}

/* Winner Modal */
.winner-modal-content {
  border-radius: 16px;
  overflow: hidden;
}

.winner-modal-header {
  background: rgba(13,72,120);
  color: #fff;
  border: none;
}

.winner-modal-body {
  padding: 30px;
  text-align: center;
}

.winner-display {
  animation: winner-appear 0.5s ease-out;
}

@keyframes winner-appear {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.winner-name-display {
  font-size: 28px;
  font-weight: 700;
  color: #0c3f73;
  margin-bottom: 15px;
}

.winner-prize {
  font-size: 20px;
  font-weight: 600;
  color: #ffc107;
  margin-bottom: 20px;
}

.winner-details {
  text-align: left;
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  font-size: 14px;
}

.winner-details div {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e9f0;
}

.winner-details div:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.winner-details strong {
  color: #0c3f73;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-overlay.show {
  display: flex;
}

.loading-spinner {
  text-align: center;
}

.loading-text {
  color: #fff;
  margin-top: 15px;
  font-size: 16px;
  font-weight: 600;
}

.spinner-border {
  width: 60px;
  height: 60px;
  border-width: 6px;
}

/* White close button for modal */
.btn-close-white {
  filter: invert(1);
}

/* Responsive - Mobile & Tablet */
@media (max-width: 991px) {
  /* Header responsive */
  .app-header-main {
    padding: 15px 0;
  }
  
  .container2 {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .header-title {
    width: 100%;
  }
  
  .buttonMySite {
    width: 100%;
    margin-left: 0;
  }
  
  /* Main content padding */
  .main-content {
    padding: 15px 10px !important;
  }
  
  /* Wheel section */
  .wheel-section {
    padding: 15px;
    min-height: auto !important;
  }
  
  .wheel-wrapper-main {
    max-width: 100%;
  }
  
  .wheel-center-main {
    width: 90px;
    height: 90px;
  }
  
  .center-text-main {
    font-size: 14px;
  }
  
  /* Cards */
  .card-modern {
    margin-bottom: 20px;
  }
  
  .card-header-modern {
    padding: 12px 15px;
  }
  
  .card-title-modern {
    font-size: 16px;
  }
  
  .card-subtitle-modern {
    font-size: 12px;
  }
  
  .card-body-modern {
    padding: 15px;
  }
  
  /* Tables */
  .table-participants, .table-winners {
    font-size: 12px;
  }
  
  .table-participants th, .table-winners th {
    padding: 8px 4px;
    font-size: 11px;
  }
  
  .table-participants td, .table-winners td {
    padding: 8px 4px;
    font-size: 11px;
  }
  
  /* Table responsive wrapper */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Chart */
  .chart-container {
    height: 200px;
    gap: 8px;
    padding: 15px 0;
  }
  
  .chart-bar {
    max-width: 50px;
  }
  
  .bar-value {
    font-size: 12px;
    top: -25px;
  }
  
  .bar-label {
    font-size: 11px;
    margin-top: 5px;
  }
  
  /* Buttons */
  .btn-load, .btn-spin-main {
    padding: 12px;
    font-size: 14px;
  }
  
  .btn-add-info {
    padding: 10px 15px;
    font-size: 13px;
  }
  
  /* Modal */
  .winner-modal-body {
    padding: 20px 15px;
  }
  
  .winner-name-display {
    font-size: 22px;
  }
  
  .winner-prize {
    font-size: 16px;
  }
  
  .winner-details {
    font-size: 12px;
    padding: 12px;
  }
  
  /* Remove min-height on mobile */
  .wheel-section,
  .card-participants {
    min-height: auto !important;
  }
}

/* Tablet specific */
@media (min-width: 768px) and (max-width: 991px) {
  .main-content {
    padding: 20px 30px !important;
  }
  
  .chart-container {
    height: 220px;
  }
  
  .chart-bar {
    max-width: 65px;
  }
}

/* Mobile specific */
@media (max-width: 767px) {
  .main-content {
    padding: 10px 5px !important;
  }
  
  .wheel-section {
    padding: 10px;
  }
  
  .wheel-wrapper-main {
    max-width: 100%;
  }
  
  .wheel-center-main {
    width: 80px;
    height: 80px;
  }
  
  .center-text-main {
    font-size: 12px;
  }
  
  .chart-container {
    height: 180px;
    gap: 5px;
  }
  
  .chart-bar {
    max-width: 40px;
  }
  
  .bar-value {
    font-size: 11px;
  }
  
  .bar-label {
    font-size: 10px;
  }
  
  .remaining-text {
    font-size: 14px;
  }
}

/* Spin Animation */
.wheel-wrapper-main.spinning #wheelCanvas {
  filter: blur(1px);
  transition: filter 0.3s ease;
}

.wheel-center-main.winner-pulse {
  animation: winner-pulse 0.6s ease-out;
}

@keyframes winner-pulse {
  0% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.1); }
  100% { transform: translate(-50%, -50%) scale(1); }
}
