/* UrDashView Design System */

:root {
  /* Colors - Modern dark theme */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2332;
  --bg-card-hover: #1f2b3d;
  --bg-input: #0f1724;
  --bg-sidebar: #0d1321;

  --text-primary: #f0f4f8;
  --text-secondary: #8899aa;
  --text-muted: #5a6b7d;

  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.15);

  --color-ok: #10b981;
  --color-ok-bg: rgba(16, 185, 129, 0.1);
  --color-ok-glow: rgba(16, 185, 129, 0.2);

  --color-error: #ef4444;
  --color-error-bg: rgba(239, 68, 68, 0.1);
  --color-error-glow: rgba(239, 68, 68, 0.2);

  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.1);

  --color-offline: #6b7280;
  --color-offline-bg: rgba(107, 114, 128, 0.1);

  --border-color: rgba(255, 255, 255, 0.06);
  --border-active: rgba(59, 130, 246, 0.3);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px var(--accent-glow);

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;

  --sidebar-width: 240px;
}

/* Reset & Base */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ========== SIDEBAR ========== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-primary), #6366f1);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.logo-text {
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent-primary);
  border: 1px solid var(--border-active);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.btn-refresh {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  color: var(--accent-primary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-refresh:hover {
  background: rgba(59, 130, 246, 0.2);
  box-shadow: var(--shadow-glow);
}

.btn-refresh.loading svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========== MAIN CONTENT ========== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 28px 32px;
  min-height: 100vh;
}

.page {
  display: block;
  animation: fadeIn 0.3s ease;
}

.page.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-subtitle {
  color: var(--text-secondary);
  margin-top: 4px;
  font-size: 0.95rem;
}

/* ========== STAT CARDS ========== */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-total::before {
  background: linear-gradient(90deg, var(--accent-primary), #6366f1);
}

.stat-ok::before {
  background: var(--color-ok);
}

.stat-error::before {
  background: var(--color-error);
}

.stat-offline::before {
  background: var(--color-offline);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-total .stat-icon {
  background: var(--accent-glow);
  color: var(--accent-primary);
}

.stat-ok .stat-icon {
  background: var(--color-ok-bg);
  color: var(--color-ok);
}

.stat-error .stat-icon {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.stat-offline .stat-icon {
  background: var(--color-offline-bg);
  color: var(--color-offline);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ========== SECTION HEADER ========== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.filter-group {
  display: flex;
  gap: 6px;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.filter-btn {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-btn:hover {
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ========== CLIENTS GRID (now horizontal grid for server groups) ========== */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  align-items: start;
  gap: 16px;
}

/* ========== SERVER GROUP ========== */
.server-group {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.server-group:hover {
  border-color: rgba(255, 255, 255, 0.08);
}

.server-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
  gap: 12px;
}

.server-group-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.server-group-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.server-group-chevron {
  transition: transform var(--transition-normal);
  flex-shrink: 0;
  color: var(--accent-primary);
  opacity: 0.8;
}

.server-group.collapsed .server-group-chevron {
  transform: rotate(-90deg);
}

.server-group-icon {
  color: var(--accent-primary);
  flex-shrink: 0;
}

.server-group-name {
  font-weight: 800;
  font-size: 1.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.server-group-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
}

.server-group-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.group-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

.group-badge.ok {
  background: var(--color-ok-bg);
  color: var(--color-ok);
  border: 1px solid var(--color-ok-glow);
}

.group-badge.error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid var(--color-error-glow);
}

.group-badge.offline {
  background: var(--color-offline-bg);
  color: var(--color-offline);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.group-badge.running {
  background: rgba(6, 182, 212, 0.12);
  color: #06b6d4;
  border: 1px solid rgba(6, 182, 212, 0.25);
  animation: badgePulse 1.5s ease-in-out infinite;
}

.group-usage {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-primary);
  padding: 3px 10px;
  background: rgba(59, 130, 246, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.15);
  white-space: nowrap;
}

.server-group-body {
  max-height: 2000px;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 1;
}

.server-group.collapsed .server-group-body {
  max-height: 0;
  opacity: 0;
}

/* Server health indicator */
.health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.health-dot.online {
  background: var(--color-ok);
  box-shadow: 0 0 6px var(--color-ok-glow);
}

.health-dot.offline {
  background: var(--color-error);
  box-shadow: 0 0 6px var(--color-error-glow);
  animation: healthPulse 1s ease-in-out infinite;
}

@keyframes healthPulse {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 4px var(--color-error-glow);
  }

  50% {
    opacity: 0.5;
    box-shadow: 0 0 12px var(--color-error-glow);
  }
}

.server-group.server-offline {
  border-color: rgba(239, 68, 68, 0.3);
}

.server-group.server-offline .server-group-header {
  background: rgba(239, 68, 68, 0.04);
}

.server-group.server-offline .server-group-icon {
  color: var(--color-error);
  opacity: 0.7;
}

.server-group.server-offline .server-group-name {
  opacity: 0.8;
}

.server-group.has-errors {
  border-color: rgba(239, 68, 68, 0.4);
  animation: borderErrorPulse 2s infinite ease-in-out;
}

@keyframes borderErrorPulse {

  0%,
  100% {
    box-shadow: 0 0 5px 2px rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
  }

  50% {
    box-shadow: 0 0 20px 6px rgba(239, 68, 68, 0.6), inset 0 0 10px rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.8);
  }
}

.server-group.has-warnings {
  border-color: rgba(245, 158, 11, 0.4);
  animation: borderWarningPulse 2s infinite ease-in-out;
}

@keyframes borderWarningPulse {

  0%,
  100% {
    box-shadow: 0 0 5px 2px rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
  }

  50% {
    box-shadow: 0 0 20px 6px rgba(245, 158, 11, 0.5), inset 0 0 10px rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.7);
  }
}

.server-offline-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-error);
  animation: badgePulse 1.5s ease-in-out infinite;
}

.server-heartbeat {
  display: flex;
  align-items: center;
}

.server-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  padding: 0 16px 16px;
}

