/**
 * MMO IT Solutions Admin Dashboard - CSS
 * Modern, clean UI with accessibility first
 */

/* ============================================================ */
/* Layout & Grid */
/* ============================================================ */

.admin-body {
  background: #fafafa;
  color: #1f2937;
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: scroll;
}

.admin-header {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.admin-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.admin-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.admin-logo h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: #2563eb;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-greeting {
  font-size: 0.95rem;
  color: #6b7280;
}

/* ============================================================ */
/* Authentication Modal */
/* ============================================================ */

.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.auth-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  animation: slideUp 0.3s ease;
}

.auth-header {
  margin-bottom: 2rem;
  text-align: center;
}

.auth-header h2 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 600;
}

.auth-header p {
  margin: 0;
  color: #6b7280;
  font-size: 0.95rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-hint {
  display: block;
  margin-top: 0.25rem;
  color: #9ca3af;
  font-size: 0.85rem;
}

.auth-error {
  background: #fee2e2;
  color: #991b1b;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  text-align: center;
}

/* ============================================================ */
/* Main Dashboard Layout */
/* ============================================================ */

.admin-main {
  flex: 1;
  display: flex;
}

.admin-sidebar {
  width: 280px;
  background: white;
  border-right: 1px solid #e5e7eb;
  padding: 2rem 0;
  position: fixed;
  left: 0;
  top: 65px;
  height: calc(100vh - 65px);
  overflow-y: auto;
  z-index: 50;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  color: #2563eb;
  background: #f0f4ff;
}

.nav-item.active {
  color: #2563eb;
  background: #f0f4ff;
  border-left: 3px solid #2563eb;
  padding-left: calc(1.5rem - 3px);
}

.nav-icon {
  font-size: 1.25rem;
}

.admin-content {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  margin-left: 280px;
  max-width: 100%;
}

/* ============================================================ */
/* Section Styling */
/* ============================================================ */

.section-header {
  margin-bottom: 1rem;
}

.section-header h2 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 600;
}

.text-muted {
  color: #9ca3af;
  font-size: 0.95rem;
  margin: 0;
}

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

/* ============================================================ */
/* Stats Cards */
/* ============================================================ */

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

.stat-card {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  display: flex;
  gap: 1.5rem;
  border: 1px solid #e5e7eb;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
}

.stat-content {
  flex: 1;
}

.stat-label {
  font-size: 0.85rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.25rem;
}

.stat-subtext {
  font-size: 0.85rem;
  color: #d1d5db;
}

.refresh-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
}

/* ============================================================ */
/* Signups Table */
/* ============================================================ */

.signups-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.signups-controls .search-input {
  flex: 1;
  min-width: 200px;
}

.signups-controls .form-select {
  min-width: 150px;
}

.search-input {
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}

.search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-select {
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: white;
  color: #1f2937;
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.signups-table-wrapper {
  background: white;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  overflow-x: auto;
  margin-bottom: 0.5rem;
}

.signups-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.signups-table thead {
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
}

.signups-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.signups-table td {
  padding: 1rem;
  border-bottom: 1px solid #f3f4f6;
  color: #1f2937;
}

.signups-table tbody tr:hover {
  background: #f9fafb;
}

.loading-row {
  color: #9ca3af;
  font-style: italic;
}

.badge {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
}

.badge-yes {
  background: #d1fae5;
  color: #065f46;
}

.badge-no {
  background: #fee2e2;
  color: #991b1b;
}

/* ============================================================ */
/* Pagination */
/* ============================================================ */

.table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.pagination-info {
  color: #6b7280;
  font-size: 0.95rem;
}

.pagination-controls {
  display: flex;
  gap: 0.5rem;
}

/* ============================================================ */
/* Export Cards */
/* ============================================================ */

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

.export-card {
  background: white;
  border-radius: 10px;
  padding: 2rem;
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all 0.3s ease;
}

.export-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.1);
}

.export-icon {
  font-size: 3rem;
  line-height: 1;
}

.export-card h3 {
  margin: 0;
  font-size: 1.25rem;
  color: #1f2937;
}

