/* Cards */
.card {
  background: rgba(26, 29, 39, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 20px;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-active);
}

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

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Stat Cards */
.stat-card {
  position: relative;
  overflow: hidden;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(26, 29, 39, 1) !important; /* solid color without transparency to hide elements underneath */
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  opacity: 0.8;
  pointer-events: none;
}

.stat-icon svg {
  width: 18px;
  height: 18px;
}

.stat-icon.success { background: var(--gradient-success); }
.stat-icon.warning { background: var(--gradient-warning); }
.stat-icon.danger { background: var(--gradient-danger); }
.stat-icon.info { background: var(--gradient-neutral); color: var(--accent-info); }
.stat-icon.primary { background: var(--gradient-neutral); color: var(--accent-primary); }

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat-value.long {
  font-size: 20px;
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
}

.trend-up { color: var(--accent-success); }
.trend-down { color: var(--accent-danger); }
.trend-neutral { color: var(--text-secondary); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background-color: #8befff;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--accent-info);
  color: var(--accent-info);
}

/* Badges */
.badge-status {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background-color: rgba(74, 222, 128, 0.1);
  color: var(--accent-success);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

.badge-warning {
  background-color: rgba(251, 191, 36, 0.1);
  color: var(--accent-warning);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.badge-danger {
  background-color: rgba(248, 113, 113, 0.1);
  color: var(--accent-danger);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

/* Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}

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

.data-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Progress Bars */
.progress-container {
  width: 100%;
  height: 8px;
  background-color: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease-out;
}

.progress-success { background-color: var(--accent-success); }
.progress-warning { background-color: var(--accent-warning); }
.progress-info { background-color: var(--accent-info); }
.progress-danger { background-color: var(--accent-danger); }

/* ===========================
   Admin Panel — Flat List
   =========================== */

/* Search box */
.admin-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.admin-search-box input {
  padding: 8px 12px 8px 36px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 14px;
  width: 220px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.admin-search-box input:focus {
  border-color: var(--accent-info);
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.1);
}

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

/* Summary chips row */
.admin-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
}

.summary-chip strong {
  color: var(--text-primary);
  font-weight: 600;
}

.summary-chip.chip-admin {
  border-color: rgba(251, 191, 36, 0.2);
}

.summary-chip.chip-operator {
  border-color: rgba(103, 232, 249, 0.2);
}

.summary-chip.chip-active {
  border-color: rgba(74, 222, 128, 0.2);
}

/* Table wrapper — NO card/bubble */
.admin-table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

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

.admin-table thead {
  background: var(--bg-tertiary);
}

.admin-table th {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

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

.admin-table tbody tr {
  transition: background-color 0.15s ease;
}

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

/* Column-specific styles */
.col-num {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  width: 40px;
  text-align: center;
}

.col-name {
  font-weight: 600;
}

.col-username code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--accent-info);
}

.col-pages {
  max-width: 280px;
}

/* Page permission tags */
.page-tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 3px 2px 0;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(103, 232, 249, 0.08);
  color: var(--accent-info);
  border: 1px solid rgba(103, 232, 249, 0.15);
  white-space: nowrap;
}

.page-tag.tag-all {
  background: rgba(251, 191, 36, 0.08);
  color: var(--accent-warning);
  border-color: rgba(251, 191, 36, 0.15);
}

.pages-none {
  color: var(--text-tertiary);
}

/* Status dot */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.status-dot.dot-active {
  background-color: var(--accent-success);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.status-dot.dot-inactive {
  background-color: var(--accent-danger);
  box-shadow: 0 0 6px rgba(248, 113, 113, 0.4);
}

/* Action icon buttons */
.col-actions {
  text-align: right;
  white-space: nowrap;
}

.action-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 4px;
}

.action-icon-btn:first-child {
  margin-left: 0;
}

.action-icon-btn:hover {
  border-color: var(--accent-info);
  color: var(--accent-info);
  background: rgba(103, 232, 249, 0.06);
}

.action-icon-btn.action-danger:hover {
  border-color: var(--accent-danger);
  color: var(--accent-danger);
  background: rgba(248, 113, 113, 0.06);
}

/* ===========================
   Custom Select Replacement
   =========================== */
.custom-select-wrapper {
  position: relative;
  display: inline-block;
  user-select: none;
  font-family: var(--font-family);
  font-size: 14px;
}

.custom-select-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 38px;
  box-sizing: border-box;
}

.custom-select-display:hover {
  border-color: var(--accent-info);
}

.custom-select-wrapper.open .custom-select-display {
  border-color: var(--accent-info);
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.1);
}

.custom-select-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 12px;
}

.custom-select-icon {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.custom-select-wrapper.open .custom-select-icon {
  transform: rotate(180deg);
}

.custom-select-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  min-width: 140px;
  max-height: 250px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 9999999 !important;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.2s ease;
  will-change: transform, opacity;
}

.custom-select-wrapper.open .custom-select-options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.custom-select-wrapper.open {
  z-index: 9999999;
}

.custom-select-option {
  padding: 10px 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s ease;
}

.custom-select-option:hover {
  background: rgba(103, 232, 249, 0.1);
  color: var(--accent-info);
}

.custom-select-option.selected {
  background: rgba(103, 232, 249, 0.15);
  color: var(--accent-info);
  font-weight: 500;
}

.custom-select-option.disabled {
  color: var(--text-tertiary);
  cursor: not-allowed;
  background: transparent;
}

/* Custom Scrollbar for dropdown */
.custom-select-options::-webkit-scrollbar {
  width: 6px;
}
.custom-select-options::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}
.custom-select-options::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}
.custom-select-options::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ===========================
   Tabs Component
   =========================== */
.tab-btn { 
  padding: 12px 24px; 
  background: transparent; 
  border: none; 
  border-bottom: 2px solid transparent; 
  color: var(--text-secondary); 
  font-weight: 600; 
  cursor: pointer; 
  transition: all 0.2s; 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  font-size: 14px; 
  outline: none; 
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { border-bottom-color: var(--accent-info); color: var(--text-primary); }
.tab-content { 
  display: none; 
  position: relative;
  z-index: 0;
}
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { 
  from { opacity: 0; } 
  to { opacity: 1; } 
}
