@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --primary: #1a1a1a;
  --primary-foreground: #ffffff;
  --secondary: #f5f5f5;
  --secondary-foreground: #1a1a1a;
  --accent: #3b82f6;
  --accent-foreground: #ffffff;
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --muted: #f9fafb;
  --muted-foreground: #6b7280;
  --border: #e5e7eb;
  --input: #ffffff;
  --ring: #3b82f6;
  --background: #ffffff;
  --foreground: #1a1a1a;
  --card: #ffffff;
  --card-foreground: #1a1a1a;
  --popover: #ffffff;
  --popover-foreground: #1a1a1a;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 0.5rem;
}

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

body {
  font-family: "Inter", sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.header {
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 1rem 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  padding: 0.5rem 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex: 1;
  justify-content: flex-end;
}

.time-display {
  font-size: clamp(0.75rem, 2vw, 0.9rem);
  color: var(--muted-foreground);
  white-space: nowrap;
}

#userAccount {
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  white-space: nowrap;
}

.user-info .btn {
  padding: 0.5rem 1rem;
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  white-space: nowrap;
}

.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
  padding: 2rem 0;
}

.login-form {
  background: var(--card);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1.0rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-foreground);
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.btn-danger {
  background: var(--destructive);
  color: var(--destructive-foreground);
}

.main-app {
  display: none;
  padding: 2rem 0;
}

.main-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2rem;
  margin-top: 2rem;
}

.betting-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ticket-panel {
  position: sticky;
  top: 2rem;
  height: fit-content;
}

.betting-section {
  background: var(--card);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--foreground);
}

.bet-types {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.bet-type-card {
  background: var(--card);
  padding: 1rem;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.bet-type-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.bet-type-card.active {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.05);
}

.bet-type-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.bet-type-card p {
  font-size: 0.9rem;
  color: var(--muted-foreground);
  margin: 0.25rem 0;
}

.bet-type-card .odds {
  font-weight: 600;
  color: var(--destructive);
}

.bet-input-group {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.bet-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}

.amount-input {
  width: 120px;
}

.quick-select,
.quick-actions {
  background: var(--card);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.quick-select h3,
.quick-actions h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--foreground);
}

.position-inputs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1rem 0;
}

.position-group {
  text-align: center;
}

.position-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.position-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.action-buttons {
  display: flex;
  gap: 1rem;
}

.action-buttons .btn.active {
  background: var(--accent);
  color: var(--accent-foreground);
}

.ticket-section,
.mobile-ticket {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  font-family: "Courier New", monospace;
}

.ticket-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 1rem;
  border-bottom: 2px solid var(--border);
}

.ticket-title {
  text-align: center;
  margin-bottom: 0.5rem;
}

.lottery-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--destructive);
  border: 2px solid var(--destructive);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.ticket-type {
  font-size: 0.9rem;
  color: var(--muted-foreground);
  margin-left: 0.5rem;
}

.ticket-unit {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
}

.ticket-info {
  font-size: 0.85rem;
  color: var(--foreground);
}

.info-row {
  margin-bottom: 0.25rem;
  /* Make ticket header text larger and bold */
  font-size: 1rem;
  font-weight: 700;
}

/* Center align the disclaimer text "(一切以票为准)" */
.info-row:last-child {
  text-align: center;
}

/* Hide customer and period rows in ticket header */
#ticketPeriodRow,
#ticketCustomerRow {
  display: none !important;
}

.ticket-content {
  min-height: 200px;
  overflow-y: auto;
  background: var(--background);
}

.empty-ticket {
  text-align: center;
  color: var(--muted-foreground);
  padding: 3rem 1rem;
  font-style: italic;
}

.ticket-table {
  width: 100%;
  border-collapse: collapse;
}

