* { box-sizing: border-box; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(34, 197, 94, 0.5); }
  50% { box-shadow: 0 0 15px rgba(34, 197, 94, 0.8); }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
  min-height: 100vh;
  margin: 0;
  padding: 24px;
  color: #1a1a1a;
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.live-indicator .dot {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

.section {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  margin-bottom: 24px;
  overflow: hidden;
  animation: fadeIn 0.4s ease-out;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.table-wrapper {
  overflow-x: auto;
}
.section-title {
  font-size: 1rem;
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e5e5;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  color: #1e293b;
}
.meta {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
  margin-left: 8px;
  padding: 2px 6px;
  background: #e2e8f0;
  border-radius: 4px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
th {
  text-align: left;
  padding: 8px 10px;
  font-weight: 600;
  color: #475569;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.3px;
}
td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  transition: background 0.2s ease;
}
tbody tr {
  transition: all 0.2s ease;
}
tbody tr:nth-child(even) td { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { 
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  transform: scale(1.005);
}
tbody tr:hover { 
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}
tr.backlog-alert td { 
  background: #f87171 !important;
  color: #1f2937;
  font-weight: 700;
}
tr.backlog-alert td:first-child {
  border-left: 6px solid #dc2626 !important;
}
tr.backlog-alert:hover td { 
  background: #f87171 !important;
}
.num { 
  text-align: right; 
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.availability { display: inline-flex; align-items: center; gap: 8px; }
.availability .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}
.availability.available .status-dot { 
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  animation: glow 2s ease-in-out infinite;
}
.availability.away .status-dot { 
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}
.availability.offline .status-dot { 
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}
.status-text { font-weight: 600; color: #334155; }
.since { color: #94a3b8; font-weight: 400; font-size: 0.8125rem; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid #e5e5e5;
  font-size: 0.75rem;
  color: #64748b;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}
.pagination select {
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.75rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pagination select:hover { border-color: #3b82f6; }
.pagination select:focus { 
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.pagination button {
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.2s;
}
.pagination button:hover:not(:disabled) { 
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
  transform: scale(1.05);
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Settings button */
.queue-name-cell { display: flex; align-items: center; justify-content: space-between; gap: 6px; white-space: nowrap; }
.queue-name-cell span { font-weight: 600; color: #1e40af; }
.settings-btn {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  cursor: pointer;
  padding: 3px;
  color: #3b82f6;
  transition: all 0.2s;
}
.settings-btn:hover { 
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-color: #3b82f6;
}
.settings-btn svg { width: 14px; height: 14px; }

.loading { 
  opacity: 0.6; 
  pointer-events: none;
}
.loading .section {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.last-updated {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.last-updated::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  animation: fadeIn 0.3s ease-out;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}
.modal-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: #1e293b;
}
.modal-close {
  background: #f1f5f9;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: #64748b;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { background: #e2e8f0; color: #1e293b; }
.modal-body { padding: 0; }
.modal-table {
  width: 100%;
  border-collapse: collapse;
}
.modal-table th, .modal-table td {
  padding: 16px 24px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}
.modal-table th {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}
.modal-table td:first-child { font-weight: 600; color: #334155; }
.modal-table input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.875rem;
  transition: all 0.2s;
}
.modal-table input[type="number"]:hover {
  border-color: #cbd5e1;
}
.modal-table input[type="number"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}
.btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-cancel {
  background: #fff;
  border: 2px solid #e2e8f0;
  color: #64748b;
}
.btn-cancel:hover { 
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}
.btn-save {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: 2px solid #3b82f6;
  color: #fff;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}
.btn-save:hover { 
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 10px -2px rgba(59, 130, 246, 0.4);
}

.error {
  padding: 16px 20px;
  color: #b91c1c;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border: 1px solid #fecaca;
  border-radius: 10px;
  margin-bottom: 24px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeIn 0.3s ease-out;
}
.error::before {
  content: '\26A0\FE0F';
  font-size: 1.25rem;
}

/* Login Screen */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  animation: fadeIn 0.5s ease-out;
}
.login-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  padding: 48px;
  text-align: center;
  max-width: 400px;
}
.login-card h1 {
  font-size: 1.75rem;
  margin-bottom: 8px;
}
.login-card p {
  color: #64748b;
  margin-bottom: 32px;
}
.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}
.login-btn:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}
.login-btn img {
  width: 20px;
  height: 20px;
}

/* User Info */
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
}
.user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
}
.logout-btn {
  background: #f1f5f9;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}
.logout-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}
