/* Admin dashboard styles — loaded in admin layout (not included in Tailwind build) */

.admin-sidebar {
  width: 260px;
  min-height: 100vh;
  background: #1A1A2E;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 30;
  transition: transform 0.3s ease;
}

.admin-sidebar-logo {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.admin-sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-sidebar-section {
  margin-bottom: 1.5rem;
}

.admin-sidebar-section-title {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.15s ease;
}

.admin-nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
}

.admin-nav-link.active {
  background: linear-gradient(135deg, rgba(255,122,0,0.15), rgba(255,154,51,0.08));
  color: #FF9A33;
}

.admin-nav-link.active .admin-nav-icon {
  color: #FF7A00;
}

.admin-nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.admin-nav-label {
  white-space: nowrap;
}

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

.admin-topbar {
  background: white;
  border-bottom: 1px solid #E2E8F0;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.admin-page-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1E293B;
  margin: 0;
}

.admin-mobile-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.25rem;
  color: #64748B;
  cursor: pointer;
}

.admin-card {
  background: white;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  padding: 1.5rem;
  transition: box-shadow 0.2s ease;
}

.admin-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.admin-stat-card {
  background: white;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.admin-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: #1E293B;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.admin-stat-label {
  font-size: 0.8125rem;
  color: #64748B;
  font-weight: 500;
}

.admin-stat-trend {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

.admin-stat-trend.up { color: #16A34A; }
.admin-stat-trend.down { color: #DC2626; }

.admin-table-wrap {
  background: white;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  overflow: hidden;
}

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

.admin-table thead {
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
}

.admin-table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748B;
  padding: 0.75rem 1rem;
  text-align: left;
  white-space: nowrap;
}

.admin-table td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: #334155;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: #F8FAFC;
}

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

.admin-btn-outline-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.8125rem;
  color: #64748B;
  text-decoration: none;
  background: white;
  transition: all 0.15s ease;
}

.admin-btn-outline-sm:hover {
  border-color: #CBD5E1;
  color: #1E293B;
  background: #F8FAFC;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.admin-badge-success {
  background: #DCFCE7;
  color: #15803D;
}

.admin-badge-warning {
  background: #FFF7ED;
  color: #C2410C;
}

.admin-badge-danger {
  background: #FEF2F2;
  color: #DC2626;
}

.admin-badge-info {
  background: #EFF6FF;
  color: #2563EB;
}

.admin-badge-neutral {
  background: #F1F5F9;
  color: #475569;
}

.admin-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1A1A2E;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.admin-flash-success {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  color: #166534;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.admin-flash-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #991B1B;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.admin-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.admin-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.admin-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.admin-search-box {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.admin-search-box input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.5rem;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  font-size: 0.875rem;
  background: white;
  outline: none;
}

.admin-search-box input:focus {
  border-color: #FF7A00;
  box-shadow: 0 0 0 3px rgba(255,122,0,0.1);
}

.admin-empty {
  text-align: center;
  padding: 3rem 2rem;
  color: #94A3B8;
}

.admin-empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 16px;
  background: #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #CBD5E1;
}

.admin-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 25;
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.admin-btn-primary {
  background: linear-gradient(135deg, #FF7A00, #FF9A33);
  color: white;
  box-shadow: 0 2px 8px rgba(255,122,0,0.25);
}

.admin-btn-primary:hover {
  background: linear-gradient(135deg, #E66D00, #FF8A1A);
  box-shadow: 0 4px 12px rgba(255,122,0,0.35);
  transform: translateY(-1px);
}

.admin-form-group {
  margin-bottom: 1.25rem;
}

.admin-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.375rem;
}

.admin-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #1F2937;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.admin-input:focus {
  border-color: #FF7A00;
  box-shadow: 0 0 0 3px rgba(255,122,0,0.1);
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 1rem;
}

.admin-pagination a,
.admin-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 0.5rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748B;
  text-decoration: none;
  transition: all 0.15s;
}

.admin-pagination a:hover {
  background: #F1F5F9;
  color: #1E293B;
}

.admin-pagination .current {
  background: #FF7A00;
  color: white;
  font-weight: 600;
}

@media (max-width: 1024px) {
  .admin-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .admin-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
  }

  .admin-sidebar.admin-sidebar-open {
    transform: translateX(0);
  }

  .admin-sidebar.admin-sidebar-open ~ .admin-sidebar-backdrop {
    display: block;
  }

  .admin-mobile-toggle {
    display: flex;
  }

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

  .admin-grid-4,
  .admin-grid-3,
  .admin-grid-2 {
    grid-template-columns: 1fr;
  }

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

  .admin-search-box {
    max-width: 100%;
  }

  #admin-main main {
    padding: 1rem !important;
  }
}

/* ==========================================
   Equation Editor Modal & Helper Styles
   ========================================== */

.math-editor-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  animation: math-fade-in 0.2s ease-out;
}

.math-editor-modal {
  width: 95%;
  max-width: 680px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
  animation: math-scale-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes math-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes math-scale-up {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.math-editor-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #1E1B4B, #311042);
  color: white;
}

.math-editor-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.math-editor-close-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.math-editor-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.math-editor-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.75rem 1.25rem;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
  overflow-x: auto;
  scrollbar-width: none;
}

.math-editor-tabs::-webkit-scrollbar {
  display: none;
}

.math-editor-tab-btn {
  background: transparent;
  border: none;
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748B;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.math-editor-tab-btn:hover {
  background: #E2E8F0;
  color: #1E293B;
}

.math-editor-tab-btn.active {
  background: #E0F2FE;
  color: #0369A1;
}

.math-editor-symbol-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.4rem;
  padding: 1rem 1.5rem;
  max-height: 160px;
  overflow-y: auto;
  border-bottom: 1px solid #E2E8F0;
  background: #FFF;
}

.math-editor-symbol-btn {
  height: 40px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s;
  padding: 2px;
}

.math-editor-symbol-btn:hover {
  background: white;
  border-color: #FF7A00;
  box-shadow: 0 2px 4px rgba(255,122,0,0.15);
  transform: translateY(-1px);
}

.math-editor-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  overflow-y: auto;
}

.math-editor-textarea {
  width: 100%;
  height: 90px;
  padding: 0.75rem;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9375rem;
  resize: none;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: white;
}

.math-editor-textarea:focus {
  border-color: #FF7A00;
  box-shadow: 0 0 0 3px rgba(255,122,0,0.15);
}

.math-editor-preview-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.math-editor-preview-area {
  min-height: 100px;
  background: #F8FAFC;
  border: 1px dashed #CBD5E1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  overflow-x: auto;
  background-image: radial-gradient(#E2E8F0 1.5px, transparent 1.5px);
  background-size: 16px 16px;
}

.math-editor-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #E2E8F0;
  background: #F8FAFC;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.math-editor-mode-toggle {
  display: flex;
  gap: 0.75rem;
}

.math-editor-radio-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
}

@media (max-width: 600px) {
  .math-editor-symbol-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
