/* style.css - Premium Dark Theme & Glassmorphism Design System */

:root {
  --bg-primary: #090d16;
  --bg-secondary: #111726;
  --bg-card: rgba(20, 28, 47, 0.6);
  --bg-card-hover: rgba(28, 38, 64, 0.8);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-focus: rgba(59, 130, 246, 0.5);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-cyan: #06b6d4;

  --primary-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --sidebar-gradient: linear-gradient(180deg, #0b101c, #090d16);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 15px rgba(59, 130, 246, 0.2);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

input, textarea, button {
  font-family: inherit;
  font-size: 14px;
}

/* App Container Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
}

/* Sidebar Styling */
.sidebar {
  width: 280px;
  background: var(--sidebar-gradient);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Outfit', sans-serif;
}

.logo-icon {
  color: var(--accent-blue);
  filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
}

.logo h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.sidebar-content {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px 12px 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* Customer List */
.customer-list {
  list-style: none;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
  padding-right: 4px;
}

.customer-list::-webkit-scrollbar {
  width: 4px;
}

.customer-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.customer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
  user-select: none;
  touch-action: manipulation;
}

.customer-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
}

.customer-item:active {
  background: rgba(59, 130, 246, 0.2);
  transform: scale(0.99);
}

.customer-item.active {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.05);
}

.customer-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.customer-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--accent-emerald);
}

.customer-summary {
  font-size: 11px;
  color: var(--text-secondary);
}

.customer-summary span.net-plus {
  color: var(--accent-emerald);
}

.customer-summary span.net-minus {
  color: var(--accent-rose);
}

.customer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-delete-customer {
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.customer-item:hover .btn-delete-customer {
  opacity: 1;
}

/* Add Customer Inline Interface */
.add-customer-inline {
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.add-customer-inline input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

.inline-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* Main Workspace Styling */
.main-workspace {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  max-height: 100vh;
  overflow-y: auto;
}

/* Header Action Bar */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.header-left h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
  color: var(--accent-emerald);
}

.meta-badges {
  display: flex;
  gap: 8px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-secondary);
}

#badge-region {
  color: var(--accent-blue);
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.05);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Region Toggle Button */
.toggle-container {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
}

.toggle-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-btn.active {
  background: var(--accent-blue);
  color: white;
  box-shadow: var(--shadow-glow);
}

/* Date Selector */
.date-selector input {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  color-scheme: dark;
  outline: none;
  cursor: pointer;
}

.date-selector input:focus {
  border-color: var(--accent-blue);
}

/* Navigation Tabs */
.tabs-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.tab-header {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
  padding-bottom: 2px;
}

.tab-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: color var(--transition-fast);
}

.tab-link:hover {
  color: var(--text-primary);
}

.tab-link.active {
  color: var(--accent-blue);
  font-weight: 600;
}

.tab-link.active::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-blue);
  box-shadow: 0 0 8px var(--accent-blue);
}

.tab-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.tab-content {
  display: none;
  flex-grow: 1;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* Grid Layouts */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  flex-grow: 1;
}

.margin-top {
  margin-top: 20px;
}

/* Card Component */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-lg);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.4);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header.border-mb {
  border-left: 4px solid var(--accent-blue);
}

.card-header.border-mt {
  border-left: 4px solid var(--accent-amber);
}

.card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 16px;
}

.card-body.scrollable-y {
  max-height: calc(100vh - 280px);
  overflow-y: auto;
}

/* Form Inputs & Buttons */
textarea {
  width: 100%;
  flex-grow: 1;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 16px;
  line-height: 1.6;
  resize: none;
  outline: none;
  min-height: 180px;
  transition: border-color var(--transition-fast);
}

