/* Modern Dark Analytics Dashboard */
:root {
  --bg-root: #09090b;
  --bg-surface: #111114;
  --bg-card: #18181b;
  --bg-card-hover: #1f1f23;
  --bg-muted: #27272a;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-active: rgba(251, 191, 36, 0.4);

  --accent-gold: #fbbf24;
  --accent-gold-hover: #f59e0b;
  --accent-amber-glow: rgba(251, 191, 36, 0.15);
  --accent-orange: #f97316;

  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-inverse: #09090b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", Helvetica, Arial, sans-serif;
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.3), 0 10px 24px rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-root);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Header & Top Navigation */
.app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
  text-transform: uppercase;
}

/* Tab Navigation */
.tabs-navigation {
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  position: sticky;
  top: 56px;
  z-index: 40;
}

.tabs-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs-container::-webkit-scrollbar {
  display: none;
}

.tab-button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-button:hover {
  color: var(--text-primary);
}

.tab-button.active {
  color: #ffffff;
  border-bottom-color: var(--accent-gold);
}

/* Main Container */
.main-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
}

/* Tab Panels */
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
  animation: fadeIn 0.18s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Latest Draw Status Banner */
.latest-draw-strip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.latest-draw-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.latest-draw-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-gold);
  background: rgba(251, 191, 36, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.latest-draw-date {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
}

.latest-draw-balls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.latest-draw-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Ball Components */
.lotto-ball {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f4f4f5;
  color: #09090b;
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  user-select: none;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.lotto-ball.sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.lotto-ball.xs {
  width: 25px;
  height: 25px;
  font-size: 11px;
  font-weight: 700;
}

.euro-ball {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-gold);
  color: #09090b;
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.25);
  user-select: none;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.euro-ball.sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.euro-ball.xs {
  width: 25px;
  height: 25px;
  font-size: 11px;
  font-weight: 700;
}

/* Grids & Cards */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-subtle);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 8px;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
}

.panel-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

/* KPI Summary Cards */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Modern Tables */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.modern-table th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.modern-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
  white-space: nowrap;
}

.modern-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

/* Status Badges */
.status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  display: inline-block;
  white-space: nowrap;
}

.status-pill.hot {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.status-pill.cold {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.status-pill.neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.status-pill.accent {
  background: rgba(251, 191, 36, 0.12);
  color: var(--accent-gold);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

/* Frequency Progress Bars */
.progress-bar-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 3px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent-gold);
}

/* Main Numbers 1-50 Grid */
.number-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 8px;
}

.grid-cell {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.grid-cell:hover {
  border-color: var(--border-hover);
  background: var(--bg-muted);
}

.grid-cell.highlight-hot {
  border-color: rgba(239, 68, 68, 0.35);
}

.grid-cell.highlight-cold {
  border-color: rgba(56, 189, 248, 0.35);
}

.grid-cell .cell-ball {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.grid-cell .cell-count {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
}

.grid-cell .cell-sub {
  font-size: 10px;
  color: var(--text-muted);
}

/* Buttons */
.btn-action {
  background: var(--accent-gold);
  color: #09090b;
  border: none;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-action:hover {
  background: var(--accent-gold-hover);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-ghost.active {
  background: var(--bg-muted);
  color: #ffffff;
  border-color: var(--border-hover);
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-select, .form-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.form-select:focus, .form-input:focus {
  border-color: var(--accent-gold);
}

/* Generator Ticket Row */
.ticket-row-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.ticket-balls-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.ticket-meta-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Ticket Checker Pickers */
.picker-container {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.picker-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
}

.picker-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.picker-btn.selected {
  background: #ffffff;
  color: #09090b;
  border-color: #ffffff;
  font-weight: 800;
}

.picker-btn-euro {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: var(--accent-gold);
  font-size: 13px;
  font-weight: 700;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
}

.picker-btn-euro:hover {
  background: rgba(251, 191, 36, 0.18);
}

.picker-btn-euro.selected {
  background: var(--accent-gold);
  color: #09090b;
  border-color: var(--accent-gold);
  font-weight: 800;
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  max-width: 620px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.8);
  padding: 20px;
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Site Footer */
.app-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ========================================================
   MOBILE-FIRST RESPONSIVE OPTIMIZATIONS (< 768px & < 480px)
   ======================================================== */
@media (max-width: 768px) {
  .header-container {
    padding: 0 14px;
    height: 50px;
  }
  .brand-title {
    font-size: 15px;
  }

  .tabs-navigation {
    top: 50px;
  }
  .tabs-container {
    padding: 0 10px;
    gap: 2px;
  }
  .tab-button {
    font-size: 12px;
    padding: 10px 10px;
  }

  .main-wrapper {
    padding: 12px 10px;
  }

  /* Latest Draw Strip */
  .latest-draw-strip {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px;
    gap: 10px;
  }
  .latest-draw-left {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .latest-draw-balls {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  /* KPI Cards 2x2 */
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .kpi-card {
    padding: 12px;
  }
  .kpi-label {
    font-size: 10px;
  }
  .kpi-value {
    font-size: 19px;
  }
  .kpi-sub {
    font-size: 11px;
  }

  /* Grid 2 & 3 stack */
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .panel-card {
    padding: 14px 12px;
  }
  .panel-title {
    font-size: 14px;
  }

  /* 1-50 Main Grid: 5 columns */
  .number-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }
  .grid-cell {
    padding: 6px 2px;
  }
  .grid-cell .cell-count {
    font-size: 11px;
  }
  .grid-cell .cell-sub {
    font-size: 9px;
  }

  /* Pickers */
  .picker-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
  }
  .picker-btn, .picker-btn-euro {
    height: 38px;
    font-size: 13px;
  }

  /* Generator controls */
  .generator-controls-wrap {
    flex-direction: column;
    align-items: stretch !important;
  }
  .generator-controls-wrap .form-group {
    width: 100% !important;
    min-width: 0 !important;
  }
  .generator-controls-wrap .btn-action {
    width: 100%;
    height: 42px;
    font-size: 14px;
  }

  /* Generated Row Item */
  .ticket-row-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
  }
  .ticket-balls-wrap {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .ticket-meta-wrap {
    width: 100%;
    justify-content: space-between;
  }

  /* Checker action bar */
  .checker-action-bar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px !important;
    padding: 12px !important;
  }
  .checker-action-bar .btn-action {
    width: 100%;
    height: 42px;
    font-size: 14px;
  }

  /* Archive filter bar */
  .archive-filter-bar {
    flex-direction: column;
    gap: 8px !important;
  }
  .archive-filter-bar input, .archive-filter-bar select {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Tables */
  .modern-table th, .modern-table td {
    padding: 8px 10px;
    font-size: 12px;
  }

  /* Modal */
  .modal-card {
    padding: 16px 14px;
    max-height: 90vh;
  }
}

@media (max-width: 420px) {
  .lotto-ball, .euro-ball {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }
  .lotto-ball.sm, .euro-ball.sm {
    width: 29px;
    height: 29px;
    font-size: 11px;
  }
  .grid-4 {
    grid-template-columns: 1fr;
  }
}
