/* ========================================
   Admin Portal — Classroom Feedback Tool
   Palette: sidebar #0f172a, content bg #f1f5f9,
   accent #6366f1, cards #ffffff,
   success #10b981, warning #f59e0b, error #ef4444
   ======================================== */

/* --- Reset & Base --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  font-size: 14px;
  line-height: 1.5;
}

/* --- Login Overlay --- */
#login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-card {
  background: #ffffff;
  border-radius: 10px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  max-width: 400px;
  width: 90%;
}

.login-card h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #0f172a;
}

.login-subtitle {
  color: #94a3b8;
  font-size: 14px;
  margin-bottom: 32px;
}

.login-error {
  color: #ef4444;
  margin-top: 12px;
  font-size: 13px;
}

.login-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  outline: none;
  text-align: center;
}
.login-input:focus { border-color: #6366f1; }

/* --- App Shell Layout --- */
#app-shell {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
#sidebar {
  width: 240px;
  background: #0f172a;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

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

.sidebar-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

#nav-list {
  list-style: none;
  padding: 8px;
  flex: 1;
}

#nav-list li {
  padding: 10px 16px;
  margin: 2px 0;
  cursor: pointer;
  font-size: 14px;
  color: rgba(255,255,255,0.55);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  user-select: none;
}

#nav-list li:hover {
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.85);
}

#nav-list li.active {
  background: rgba(99,102,241,0.15);
  color: #ffffff;
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

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

/* --- Content Area --- */
#content {
  margin-left: 240px;
  flex: 1;
  padding: 24px;
  min-height: 100vh;
}

/* --- Buttons --- */
.btn-primary {
  background: #6366f1;
  color: #ffffff;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
  line-height: 1.4;
}

.btn-primary:hover {
  background: #4f46e5;
}

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

.btn-text {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 0;
}

.btn-text:hover {
  color: #ffffff;
}

.btn-small {
  font-size: 12px;
  padding: 4px 12px;
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-danger {
  background: #ef4444;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

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

/* --- Cards --- */
.card {
  background: #ffffff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  margin-bottom: 16px;
}

.card-header {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #0f172a;
}

/* --- Stat Cards --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #ffffff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  border-left: 3px solid #6366f1;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #6366f1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 4px;
}

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

table th,
table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}

table th {
  font-weight: 600;
  color: #64748b;
  background: #f8fafc;
  position: sticky;
  top: 0;
  white-space: nowrap;
}

table tr:hover td {
  background: rgba(99,102,241,0.03);
}

/* --- Search Bar --- */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-bar input,
.search-bar select {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #ffffff;
  color: #1e293b;
  transition: border-color 0.15s ease;
}

.search-bar input:focus,
.search-bar select:focus {
  border-color: #6366f1;
}

.search-bar input::placeholder {
  color: #94a3b8;
}

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

.modal {
  background: #ffffff;
  border-radius: 10px;
  padding: 24px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #0f172a;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #94a3b8;
  line-height: 1;
}

.modal-close:hover {
  color: #64748b;
}

/* --- Toast --- */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  color: #ffffff;
  animation: toastIn 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  max-width: 360px;
}

.toast-success {
  background: #10b981;
}

.toast-error {
  background: #ef4444;
}

.toast-warning {
  background: #f59e0b;
  color: #1e293b;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
}

.badge-blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-green {
  background: #d1fae5;
  color: #059669;
}

.badge-yellow {
  background: #fef3c7;
  color: #b45309;
}

.badge-red {
  background: #fee2e2;
  color: #b91c1c;
}

/* --- Section Title --- */
.section-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: #0f172a;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 48px 0;
  color: #94a3b8;
}

.empty-state p {
  margin-top: 8px;
  font-size: 14px;
}

/* --- Loading --- */
.loading {
  text-align: center;
  padding: 48px 0;
  color: #94a3b8;
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

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

/* --- Feedback Grid Specific --- */
.feedback-table-wrapper {
  overflow-x: auto;
  max-height: 70vh;
  overflow-y: auto;
}

.feedback-table th:first-child,
.feedback-table td:first-child {
  position: sticky;
  left: 0;
  background: #ffffff;
  z-index: 1;
}

.feedback-table tr:hover td:first-child {
  background: rgba(99,102,241,0.03);
}

/* --- Checkbox List --- */
.checkbox-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
}

.checkbox-item:hover {
  background: #f8fafc;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #ffffff;
  color: #1e293b;
  transition: border-color 0.15s ease;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #6366f1;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* --- Utility --- */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: #94a3b8; }
.text-success { color: #10b981; }
.text-warning { color: #f59e0b; }
.text-danger  { color: #ef4444; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
