/* ============================================================
   ADMIN DASHBOARD STYLES
   Visitor dashboard page — loaded after style.css
   ============================================================ */

/* ===== BASE ===== */
body {
  background: var(--primary);
  min-height: 100vh;
}

/* ===== HEADER ===== */
.admin-header {
  text-align: center;
  padding: 3rem 2rem 1rem;
}

.admin-header h1 {
  font-family: "Playfair Display", serif;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  background: linear-gradient(135deg, #fff 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.admin-header p {
  color: var(--text-muted);
  font-size: 1rem;
}

.admin-link {
  display: inline-block;
  margin-top: 0.75rem;
  color: var(--accent-light);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.7;
  transition: opacity 0.3s;
}

.admin-link:hover {
  opacity: 1;
}

/* ===== DASHBOARD ===== */
.dashboard {
  margin: 2rem auto;
  padding: 0 2rem;
  display: none;
}

.dashboard.active {
  display: block;
}

/* ===== STATS CARDS ===== */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-stat-card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  text-align: center;
}

.admin-stat-number {
  font-family: "Playfair Display", serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-light);
}

.admin-stat-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== CONTROLS ===== */
.admin-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-controls-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.admin-search {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text);
  font-family: "Manrope", sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.3s;
  box-sizing: border-box;
  min-width: 0;
}

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

.admin-btn {
  padding: 0.6rem 1.25rem;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text);
  font-family: "Manrope", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.admin-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ===== FILTER ROW ===== */
.filter-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select {
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text);
  font-family: "Manrope", sans-serif;
  font-size: 0.78rem;
  outline: none;
  cursor: pointer;
  min-width: 130px;
  transition: border-color 0.3s;
}

.filter-select:focus {
  border-color: var(--accent);
}

/* ===== TABLE ===== */
.admin-table-wrap {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-table thead {
  background: rgba(74, 158, 255, 0.08);
}

.admin-table th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 0.3s;
}

.admin-table th:hover {
  color: var(--text);
}

.admin-table th .sort-icon {
  margin-left: 0.3rem;
  opacity: 0.4;
}

.admin-table th.sorted .sort-icon {
  opacity: 1;
}

.admin-table td {
  padding: 0.7rem 1rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(74, 158, 255, 0.06);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-table tbody tr {
  transition: background 0.2s;
}

.admin-table tbody tr:hover {
  background: rgba(74, 158, 255, 0.04);
}

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

.page-badge {
  display: inline-block;
  background: rgba(74, 158, 255, 0.1);
  color: var(--accent-light);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.location-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.country-flag {
  font-size: 1rem;
}

.device-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(74, 158, 255, 0.08);
  color: var(--accent-light);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.device-icon {
  font-size: 0.85rem;
}

/* ===== LOADING ===== */
.loading-spinner {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.pagination button {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text-muted);
  font-family: "Manrope", sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

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

.pagination-info {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ===== LOGIN OVERLAY ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.92);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.login-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.login-popup:focus-within {
  box-shadow: 0 0 0 3px var(--accent, #4a9eff), 0 20px 60px rgba(0, 0, 0, 0.4);
}

.login-popup {
  background: var(--card-bg, rgba(20, 35, 60, 0.95));
  border: 1px solid var(--border, rgba(74, 158, 255, 0.15));
  border-radius: 20px;
  padding: 2.5rem 2rem;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: popupSlideIn 0.4s ease;
}

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

.login-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.login-title {
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
  color: var(--text, #fff);
  margin-bottom: 0.4rem;
}

.login-subtitle {
  color: var(--text-muted, rgba(255,255,255,0.5));
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

/* Google Sign-In container */
.google-signin-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.login-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  font-size: 0.82rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.login-btn {
  width: 100%;
  padding: 0.75rem;
  border-radius: 50px;
  border: none;
  background: linear-gradient(135deg, var(--accent, #4a9eff), var(--accent-light, #7bb8ff));
  color: #fff;
  font-family: "Manrope", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.3s;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(74, 158, 255, 0.3);
}

.login-btn:active {
  transform: translateY(0);
}

.login-back {
  display: inline-block;
  margin-top: 1.25rem;
  color: var(--text-muted, rgba(255,255,255,0.5));
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.7;
  transition: opacity 0.3s;
}

.login-back:hover {
  opacity: 1;
}

/* ===== ACCESS DENIED ===== */
.access-denied {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted, rgba(255,255,255,0.5));
  display: none;
}

.access-denied.active {
  display: block;
}

.access-denied-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.access-denied h2 {
  font-family: "Playfair Display", serif;
  color: #f87171;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.access-denied p {
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.access-denied .retry-btn {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  border-radius: 50px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: transparent;
  color: #f87171;
  font-family: "Manrope", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s;
}

.access-denied .retry-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .admin-table-wrap {
    overflow-x: auto;
  }

  .admin-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-controls-actions {
    justify-content: center;
  }

  .admin-controls .admin-btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  .admin-search {
    min-width: unset;
  }

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

  .admin-stat-card {
    padding: 1rem;
  }

  .admin-stat-number {
    font-size: 1.5rem;
  }

  .admin-stat-label {
    font-size: 0.65rem;
  }

  .filter-row {
    gap: 0.5rem;
  }

  .filter-group {
    flex: 1 1 45%;
  }

  .filter-select {
    min-width: 0;
    width: 100%;
  }

  .login-popup {
    padding: 2rem 1.5rem;
    margin: 0 1rem;
  }

  .admin-header {
    padding: 2rem 1rem 0.5rem;
  }

  .admin-header h1 {
    font-size: 1.5rem;
  }

  .pagination {
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .pagination button {
    padding: 0.35rem 0.65rem;
    font-size: 0.72rem;
  }
}
