:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2236;
  --bg-card-hover: #1f2a42;
  --bg-input: #0d1321;
  --border-color: #2a3550;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-green: #22c55e;
  --accent-green-bg: rgba(34, 197, 94, 0.15);
  --accent-red: #ef4444;
  --accent-red-bg: rgba(239, 68, 68, 0.15);
  --accent-yellow: #eab308;
  --accent-yellow-bg: rgba(234, 179, 8, 0.15);
  --accent-blue: #3b82f6;
  --accent-blue-bg: rgba(59, 130, 246, 0.15);
  --accent-purple: #8b5cf6;
  --accent-purple-bg: rgba(139, 92, 246, 0.15);
  --accent-cyan: #06b6d4;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at center, var(--bg-secondary) 0%, var(--bg-primary) 70%);
}

.login-box {
  background: var(--bg-card);
  padding: 48px 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 400px;
  animation: fadeInUp 0.6s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo h1 {
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.login-logo span {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-bg);
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: white;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-red), #dc2626);
  color: white;
}

.btn-danger:hover {
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-green), #16a34a);
  color: white;
}

.btn-success:hover {
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-ghost:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 12px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* Header */
.app-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.header-logo h1 {
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.whatsapp-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-green);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  border: 1px solid transparent;
}

.whatsapp-link:hover {
  background: var(--accent-green-bg);
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--accent-green);
}

.logo-img {
  height: 32px;
  width: auto;
  object-fit: contain;
}

/* Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(59, 130, 246, 0.3);
}

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

.card-body {
  padding: 24px;
}

/* Condominium Grid */
.condominium-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.condominium-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  padding: 24px;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.condominium-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  transition: var(--transition);
}

.condominium-card.status-online::before { background: var(--accent-green); }
.condominium-card.status-degraded::before { background: var(--accent-yellow); }
.condominium-card.status-offline::before { background: var(--accent-red); }
.condominium-card.status-unknown::before { background: var(--text-muted); }

.condominium-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent-blue);
}

.condominium-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.condominium-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.condominium-stats span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.condominium-dns {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-all;
}

/* Status Dot */
.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-dot.online.pulse {
  animation: pulse-green 2s infinite;
}

.status-dot.offline {
  background: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
}

.status-dot.degraded {
  background: var(--accent-yellow);
  box-shadow: 0 0 8px var(--accent-yellow);
}

.status-dot.unknown {
  background: var(--text-muted);
}

.status-dot-lg {
  width: 16px;
  height: 16px;
}

/* Equipment Grid */
.equipment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.equipment-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  transition: var(--transition);
}

.equipment-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

.equipment-card .status-dot {
  width: 20px;
  height: 20px;
}

.equipment-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.equipment-host {
  font-size: 13px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.equipment-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
}

.equipment-actions .btn {
  flex: 1;
  justify-content: center;
}

/* Notifications */
.notification-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.notification {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: slideInRight 0.3s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.notification.success { border-left: 3px solid var(--accent-green); }
.notification.error { border-left: 3px solid var(--accent-red); }
.notification.info { border-left: 3px solid var(--accent-blue); }
.notification.warning { border-left: 3px solid var(--accent-yellow); }

.notification-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.notification-text {
  font-size: 14px;
  color: var(--text-primary);
  flex: 1;
}

.notification-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  transition: var(--transition);
}

.notification-close:hover {
  color: var(--text-primary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeInUp 0.3s ease;
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Reboot button special */
.btn-reboot {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.btn-reboot:hover {
  box-shadow: 0 6px 24px rgba(245, 158, 11, 0.5);
  transform: translateY(-1px);
}

/* Back button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 0;
  transition: var(--transition);
}

.back-btn:hover {
  color: var(--accent-blue);
}

/* Page title */
.page-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Loading spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}

/* Alert for reboot monitoring */
.reboot-progress {
  background: var(--accent-yellow-bg);
  border: 1px solid var(--accent-yellow);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--accent-yellow);
  animation: fadeIn 0.3s ease;
}

.reboot-progress.success {
  background: var(--accent-green-bg);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 8px var(--accent-green); }
  50% { box-shadow: 0 0 16px var(--accent-green), 0 0 24px rgba(34, 197, 94, 0.3); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Admin table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.admin-table tr:hover td {
  background: rgba(59, 130, 246, 0.05);
}

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

/* Admin sidebar */
.admin-layout {
  display: flex;
  min-height: calc(100vh - 60px);
}

.admin-sidebar {
  width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 24px 0;
  flex-shrink: 0;
}

.admin-sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.admin-sidebar a:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.admin-sidebar a.active {
  background: var(--accent-blue-bg);
  color: var(--accent-blue);
  border-left-color: var(--accent-blue);
}

.admin-content {
  flex: 1;
  padding: 24px;
  overflow-x: auto;
}

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

.admin-header h2 {
  font-size: 22px;
  font-weight: 800;
}

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

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  padding: 20px;
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 4px;
}

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

.stat-card.green .stat-value { color: var(--accent-green); }
.stat-card.red .stat-value { color: var(--accent-red); }
.stat-card.blue .stat-value { color: var(--accent-blue); }
.stat-card.yellow .stat-value { color: var(--accent-yellow); }

/* Filter area */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: flex-end;
}

.filter-bar .form-group {
  margin-bottom: 0;
  min-width: 180px;
}

.filter-bar .form-group label {
  font-size: 11px;
  margin-bottom: 4px;
}

.filter-bar .form-input {
  padding: 8px 12px;
  font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  .condominium-grid {
    grid-template-columns: 1fr;
  }

  .equipment-grid {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    display: flex;
    overflow-x: auto;
    padding: 0;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .admin-sidebar a {
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    padding: 12px 16px;
  }

  .admin-sidebar a.active {
    border-bottom-color: var(--accent-blue);
    border-left-color: transparent;
  }

  .header-inner {
    flex-direction: column;
    gap: 12px;
  }

  .notification-container {
    right: 16px;
    left: 16px;
    max-width: none;
  }

  .login-box {
    padding: 32px 24px;
  }

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

  .page-title {
    font-size: 22px;
  }
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-green { background: var(--accent-green-bg); color: var(--accent-green); }
.badge-red { background: var(--accent-red-bg); color: var(--accent-red); }
.badge-yellow { background: var(--accent-yellow-bg); color: var(--accent-yellow); }
.badge-blue { background: var(--accent-blue-bg); color: var(--accent-blue); }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.pagination button {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
}

.pagination button:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.pagination button.active {
  background: var(--accent-blue-bg);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