.ticket-table th {
  background: var(--muted);
  padding: 0.5rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.ticket-table td {
  padding: 0.5rem;
  text-align: center;
  font-size: 0.85rem;
  border: 1px solid var(--border);
}

.ticket-table tr:nth-child(even) {
  background: var(--muted);
}

.ticket-table td.actions-cell {
  padding: 0.25rem;
}

.bet-number {
  font-weight: 600;
  font-family: "Courier New", monospace;
}

/* Changed odds text color from muted-foreground to foreground for better visibility */
.bet-odds {
  color: var(--foreground);
}

/* Add red color styling for 现 character */
.xian-char {
  color: #ef4444;
  font-weight: 700;
}

.bet-amount {
  font-weight: 600;
}

.ticket-footer {
  background: var(--muted);
  padding: 1rem;
  border-top: 2px solid var(--border);
}

.ticket-summary {
  text-align: center;
  font-weight: 600;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.ticket-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.btn-clear {
  background: var(--muted);
  color: var(--foreground);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-clear:hover {
  background: var(--border);
}

.export-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.export-actions .btn {
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.period-section,
.customer-section {
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.period-section {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border: 2px solid var(--accent);
}

.customer-section {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
}

.hidden {
  display: none !important;
}

/* Hide action column, clear button, and export buttons when exporting to PDF */
.hide-operations th:last-child,
.hide-operations td.actions-cell,
.hide-operations .ticket-actions,
.hide-operations .export-actions {
  display: none !important;
}

/* Hide ticket header for middle and last pages of PDF export */
.hide-ticket-header .ticket-header {
  display: none !important;
}

/* Hide ticket footer for first and middle pages of PDF export */
.hide-ticket-footer .ticket-footer {
  display: none !important;
}

/* Added missing styles for period and customer sections */
.period-input-group,
.customer-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.period-input-group .btn,
.customer-input-group .btn {
  margin-top: 0.5rem;
}

.current-period-display,
.current-customer-display {
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius);
  font-weight: 600;
}

.period-label,
.customer-label {
  color: var(--muted-foreground);
  margin-right: 0.5rem;
}

.period-value,
.customer-value {
  color: var(--accent);
  font-weight: 700;
}

/* Added styles for query section */
.query-section {
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 2px solid var(--success);
}

.query-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--foreground);
}

.query-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.query-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.query-results {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--background);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  /* 确保查询结果区域始终可见 */
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  min-height: 50px;
}

.query-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.query-results-header h4 {
  font-size: 1.1rem;
  font-weight: 600;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

#queryResultsContent {
  max-height: 400px;
  overflow-y: auto;
  /* 确保内容容器可见 */
  display: block !important;
  visibility: visible !important;
  width: 100%;
}

/* 添加查询结果表格和提示信息的样式 */
.query-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.query-table thead {
  background: var(--muted);
}

.query-table th {
  background: var(--muted);
  padding: 0.75rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.query-table td {
  padding: 0.75rem;
  text-align: center;
  font-size: 0.85rem;
  border: 1px solid var(--border);
}

.query-table tr:nth-child(even) {
  background: var(--muted);
}

.query-table .ticket-number {
  font-weight: 600;
  color: var(--accent);
}

.query-table .period-number {
  color: var(--muted-foreground);
}

.query-table .customer-name {
  font-weight: 600;
}

.query-table .bet-number {
  font-family: "Courier New", monospace;
  font-weight: 600;
}

.query-table .bet-type {
  color: var(--muted-foreground);
}

.query-table .bet-amount {
  font-weight: 600;
  color: var(--destructive);
}

.query-table .bet-odds {
  color: var(--foreground);
}

.query-checkbox {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

#selectAllQuery {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.query-summary {
  padding: 1rem;
  background: var(--muted);
  border-radius: var(--radius);
  text-align: center;
}

.query-summary p {
  margin: 0.25rem 0;
}

.query-summary strong {
  color: var(--accent);
  font-weight: 700;
}

.no-results {
  text-align: center;
  padding: 2rem;
  color: var(--muted-foreground);
  font-style: italic;
  font-size: 1rem;
}

/* Added styles for lottery draw section */
.lottery-draw-section {
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border: 2px solid var(--destructive);
}

.lottery-draw-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--foreground);
}

.lottery-draw-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.draw-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.winners-display {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--background);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.winners-display h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

#winnersContent {
  max-height: 400px;
  overflow-y: auto;
}

/* Added styles for input mode selection */
.input-section {
  margin-bottom: 1.5rem;
}

.input-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--foreground);
}

.input-mode-selection {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--muted);
  border-radius: var(--radius);
}

.input-mode-selection label {
  font-size: 0.95rem;
  font-weight: 500;
}

.input-mode-selection input[type="radio"] {
  cursor: pointer;
}

/* Added styles for imported numbers section */
.imported-numbers-section {
  background: var(--card);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  border: 2px solid var(--accent);
}

.imported-numbers-header {
  margin-bottom: 1rem;
}