.client-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: all var(--transition-normal);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.client-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.client-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.client-card.status-ok::after {
  background: var(--color-ok);
}

.client-card.status-error::after {
  background: var(--color-error);
}

.client-card.status-offline::after {
  background: var(--color-offline);
}

.client-card.status-error {
  animation: cardWarningPulse 1.5s infinite ease-in-out;
}

.client-card.status-offline {
  animation: cardErrorPulse 1.5s infinite ease-in-out;
}

@keyframes cardErrorPulse {

  0%,
  100% {
    box-shadow: 0 0 4px 1px rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
  }

  50% {
    box-shadow: 0 0 15px 4px rgba(239, 68, 68, 0.6), inset 0 0 5px rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.8);
  }
}

@keyframes cardWarningPulse {

  0%,
  100% {
    box-shadow: 0 0 4px 1px rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
  }

  50% {
    box-shadow: 0 0 15px 4px rgba(245, 158, 11, 0.4), inset 0 0 5px rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.7);
  }
}

.client-card.status-warning::after {
  background: var(--color-warning);
}

.client-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.client-name {
  font-weight: 600;
  font-size: 1rem;
}

.client-server {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.ok {
  background: var(--color-ok-bg);
  color: var(--color-ok);
  border: 1px solid var(--color-ok-glow);
}

.status-badge.error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid var(--color-error-glow);
}

.status-badge.offline {
  background: var(--color-offline-bg);
  color: var(--color-offline);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.status-badge.warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.unknown {
  background: rgba(107, 114, 128, 0.1);
  color: var(--text-muted);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.client-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-value {
  font-size: 0.9rem;
  font-weight: 500;
}

/* ========== EMPTY STATE ========== */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state svg {
  margin-bottom: 16px;
}

.empty-state p {
  line-height: 1.6;
}

/* ========== CARD ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* ========== FORMS ========== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group select {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color var(--transition-fast);
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.add-server-form h3 {
  margin-bottom: 16px;
  font-size: 1.1rem;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== TEST RESULT ========== */
.test-result {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}

.test-result.success {
  background: var(--color-ok-bg);
  border: 1px solid var(--color-ok-glow);
  color: var(--color-ok);
}

.test-result.failure {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-glow);
  color: var(--color-error);
}

/* ========== SERVERS LIST ========== */
.servers-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.server-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-fast);
}

.server-item:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.server-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.server-info .name {
  font-weight: 600;
  font-size: 1rem;
}

.server-info .url {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
}

.server-actions {
  display: flex;
  gap: 8px;
}

/* ========== DATA TABLE ========== */
.history-table-container {
  margin-top: 16px;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 14px !important;
}

.history-filters {
  margin-bottom: 0;
}

.history-filters .form-grid {
  margin-bottom: 0;
}