textarea:focus {
  border-color: var(--border-color-focus);
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-glow);
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary-sm {
  background: var(--accent-blue);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-primary-sm:hover {
  background: #2563eb;
}

.btn-secondary-sm {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary-sm:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  transition: color var(--transition-fast);
}

.btn-text:hover {
  color: var(--text-primary);
}

.text-danger {
  color: var(--accent-rose) !important;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.hidden {
  display: none !important;

  display: none !important;
}

/* Parsed Bets Layout */
.bets-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bets-category-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  margin-top: 16px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bets-category-header:first-of-type {
  margin-top: 0;
}

.bets-category-header::after {
  content: '';
  flex-grow: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-icon {
  margin-bottom: 12px;
  color: var(--text-muted);
}

/* Configuration Settings Forms */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group-row {
  display: grid;
  grid-template-columns: 180px 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.form-group-row:last-child {
  border-bottom: none;
}

.form-group-row label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
}

.input-pair {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  height: 36px;
  transition: border-color var(--transition-fast);
}

.input-pair:focus-within {
  border-color: var(--accent-blue);
}

.input-pair input {
  width: 100%;
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  outline: none;
  padding: 6px 4px;
  text-align: right;
  font-weight: 500;
}

.input-pair span {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
  flex-shrink: 0;
}

.flex-justify-end {
  display: flex;
  justify-content: flex-end;
}

/* Results Grid Form */
.results-grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
}

.result-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.result-field label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.result-field input {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: 0.5px;
  outline: none;
}

.result-field input:focus {
  border-color: var(--accent-blue);
}

/* Statistics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 20px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
}

.stat-card.blue::after { background: var(--accent-blue); }
.stat-card.green::after { background: var(--accent-emerald); }
.stat-card.purple::after { background: var(--accent-purple); }

.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
}

.stat-card.blue .stat-value { color: #60a5fa; }
.stat-card.green .stat-value { color: #34d399; }
.stat-card.purple.profit-positive .stat-value { color: #34d399; }
.stat-card.purple.profit-negative .stat-value { color: #f87171; }

/* Receipt Text Box */
.receipt-box {
  font-family: monospace;
  font-size: 13px;
  line-height: 1.5;
  background: #05080f;
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.2);
  min-height: 250px;
}

/* Winning Breakdown List */
.winning-breakdown {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.win-item {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.win-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.win-title {
  font-weight: 600;
  font-size: 14px;
}

.win-desc {
  font-size: 11px;
  color: var(--text-secondary);
}

.win-payout {
  font-weight: 700;
  color: var(--accent-emerald);
  font-size: 15px;
}

/* Scrollbar Customization for main workspace */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Preview Table Styles */
.subtitle-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 12px;
}

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.15);
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.preview-table th {
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.preview-table td {
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.preview-table tr:last-child td {
  border-bottom: none;
}

.preview-table tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.category-name-cell {
  color: var(--text-primary);
  font-weight: 500;
}

.preview-numbers-cell {
  color: var(--text-secondary);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cost-cell {
  text-align: right;
  font-size: 14px;
}

/* Row-specific price colors */
tr:has(.lo-pill) .cost-cell { color: #60a5fa; } /* blue */
tr:has(.dau-pill) .cost-cell { color: #22d3ee; } /* cyan */
tr:has(.cuoi-pill) .cost-cell { color: #f43f5e; } /* rose */
tr:has(.dc-pill) .cost-cell { color: #0d9488; } /* teal */
tr:has(.lo3-pill) .cost-cell { color: #f87171; } /* red */
tr:has(.da-pill) .cost-cell { color: #a78bfa; } /* violet */
tr:has(.xien-pill) .cost-cell { color: #f59e0b; } /* amber */

/* Badges for quantities */
.preview-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  text-align: center;
  white-space: nowrap;
}

.lo-pill { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.dau-pill { background: rgba(34, 211, 238, 0.15); color: #22d3ee; border: 1px solid rgba(34, 211, 238, 0.3); }
.cuoi-pill { background: rgba(100, 116, 139, 0.15); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.3); }
.dc-pill { background: rgba(13, 148, 136, 0.15); color: #0d9488; border: 1px solid rgba(13, 148, 136, 0.3); }
.lo3-pill { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.da-pill { background: rgba(139, 92, 246, 0.15); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.3); }
.xien-pill { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.other-pill { background: rgba(107, 114, 128, 0.15); color: #9ca3af; border: 1px solid rgba(107, 114, 128, 0.3); }

/* Total Bar */
.total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 16px;
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  color: var(--text-primary);
}

#preview-total-cost {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-emerald);
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

/* Action Buttons matching screenshot */
.preview-actions {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.btn-confirm {
  background: var(--accent-emerald);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-confirm:hover,
.btn-confirm:active {
  background: #059669;
  transform: translateY(-1px);
}

.btn-edit-manual {
  background: #e28704;
  color: #111827;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  box-shadow: 0 0 10px rgba(226, 135, 4, 0.2);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-edit-manual:hover,
.btn-edit-manual:active,
.btn-edit-manual.active {
  background: #d97706;
  transform: translateY(-1px);
}

/* Collapsible Section for manual edit bet cards */
.manual-edit-section {
  display: none;
  margin-top: 16px;
  width: 100%;
}

.manual-edit-section.open {
  display: block;
}

/* Bets List & Bet Cards matching original simple design */
.bets-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
  margin-bottom: 12px;
}

.bet-group-card {
  background: #141b2d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  transition: border-color 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.bet-group-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.bet-type-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: fit-content;
  margin-bottom: 6px;
  text-align: left;
}

/* Badge colors matching original screenshots */
.bet-type-badge.cuoi,
.bet-type-badge.dau {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.bet-type-badge.lo {
  background: rgba(6, 182, 212, 0.18);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.bet-type-badge.dc {
  background: rgba(244, 63, 94, 0.18);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.bet-type-badge.dc3,
.bet-type-badge.dau3,
.bet-type-badge.cuoi3,
.bet-type-badge.lo3 {
  background: rgba(236, 72, 153, 0.18);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.bet-type-badge.da,
.bet-type-badge.dv {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.bet-type-badge.xien2,
.bet-type-badge.xien3,
.bet-type-badge.xien4 {
  background: rgba(168, 85, 247, 0.18);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.bet-numbers-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.bet-numbers {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.4;
  word-break: break-word;
  flex: 1;
  text-align: left;
}

.bet-card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}

.bet-card-actions button,
.btn-icon-action,
.btn-edit-bet,
.btn-delete-bet {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 4px !important;
  margin: 0 !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8 !important;
  transition: opacity 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.bet-card-actions button:active,
.btn-icon-action:active {
  transform: scale(0.88);
  opacity: 0.7;
}

.bet-card-actions button.btn-delete-bet,
.btn-icon-action.btn-delete-bet {
  color: #f43f5e !important;
}

.bet-card-actions span {
  display: none !important;
}

.bet-price {
  margin-top: 6px;
  font-size: 13px;
  color: #94a3b8;
  font-weight: 400;
  text-align: left;
}

/* Target Customer Settings Bar */
.settings-header-bar {
  display: flex;
  gap: 20px;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.form-group-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-group-inline label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group-inline select {
  padding: 8px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  font-weight: 600;
  cursor: pointer;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox-container input {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--accent-blue);
}

/* Mobile responsive fixes */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .main-workspace {
    max-height: none;
  }
  .grid-2col {
    grid-template-columns: 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .form-group-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 12px 0;
  }
  .form-group-row label {
    grid-column: span 2;
    margin-bottom: 2px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* Win Breakdown Summary Row */
.win-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding: 14px 20px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 16px;
  color: #34d399;
}

.text-emerald {
  color: #34d399 !important;
}

/* Loading spin animation */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinning {
  animation: spin 1s linear infinite;
  display: inline-block;
}

/* Live status indicator */
@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.live-pulse {
  animation: pulse 1.5s infinite;
  color: var(--accent-rose);
  font-weight: 600;
}

/* =============================================
   Parse Warning Panel - Unrecognized Lines
   ============================================= */

/* Red border on the message textarea when errors are present */
.input-has-errors {
  border-color: var(--accent-rose) !important;
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2) !important;
  animation: errorShake 0.4s ease;
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* The warning panel container */
.parse-warnings-panel {
  margin-top: 10px;
  padding: 14px 16px;
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-left: 4px solid var(--accent-rose);
  border-radius: var(--radius-md);
  animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Header row: icon + title */
.parse-warn-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-rose);
  font-size: 13px;
  margin-bottom: 10px;
}

.parse-warn-header svg {
  flex-shrink: 0;
  stroke: var(--accent-rose);
}

.parse-warn-header strong {
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* List of unrecognized lines */
.unrecognized-lines-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.unrecognized-line-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12.5px;
  color: #ffffff;
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.35);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.unrecognized-text {
  font-family: 'Courier New', Courier, monospace;
  color: #ffffff;
  word-break: break-all;
  font-weight: 700;
  background: #f43f5e; /* Solid Rose Red background */
  padding: 2px 6px;
  border-radius: 4px;
}

/* Hint line at the bottom */
.parse-warn-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  border-top: 1px solid rgba(244, 63, 94, 0.15);
  padding-top: 8px;
}

.parse-warn-hint code {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--accent-amber);
  font-family: 'Courier New', Courier, monospace;
}


/* =============================================
   AUTH — Màn hình đăng nhập
   ============================================= */

.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.25) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.25) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(15, 23, 42, 0.8) 0px, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.login-card {
  background: rgba(17, 23, 38, 0.95);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  backdrop-filter: blur(20px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04);
  animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-icon {
  filter: drop-shadow(0 0 12px rgba(251,191,36,0.4));
  margin-bottom: 12px;
  stroke: #fbbf24;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 4px;
}

.login-logo p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.login-field input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 42px;
}

.btn-toggle-pw {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.btn-toggle-pw:hover {
  color: var(--text-secondary);
}

.login-error {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #fca5a5;
  animation: errorShake 0.4s ease;
}

.btn-login {
  width: 100%;
  padding: 12px;
  background: var(--primary-gradient);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-login:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-login:active {
  transform: translateY(0);
}

.login-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin: 18px 0 0;
}

.login-hint strong {
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

/* =============================================
   AUTH — User Info Bar in Header
   ============================================= */

.user-info-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
  border-left: 1px solid var(--border-color);
  margin-left: 4px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: white;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

.user-display-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-badge {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  white-space: nowrap;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-logout:hover {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.35);
  color: var(--accent-rose);
}

.btn-admin-link {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-sm);
  color: #a78bfa;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-admin-link:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.5);
}

/* User Registration Form */
.login-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #a7f3d0;
  text-align: center;
}

.login-toggle-link {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 14px;
}

.login-toggle-link a {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s;
}

.login-toggle-link a:hover {
  color: #60a5fa;
}

/* Global utility classes */
.hidden {
  display: none !important;
}

/* =============================================
   Mobile & Responsive Enhancements for Region Toggle & Header
   ============================================= */
#badge-region {
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

#badge-region:hover {
  filter: brightness(1.15);
  transform: scale(1.02);
}

.in-card-region-toggle {
  display: inline-flex;
  margin-left: 6px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.in-card-region-toggle .toggle-btn {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 4px;
}

@media (max-width: 768px) {
  .app-header {
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 14px;
  }

  .header-left {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-left .logo {
    margin-right: 0 !important;
  }

  .header-right {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
  }

  .toggle-container {
    touch-action: manipulation;
    gap: 4px;
    padding: 3px;
  }

  .toggle-btn {
    min-height: 40px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
  }

  .in-card-region-toggle {
    gap: 4px;
    padding: 3px;
  }

  .in-card-region-toggle .toggle-btn {
    min-height: 34px;
    padding: 5px 12px;
    font-size: 12px;
  }

  .user-info-bar {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
  }

  .customer-item {
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
    user-select: none;
    touch-action: manipulation;
    padding: 14px 12px;
  }

  .customer-item:active {
    background: rgba(59, 130, 246, 0.25) !important;
    transform: scale(0.985);
  }

  .customer-item .btn-delete-customer {
    opacity: 0.85;
  }

  .tab-link {
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
    touch-action: manipulation;
  }

  .tab-link:active {
    opacity: 0.8;
  }
}