.imported-numbers-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
}

.imported-numbers-content {
  max-height: 500px;
  overflow-y: auto;
}

.empty-imported {
  text-align: center;
  color: var(--muted-foreground);
  padding: 2rem;
  font-style: italic;
}

.imported-bet-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--muted);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.imported-bet-info {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex: 1;
}

.imported-bet-number {
  font-weight: 600;
  font-family: "Courier New", monospace;
  font-size: 1rem;
}

.imported-bet-type {
  color: var(--muted-foreground);
  font-size: 0.9rem;
}

.imported-bet-odds {
  color: var(--destructive);
  font-size: 0.9rem;
}

.imported-bet-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.imported-bet-actions input {
  width: 80px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.batch-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  justify-content: center;
}

.batch-amount-input {
  width: 120px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

/* Added styles for export footer */
.export-footer {
  margin-top: 1rem;
  padding: 1rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: var(--radius);
  border: 2px solid var(--warning);
  text-align: center;
}

.export-footer-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#exportPeriodText {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.validity-text {
  font-size: 0.9rem;
  color: var(--destructive);
  font-weight: 600;
}

/* Added styles for pagination controls */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pagination-controls .btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

/* Add page break control for PDF export */
.ticket-table tr {
  page-break-inside: avoid;
  break-inside: avoid;
}

.ticket-table {
  page-break-inside: auto;
}

/* Ensure table rows don't break across pages */
@media print {
  .ticket-table tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  .ticket-table thead {
    display: table-header-group;
  }
}

/* 停押号码区域样式 */
/* 简化停押号码区域样式，去掉黄色外边框，只保留简洁的表格 */
.blocked-numbers-section {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  margin-bottom: 1rem;
}

.blocked-numbers-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.blocked-numbers-header {
  background: var(--muted);
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.blocked-numbers-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}

.blocked-count {
  font-size: 0.85rem;
  color: var(--muted-foreground);
  font-weight: 500;
}

.blocked-numbers-content {
  padding: 0;
}

.blocked-numbers-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

.blocked-numbers-table thead {
  background: var(--muted);
}

.blocked-numbers-table th {
  padding: 0.75rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--foreground);
  border: 1px solid var(--border);
  width: 50%;
  white-space: nowrap;
}

/* 增强表头样式确保PDF导出时可见 */
.blocked-numbers-table thead th {
  padding: 0.75rem !important;
  text-align: center !important;
  font-weight: 700 !important;
  font-size: 0.95rem !important;
  color: #000 !important;
  border: 1px solid #dee2e6 !important;
  width: 50% !important;
  white-space: nowrap !important;
  background: #f8f9fa !important;
  min-width: 100px !important;
  vertical-align: middle !important;
  line-height: 1.5 !important;
}

.blocked-numbers-table thead th::before {
  content: attr(data-label);
}

/* 为表头列添加明确的样式确保显示 */
.blocked-th-number,
.blocked-th-amount {
  padding: 0.75rem !important;
  text-align: center !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
  color: #000 !important;
  border: 1px solid #dee2e6 !important;
  width: 50% !important;
  white-space: nowrap !important;
  background: #f8f9fa !important;
  min-width: 80px !important;
}

.blocked-numbers-table td {
  padding: 0.75rem;
  text-align: center;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  width: 50%;
}

.blocked-numbers-table tbody tr {
  background: white;
  transition: background 0.2s;
}

.blocked-numbers-table tbody tr:hover {
  background: var(--muted);
}

.blocked-numbers-table tbody tr:nth-child(even) {
  background: #f8f9fa;
}

.blocked-number {
  font-weight: 600;
  font-family: "Courier New", monospace;
  font-size: 0.95rem;
  color: var(--foreground);
}

.blocked-amount {
  font-weight: 600;
  color: var(--destructive);
  font-size: 0.9rem;
}

.blocked-summary {
  background: var(--muted);
  padding: 0.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted-foreground);
  font-weight: 500;
}

@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  .ticket-panel {
    position: static;
  }

  .bet-types {
    grid-template-columns: 1fr;
  }

  .blocked-numbers-section {
    grid-column: 1;
  }
}

@media (max-width: 768px) {
  .position-inputs {
    grid-template-columns: repeat(2, 1fr);
  }

  .bet-input-group {
    flex-direction: column;
  }
}