/* ========== TOAST ========== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  min-width: 280px;
  max-width: 400px;
}

.toast.success {
  background: var(--color-ok);
  color: white;
}

.toast.error {
  background: var(--color-error);
  color: white;
}

.toast.info {
  background: var(--accent-primary);
  color: white;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  width: 90%;
  max-width: 500px;
  animation: scaleIn 0.2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-close:hover {
  color: var(--text-primary);
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========== PULSE ANIMATION ========== */
.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* ========== RUNNING STATUS (Backup em andamento) ========== */
.client-card.status-running::after {
  background: linear-gradient(180deg, #06b6d4, #3b82f6);
  animation: runningGlow 1.5s ease-in-out infinite;
}

.status-badge.running {
  background: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
  border: 1px solid rgba(6, 182, 212, 0.3);
  animation: badgePulse 1.5s ease-in-out infinite;
}

@keyframes runningGlow {

  0%,
  100% {
    opacity: 0.7;
  }

  50% {
    opacity: 1;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
  }
}

@keyframes badgePulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* ========== ACTIVITY SECTION (inside client card) ========== */
.activity-section {
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.15);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 12px;
}

.activity-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.activity-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #06b6d4;
}

.activity-pulse {
  width: 8px;
  height: 8px;
  background: #06b6d4;
  border-radius: 50%;
  animation: activityPulse 1.2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes activityPulse {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4);
  }

  50% {
    opacity: 0.6;
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0);
  }
}

/* ========== PROGRESS BAR ========== */
.progress-bar-container {
  width: 100%;
  height: 20px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  margin-bottom: 6px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #06b6d4, #3b82f6);
  border-radius: 10px;
  transition: width 0.5s ease;
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.15),
      transparent);
  animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

/* ========== ACTIVITY STATS ========== */
.activity-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  gap: 8px;
}

/* ========== ACTIVITIES PANEL (section between summary and grid) ========== */
.activities-panel {
  margin-bottom: 24px;
}

.no-activities {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
}

.activity-card {
  background: var(--bg-card);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 8px;
  transition: all var(--transition-fast);
}

.activity-card:hover {
  border-color: rgba(6, 182, 212, 0.35);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.08);
}

.activity-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.activity-card-header strong {
  font-size: 0.95rem;
}

.activity-server-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-primary);
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  margin-left: auto;
}

.activity-card-type {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* ========== USAGE ITEMS ========== */
.usage-item {
  border-top: 1px solid var(--border-color);
  padding-top: 6px;
  margin-top: 4px;
}

.usage-item .detail-value {
  color: var(--accent-primary);
  font-weight: 600;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }

  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .server-group-grid {
    grid-template-columns: 1fr;
  }

  .server-group-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .server-group-right {
    flex-wrap: wrap;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== LOGIN SCREEN ========== */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}

.login-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(59, 130, 246, 0.08);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent-primary), #6366f1);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin: 0 auto 16px;
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
}

.login-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.login-form-group {
  margin-bottom: 20px;
}

.login-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.login-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.login-input-wrapper:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-input-wrapper svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.login-input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
}

.login-input-wrapper input::placeholder {
  color: var(--text-muted);
}

.login-error {
  padding: 10px 14px;
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-glow);
  border-radius: var(--radius-md);
  color: var(--color-error);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 20px;
  text-align: center;
}

.login-error.hidden {
  display: none;
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent-primary), #6366f1);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.login-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.login-btn-text.hidden,
.login-btn-loading.hidden {
  display: none;
}

.spinner {
  animation: spin 1s linear infinite;
}

.login-footer {
  text-align: center;
}

.login-footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ========== SIDEBAR USER ========== */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), #6366f1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-logout {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-logout:hover {
  background: var(--color-error-bg);
  color: var(--color-error);
}

/* ========== USERS MANAGEMENT ========== */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.user-item:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.user-item.user-inactive {
  opacity: 0.5;
}

.user-item-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), #6366f1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.user-item-info {
  flex: 1;
  min-width: 0;
}

.user-item-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.user-item-username {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.user-role-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.user-role-badge.role-admin {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.user-role-badge.role-tech {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.user-role-badge.role-client {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.user-status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.user-status-badge.active {
  background: var(--color-ok-bg);
  color: var(--color-ok);
}

.user-status-badge.inactive {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.user-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Checkbox list for server assignment */
.checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.checkbox-item:hover {
  border-color: var(--accent-primary);
}

.checkbox-item input[type="checkbox"] {
  accent-color: var(--accent-primary);
}

#serverAssignGroup small {
  color: var(--text-muted);
  font-style: italic;
}