/* =============================================
   BetPro - Admin Stylesheet
   ============================================= */

/* ----- Admin Layout ----- */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  min-height: calc(100vh - var(--header-height) - 48px);
}

.admin-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.admin-nav {
  display: flex;
  flex-direction: column;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}

.admin-nav-item i {
  width: 18px;
  text-align: center;
  font-size: 1rem;
}

.admin-nav-item:hover {
  background: var(--accent-light);
  color: var(--text-primary);
}

.admin-nav-item.active {
  color: var(--accent);
  background: var(--accent-light);
  border-left-color: var(--accent);
}

.admin-content {
  padding-left: 24px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ----- Admin Stats Grid ----- */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.admin-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
}

.admin-stat-card:hover {
  border-color: rgba(245, 166, 35, 0.2);
  box-shadow: var(--shadow-md);
}

.admin-stat-card .admin-stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.admin-stat-card .admin-stat-header i {
  font-size: 1.5rem;
  color: var(--accent);
}

.admin-stat-card .admin-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-stat-card .admin-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.admin-stat-card .admin-stat-change {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.admin-stat-change.up {
  color: var(--success);
}

.admin-stat-change.down {
  color: var(--danger);
}

/* ----- Chart Bars ----- */
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.chart-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 200px;
  padding: 0 8px;
}

.chart-bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  max-width: 40px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.6s ease;
  position: relative;
  cursor: pointer;
}

.chart-bar:hover {
  opacity: 0.8;
}

.chart-bar-label {
  margin-top: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.chart-bar-value {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  opacity: 0;
  transition: opacity var(--transition);
}

.chart-bar-wrapper:hover .chart-bar-value {
  opacity: 1;
}

/* ----- Toggle Switch ----- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: transform var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ----- Admin Search Bar ----- */
.admin-search {
  position: relative;
  width: 280px;
}

.admin-search-input {
  width: 100%;
  height: 40px;
  padding: 8px 16px 8px 40px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color var(--transition);
}

.admin-search-input:focus {
  border-color: var(--accent);
}

.admin-search-input::placeholder {
  color: var(--text-muted);
}

.admin-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.875rem;
  pointer-events: none;
}

/* ----- Admin Table ----- */
.admin-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.admin-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.admin-table-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.admin-table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-table-wrapper {
  overflow-x: auto;
}

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

.admin-table th,
.admin-table td {
  padding: 12px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.admin-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.admin-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

/* ----- Admin Filters ----- */
.admin-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.admin-filters .form-input,
.admin-filters .form-select {
  width: auto;
  min-width: 160px;
}

/* ----- Admin Page Sections ----- */
.admin-page {
  display: none;
}

.admin-page.active {
  display: block;
}

/* ----- Mobile: single column, scrollable tabs ----- */
@media (max-width: 991px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    display: flex;
    overflow-x: auto;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
  }

  .admin-sidebar::-webkit-scrollbar {
    display: none;
  }

  .admin-nav {
    flex-direction: row;
    white-space: nowrap;
  }

  .admin-nav-item {
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 12px 16px;
    flex-shrink: 0;
    font-size: 0.8rem;
  }

  .admin-nav-item.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }

  .admin-content {
    padding-left: 0;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-header-actions {
    width: 100%;
    flex-direction: column;
  }

  .admin-search {
    width: 100%;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .admin-stat-card {
    padding: 16px;
  }

  .admin-stat-card .admin-stat-value {
    font-size: 1.3rem;
  }

  .admin-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-filters .form-input,
  .admin-filters .form-select {
    width: 100%;
    min-width: auto;
  }

  .chart-bars {
    height: 150px;
    gap: 4px;
  }

  .chart-bar {
    max-width: 24px;
  }

  .chart-bar-label {
    font-size: 0.6rem;
  }
}

@media (max-width: 767px) {
  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .admin-stat-card {
    padding: 12px;
  }

  .admin-stat-card .admin-stat-value {
    font-size: 1.1rem;
  }

  .admin-stat-card .admin-stat-label {
    font-size: 0.7rem;
  }

  .admin-table th,
  .admin-table td {
    padding: 10px 14px;
    font-size: 0.8rem;
  }
}
