/* =====================================================
   REVALABS ADMIN DASHBOARD - NAVY BLUE THEME
   Matching Revalabs Website Design System
   ===================================================== */

/* ── COLOR SYSTEM (Matching Revalabs) ── */
:root {
  --navy-blue: #0A1F44;
  --navy-dark: #061528;
  --navy-light: #0F2A56;
  --white: #FFFFFF;
  --black: #000000;
  
  --text-on-navy: #FFFFFF;
  --text-on-white: #111111;
  --text-muted: #666666;
  
  --accent-blue: #3B82F6;
  --accent-blue-hover: #2563EB;
  --accent-light: #60A5FA;
  
  --success-green: #10b981;
  --success-green-hover: #059669;
  --warning-yellow: #f59e0b;
  --error-red: #ef4444;
  
  --border-light: #EAEAEA;
  --border-navy: rgba(255, 255, 255, 0.15);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-blue: 0 10px 40px rgba(59, 130, 246, 0.15);
  
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  
  --transition-base: 0.2s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy-blue) 100%);
  color: var(--text-on-white);
  line-height: 1.6;
  min-height: 100vh;
}

.admin-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem;
}

/* ── HEADER ── */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  padding: 2rem;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.admin-header-content h1 {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--navy-blue);
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.admin-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 500;
}

.admin-refresh-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1.75rem;
  background: var(--accent-blue);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-blue);
}

.admin-refresh-btn:hover {
  background: var(--accent-blue-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 45px rgba(59, 130, 246, 0.25);
}

.admin-refresh-btn svg {
  flex-shrink: 0;
}

/* ── FILTERS SECTION ── */
.admin-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  background: var(--white);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
}

.filter-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--navy-blue);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-select {
  padding: 0.875rem 1rem;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 500;
  background: var(--white);
  color: var(--text-on-white);
  cursor: pointer;
  transition: all var(--transition-base);
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-select:hover {
  border-color: var(--accent-light);
}

.filter-actions {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.btn-apply,
.btn-clear {
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-base);
  flex: 1;
}

.btn-apply {
  background: var(--success-green);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-apply:hover {
  background: var(--success-green-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.btn-clear {
  background: transparent;
  color: var(--text-muted);
  border: 2px solid var(--border-light);
}

.btn-clear:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--text-on-white);
}

/* ── STATS SECTION ── */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--accent-blue);
  transition: all var(--transition-base);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--navy-blue);
  line-height: 1;
}

/* ── LOADING/ERROR/EMPTY STATES ── */
.loading-state,
.error-state,
.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.spinner {
  width: 56px;
  height: 56px;
  border: 5px solid rgba(59, 130, 246, 0.1);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-state p,
.error-state p,
.empty-state p {
  font-size: 1.125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.error-state p {
  color: var(--error-red);
}

/* ── TABLE CONTAINER ── */
.table-container {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow-x: auto;
  overflow-y: visible;
  margin-bottom: 1.5rem;
}

/* Custom scrollbar for table */
.table-container::-webkit-scrollbar {
  height: 10px;
}

.table-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--accent-blue);
  border-radius: 10px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: var(--accent-blue-hover);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1400px;
}

.admin-table thead {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy-blue) 100%);
}

.admin-table th {
  padding: 1.25rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: 0.075em;
  white-space: nowrap;
  border-bottom: 2px solid var(--accent-blue);
}

.admin-table td {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9375rem;
  color: var(--text-on-white);
  vertical-align: middle;
}

.admin-table tbody tr {
  transition: all var(--transition-base);
}

.admin-table tbody tr:hover {
  background: #f8fafc;
  box-shadow: inset 4px 0 0 var(--accent-blue);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

/* ── TABLE CELL STYLES ── */
.req-id {
  background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent-blue);
  font-weight: 600;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.message-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-cell a {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 600;
  transition: all var(--transition-base);
  border-bottom: 2px solid transparent;
}

.upload-cell a:hover {
  color: var(--accent-blue-hover);
  border-bottom-color: var(--accent-blue);
}

/* ── BADGES ── */
.badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-source {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.badge-new {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 1px solid #fcd34d;
}

.badge-pending {
  background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
  color: #9f1239;
  border: 1px solid #f9a8d4;
}

.badge-contacted {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.badge-closed {
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
  color: #374151;
  border: 1px solid #9ca3af;
}

/* ── ACTIONS CELL ── */
.actions-cell {
  min-width: 280px;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.status-cell {
  min-width: 140px;
}

.status-dropdown {
  padding: 0.625rem 0.875rem;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 600;
  background: var(--white);
  color: var(--text-on-white);
  cursor: pointer;
  transition: all var(--transition-base);
  flex: 1;
}

.status-dropdown:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.status-dropdown:hover {
  border-color: var(--accent-light);
}

.btn-update {
  padding: 0.625rem 1.25rem;
  background: var(--accent-blue);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-update:hover {
  background: var(--accent-blue-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.btn-update:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── LOAD MORE BUTTON ── */
.load-more-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.btn-load-more {
  padding: 1rem 2.5rem;
  background: var(--white);
  color: var(--accent-blue);
  border: 2px solid var(--accent-blue);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-base);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-load-more:hover {
  background: var(--accent-blue);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-blue);
}

/* ── SHOWING COUNT ── */
.showing-count {
  text-align: center;
  color: var(--white);
  font-size: 1rem;
  margin-bottom: 2rem;
  font-weight: 500;
}

.showing-count span {
  font-weight: 700;
  color: var(--accent-light);
}

/* ── RESPONSIVE DESIGN ── */
@media (max-width: 768px) {
  .admin-container {
    padding: 1rem;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.5rem;
  }

  .admin-header-content h1 {
    font-size: 1.75rem;
  }

  .admin-refresh-btn {
    width: 100%;
    justify-content: center;
  }

  .admin-filters {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }

  .filter-actions {
    width: 100%;
    flex-direction: column;
  }

  .btn-apply,
  .btn-clear {
    width: 100%;
  }

  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .stat-card {
    padding: 1.5rem;
  }

  .stat-value {
    font-size: 2rem;
  }

  .table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
  }

  .admin-table {
    min-width: 1200px;
  }

  .admin-table th,
  .admin-table td {
    padding: 1rem 0.75rem;
  }

  .actions-cell {
    flex-direction: column;
    min-width: 200px;
  }

  .status-dropdown,
  .btn-update {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .admin-stats {
    grid-template-columns: 1fr;
  }

  .admin-header-content h1 {
    font-size: 1.5rem;
  }
}
