/* ===== Variables ===== */
:root {
  --bg-primary: #0a1628;
  --bg-secondary: #0f1f3a;
  --bg-card: #132244;
  --bg-input: #0c1a30;
  --border: #1a3055;
  --text: #e0e8f0;
  --text-dim: #7a8da6;
  --accent: #00d4ff;
  --accent-hover: #00b8e0;
  --btn: #0088aa;
  --btn-hover: #006d8a;
  --danger: #ff4466;
  --danger-hover: #dd2244;
  --success: #00cc88;
  --radius: 8px;
  --radius-lg: 12px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  min-height: 100vh;
}

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

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo h1 {
  color: var(--accent);
  font-size: 1.5rem;
  margin-top: 0.75rem;
}

.login-logo p {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input, select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

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

.btn-primary {
  background: var(--btn);
  color: #fff;
}

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

.btn-accent {
  background: var(--accent);
  color: var(--bg-primary);
}

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

.btn-danger {
  background: var(--danger);
  color: #fff;
}

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

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

.btn-ghost:hover { background: var(--bg-secondary); color: var(--text); }

.btn-full { width: 100%; }

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}

/* ===== Error ===== */
.error-msg {
  background: rgba(255, 68, 102, 0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* ===== Layout ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
}

.app-header .user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab {
  padding: 0.6rem 1.2rem;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== Cards / Table ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-header h2 {
  font-size: 1rem;
  color: var(--accent);
}

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

th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

th {
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

tr:hover td {
  background: rgba(0, 212, 255, 0.04);
}

/* ===== Profile List ===== */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: border-color 0.2s;
  cursor: pointer;
}

.profile-card:hover {
  border-color: var(--accent);
}

.profile-card h3 {
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.profile-card .meta {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.profile-card .meta span {
  margin-right: 1rem;
}

.profile-card .actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* ===== Profile Form ===== */
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: var(--bg-secondary);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.section-header:hover {
  background: rgba(0, 212, 255, 0.08);
}

.section-header h3 {
  font-size: 0.9rem;
  color: var(--accent);
}

.section-header .chevron {
  color: var(--text-dim);
  transition: transform 0.2s;
  font-size: 0.8rem;
}

.section-header.open .chevron {
  transform: rotate(180deg);
}

.section-body {
  display: none;
  padding: 1.25rem;
}

.section-body.open {
  display: block;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  justify-content: flex-end;
}

/* ===== WiFi STA Tabs ===== */
.wifi-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.wifi-tab {
  padding: 0.35rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}

.wifi-tab.active {
  background: var(--btn);
  color: #fff;
  border-color: var(--btn);
}

.wifi-panel { display: none; }
.wifi-panel.active { display: block; }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}

.modal h2 {
  color: var(--accent);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
}

.empty-state svg {
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* ===== Badge ===== */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-admin { background: rgba(0, 212, 255, 0.15); color: var(--accent); }
.badge-tech { background: rgba(0, 204, 136, 0.15); color: var(--success); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .main-content { padding: 1rem; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; }
  .app-header { padding: 0.75rem 1rem; }
}

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
  .login-card { margin: 1rem; padding: 1.5rem; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ===== Notification ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  z-index: 300;
  animation: slideIn 0.3s ease;
}

.toast-success { background: var(--success); color: #000; }
.toast-error { background: var(--danger); color: #fff; }

@keyframes slideIn {
  from { transform: translateY(1rem); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
