/* Admin Panel Styles - McKodev Chat */
/* Uses CSS variables from app.css */

html, body { height: 100%; margin: 0; }

.admin-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.admin-sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.admin-sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.admin-sidebar-header .logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-light);
}

.admin-sidebar-header .logo span {
  color: var(--primary);
}

.admin-badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary-light);
  margin-top: 4px;
  font-weight: 600;
}

.admin-nav {
  flex: 1;
  padding: 12px 0;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.admin-nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-light);
  text-decoration: none;
}

.admin-nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-light);
  border-left-color: var(--primary);
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon .material-icons {
  font-size: 20px;
}

.stat-icon .material-icons {
  font-size: 28px;
}

.admin-sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.back-link {
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.back-link:hover {
  color: var(--text-light);
  text-decoration: none;
}

/* ---- Main ---- */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8f9fa;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.admin-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

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

.biz-label {
  font-size: 13px;
  color: var(--text-muted);
}

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

/* ---- Tab panels ---- */
.tab-panel {
  display: none;
}

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

/* ---- Stats grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.stat-icon {
  font-size: 32px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border-radius: 12px;
  flex-shrink: 0;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Toolbar ---- */
.tab-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-search {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg-main);
  outline: none;
  transition: border-color 0.2s;
}

.admin-search:focus {
  border-color: var(--primary);
}

/* ---- Tables ---- */
.admin-table-wrap {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

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

.admin-table thead {
  background: var(--bg-input);
}

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

.admin-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.admin-table tr:hover td {
  background: var(--bg-hover);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px !important;
  font-style: italic;
}

.user-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-cell .text-muted {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.actions-cell {
  white-space: nowrap;
}

.desc-cell {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Status dots ---- */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #888;
}

.status-dot.online { background: var(--online); }
.status-dot.away { background: var(--away); }
.status-dot.busy { background: var(--busy); }
.status-dot.offline { background: #888; }

/* ---- Badges ---- */
.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.role-owner {
  background: #fff3e0;
  color: #e65100;
}

.role-admin {
  background: #e3f2fd;
  color: #1565c0;
}

.role-member {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}

.type-public {
  background: #e8f5e9;
  color: #2e7d32;
}

.type-private {
  background: #fce4ec;
  color: #c62828;
}

.role-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--bg-main);
  cursor: pointer;
}

/* ---- Danger button ---- */
.btn-danger {
  background: var(--busy);
  color: #fff;
  border-radius: var(--radius);
}

.btn-danger:hover {
  background: #d32f2f;
}

/* ---- Settings ---- */
.settings-form {
  max-width: 600px;
}

.settings-section {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.settings-section h3 {
  font-size: 16px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.settings-form .form-group {
  margin-bottom: 14px;
}

.settings-form .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.settings-form .form-group input,
.settings-form .form-group textarea,
.settings-form .form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg-main);
  outline: none;
  transition: border-color 0.2s;
}

.settings-form .form-group input:focus,
.settings-form .form-group textarea:focus {
  border-color: var(--primary);
}

.settings-actions {
  padding-top: 8px;
}

/* ---- Temp password display ---- */
.temp-password {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: monospace;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 2px;
  margin-top: 12px;
  user-select: all;
  color: var(--primary-dark);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .admin-sidebar {
    width: 56px;
    overflow: hidden;
  }

  .admin-sidebar-header .logo,
  .admin-badge,
  .admin-nav-item span:not(.nav-icon),
  .back-link span,
  .biz-label {
    display: none;
  }

  .admin-nav-item {
    padding: 12px 0;
    justify-content: center;
  }

  .nav-icon {
    font-size: 20px;
  }

  .back-link {
    justify-content: center;
    font-size: 18px;
  }

  .admin-content {
    padding: 16px;
  }

  .admin-header {
    padding: 12px 16px;
  }

  .admin-header h1 {
    font-size: 18px;
  }

  .tab-toolbar {
    flex-direction: column;
  }

  .admin-search {
    width: 100%;
  }

  .admin-table {
    font-size: 13px;
  }

  .admin-table th,
  .admin-table td {
    padding: 8px 10px;
  }
}
