:root {
  --bg-color: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #0ea5e9;
  --danger: #ef4444;
  --font-family: "Inter", sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  background-image: radial-gradient(
      at 0% 0%,
      hsla(253, 16%, 7%, 1) 0,
      transparent 50%
    ),
    radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
    radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  width: 100%;
  min-height: 100vh;
  position: relative;
}

/* Glassmorphism Utilities */
.glass-panel {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Views Management */
.view {
  display: none;
  height: 100vh;
  animation: fadeIn 0.4s ease-out;
}

.view.active {
  display: flex; /* or block depending on view */
}

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

/* Login View */
#login-view {
  align-items: center;
  justify-content: center;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.logo-area {
  text-align: center;
}

.wifi-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  color: var(--accent);
}

.wifi-icon svg {
  width: 100%;
  height: 100%;
}

.logo-area h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-area p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Forms */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

input {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  padding: 0.85rem 1rem;
  border-radius: 8px;
  color: white;
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.btn-primary {
  width: 100%;
  padding: 0.85rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.error-message {
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 1rem;
  min-height: 1.2rem;
}

/* Dashboard View */
#dashboard-view {
  flex-direction: column;
  height: auto;
  min-height: 100vh;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  margin: 1rem 2rem;
  position: sticky;
  top: 1rem;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.2rem;
}

.wifi-icon-small {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.nav-controls {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.search-bar {
  position: relative;
  width: 300px;
}

.search-bar svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-bar input {
  width: 100%;
  padding-left: 40px;
  background: rgba(15, 23, 42, 0.4);
}

.btn-secondary {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.btn-secondary:hover {
  color: white;
  border-color: var(--text-muted);
}

.content-area {
  padding: 0 2rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card {
  padding: 1.5rem;
}

.card h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.card p {
  font-size: 2rem;
  font-weight: 700;
  color: white;
}

.table-container {
  width: 100%;
  overflow: hidden;
  padding: 1px; /* border fix */
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: rgba(255, 255, 255, 0.05);
}

th,
td {
  padding: 1rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}

th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  font-size: 0.95rem;
}

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

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.wifi-name {
  font-weight: 600;
  color: white;
}

.password-tag {
  display: inline-block;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  margin-right: 0.5rem;
  margin-bottom: 0.25rem;
  font-family: monospace;
}

.state-message {
  padding: 3rem;
  text-align: center;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
  margin: 0 auto;
}

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

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .nav-controls {
    width: 100%;
    flex-direction: column;
  }

  .table-container {
    overflow-x: auto;
  }
}

/* DataTables Customization */
.dataTables_wrapper {
    padding: 1rem;
    color: var(--text-muted);
}

.dataTables_length select,
.dataTables_filter input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.4rem;
    border-radius: 6px;
    margin-left: 0.5rem;
}

.dataTables_filter input:focus {
    outline: none;
    border-color: var(--primary);
}

table.dataTable {
    border-collapse: collapse !important;
    background: transparent !important;
    color: var(--text-main) !important;
}

table.dataTable thead th {
    border-bottom: 1px solid var(--glass-border) !important;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding: 1rem !important;
}

table.dataTable tbody td {
    border-bottom: 1px solid var(--glass-border) !important;
    padding: 1rem 0.5rem !important;
}

table.dataTable.no-footer {
    border-bottom: none !important;
}

/* Pagination Buttons */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-muted) !important;
    border: 1px solid transparent !important;
    border-radius: 6px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary) !important;
    color: white !important;
    border: 1px solid var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border: 1px solid var(--glass-border) !important;
}

/* Info text */
.dataTables_wrapper .dataTables_info {
    color: var(--text-muted) !important;
}