.export-card p {
  margin: 0;
  color: #6b7280;
  font-size: 0.95rem;
  line-height: 1.5;
}

.export-info {
  color: #9ca3af;
  font-size: 0.9rem;
}

.export-notes {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  border: 1px solid #e5e7eb;
  margin-bottom: 2rem;
}

.export-notes h4 {
  margin: 0 0 1rem;
  color: #1f2937;
  font-size: 1.1rem;
}

.export-notes ul {
  margin: 0;
  padding-left: 1.5rem;
  color: #6b7280;
  font-size: 0.95rem;
  line-height: 1.6;
}

.export-notes li {
  margin-bottom: 0.5rem;
}

.export-schedule {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  border: 1px solid #e5e7eb;
}

.export-schedule h4 {
  margin: 0 0 0.5rem;
  color: #1f2937;
  font-size: 1.1rem;
}

.export-schedule p {
  margin: 0 0 1rem;
  color: #9ca3af;
  font-size: 0.95rem;
}

/* ============================================================ */
/* Buttons */
/* ============================================================ */

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  text-decoration: none;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #2563eb;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.btn-secondary {
  background: #e5e7eb;
  color: #1f2937;
}

.btn-secondary:hover:not(:disabled) {
  background: #d1d5db;
}

.btn-logout {
  padding: 0.5rem 1rem;
  background: #fee2e2;
  color: #991b1b;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: #fecaca;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* ============================================================ */
/* Toast Notifications */
/* ============================================================ */

.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  pointer-events: none;
}

.toast {
  background: white;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 300px;
  animation: slideInRight 0.3s ease;
  pointer-events: auto;
}

.toast.success {
  border-left: 4px solid #10b981;
  color: #065f46;
}

.toast.error {
  border-left: 4px solid #ef4444;
  color: #7f1d1d;
}

.toast.info {
  border-left: 4px solid #3b82f6;
  color: #1e3a8a;
}

/* ============================================================ */
/* View Sections */
/* ============================================================ */

.view-section:not(.active) {
  display: none;
}

.view-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* ============================================================ */
/* Animations */
/* ============================================================ */

@keyframes slideUp {
  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 fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* ============================================================ */
/* Inline Spinner (for buttons and toasts) */
/* ============================================================ */

.spinner-inline {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.toast .spinner-inline {
  border-color: rgba(59, 130, 246, 0.3);
  border-top-color: #3b82f6;
}

/* ============================================================ */
/* Status Badges */
/* ============================================================ */

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.status-active {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.status-rejected {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge.status-warning {
  background: #dbeafe;
  color: #1e40af;
}

/* ============================================================ */
/* Responsive Design */
/* ============================================================ */

@media (max-width: 1024px) {
  .admin-sidebar {
    width: 220px;
  }

  .admin-content {
    margin-left: 220px;
  }

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

@media (max-width: 768px) {
  .admin-main {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    position: sticky;
    top: 65px;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    padding: 0;
  }

  .admin-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 0;
  }

  .nav-item {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 1rem 1.5rem;
  }

  .admin-content {
    padding: 1rem;
    margin-left: 0;
  }

  .admin-header-content {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .admin-user {
    width: 100%;
    justify-content: space-between;
  }

  .signups-table {
    font-size: 0.85rem;
  }

  .signups-table th,
  .signups-table td {
    padding: 0.75rem;
  }

  .table-pagination {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .export-options {
    grid-template-columns: 1fr;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .admin-header {
    padding: 0.75rem;
  }

  .admin-container {
    padding: 0 1rem;
  }

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

  .admin-content {
    padding: 1rem;
  }

  .auth-card {
    padding: 1.5rem;
  }

  .stats-grid {
    gap: 1rem;
  }

  .stat-card {
    gap: 1rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }
}

/* ============================================================ */
/* Danger Button */
/* ============================================================ */

.btn-danger {
  background: #fee2e2;
  color: #991b1b;
}

.btn-danger:hover:not(:disabled) {
  background: #fecaca;
  color: #7f1d1d;
}
