/* ============================================================
   DEKIDS CLASSROOM – Components (components.css)
   ============================================================ */

/* ========== NAVBAR ========== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-h);
  z-index: 100;
  background: rgba(11, 15, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  padding: 0 var(--spc-6);
  gap: var(--spc-4);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--spc-3);
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--txt-primary);
  letter-spacing: -0.03em;
  text-decoration: none;
}

.navbar-brand .brand-icon {
  width: 36px; height: 36px;
  background: var(--grad-hero);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.navbar-spacer { flex: 1; }

.navbar-user {
  display: flex;
  align-items: center;
  gap: var(--spc-3);
  cursor: pointer;
  padding: var(--spc-2) var(--spc-3);
  border-radius: var(--radius);
  transition: background var(--ease);
}
.navbar-user:hover { background: var(--clr-surface-2); }

.navbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--grad-hero);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--text-sm);
  color: #fff;
  text-transform: uppercase;
  flex-shrink: 0;
}

.navbar-user-info { line-height: 1.3; }
.navbar-user-name { font-size: var(--text-sm); font-weight: 600; }
.navbar-user-role {
  font-size: var(--text-xs);
  color: var(--txt-accent);
  text-transform: capitalize;
}

.navbar-actions { display: flex; align-items: center; gap: var(--spc-2); }

/* ========== SIDEBAR ========== */
.sidebar {
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--grad-sidebar);
  border-right: 1px solid var(--clr-border);
  padding: var(--spc-6) var(--spc-3);
  overflow-y: auto;
  z-index: 90;
}

.sidebar-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--txt-muted);
  padding: var(--spc-3) var(--spc-3) var(--spc-2);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--spc-3);
  padding: var(--spc-3) var(--spc-3);
  border-radius: var(--radius);
  color: var(--txt-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--ease);
  text-decoration: none;
  margin-bottom: var(--spc-1);
}

.sidebar-item .sidebar-icon { font-size: 1.1rem; width: 20px; text-align: center; }

.sidebar-item:hover {
  background: var(--clr-surface-2);
  color: var(--txt-primary);
}

.sidebar-item.active {
  background: rgba(99, 102, 241, 0.2);
  color: var(--txt-accent);
  box-shadow: inset 3px 0 0 var(--clr-primary);
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spc-2);
  padding: var(--spc-3) var(--spc-5);
  font-size: var(--text-sm);
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--ease);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: var(--grad-hero);
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}
.btn-primary:hover { box-shadow: 0 6px 25px rgba(99, 102, 241, 0.6); filter: brightness(1.1); }

.btn-ghost {
  background: var(--clr-surface);
  color: var(--txt-secondary);
  border: 1px solid var(--clr-border);
}
.btn-ghost:hover { background: var(--clr-surface-2); color: var(--txt-primary); border-color: var(--clr-border-2); }

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--clr-danger-h);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3); }

.btn-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--clr-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.btn-success:hover { background: rgba(16, 185, 129, 0.25); }

.btn-sm { padding: var(--spc-2) var(--spc-3); font-size: var(--text-xs); }
.btn-lg { padding: var(--spc-4) var(--spc-8); font-size: var(--text-base); border-radius: var(--radius-lg); }
.btn-block { width: 100%; justify-content: center; }

.btn-icon {
  padding: var(--spc-2);
  border-radius: var(--radius-sm);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  color: var(--txt-secondary);
  cursor: pointer;
  transition: all var(--ease);
  font-size: var(--text-base);
  line-height: 1;
}
.btn-icon:hover { background: var(--clr-surface-2); color: var(--txt-primary); }

/* ========== CARDS ========== */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--spc-6);
  position: relative;
  overflow: hidden;
  transition: all var(--ease);
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-card);
  opacity: 0;
  transition: opacity var(--ease);
  pointer-events: none;  /* prevent overlay from blocking button clicks */
}

.card:hover::before { opacity: 1; }
.card-hover:hover {
  border-color: var(--clr-border-2);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spc-4);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--txt-primary);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--txt-secondary);
  margin-top: var(--spc-1);
}

.card-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.card-icon.indigo  { background: rgba(99, 102, 241, 0.2); }
.card-icon.cyan    { background: rgba(6, 182, 212, 0.2); }
.card-icon.green   { background: rgba(16, 185, 129, 0.2); }
.card-icon.yellow  { background: rgba(245, 158, 11, 0.2); }
.card-icon.red     { background: rgba(239, 68, 68, 0.2); }

/* Stat card */
.stat-value {
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--grad-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label { font-size: var(--text-sm); color: var(--txt-secondary); }

/* ========== FORMS ========== */
.form-group { margin-bottom: var(--spc-5); }

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--txt-secondary);
  margin-bottom: var(--spc-2);
}

.form-control {
  width: 100%;
  padding: var(--spc-3) var(--spc-4);
  background: var(--clr-bg-3);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  color: var(--txt-primary);
  font-size: var(--text-sm);
  transition: all var(--ease);
  outline: none;
}

.form-control:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-control::placeholder { color: var(--txt-muted); }
.form-control:disabled { opacity: 0.5; cursor: not-allowed; }

.form-hint {
  font-size: var(--text-xs);
  color: var(--txt-muted);
  margin-top: var(--spc-1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spc-4);
}

/* Toggle / Switch */
.form-toggle {
  display: flex;
  align-items: center;
  gap: var(--spc-3);
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  width: 44px; height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--clr-bg-3);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-full);
  transition: all var(--ease);
}
.toggle-slider::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  top: 2px; left: 2px;
  background: var(--txt-muted);
  border-radius: 50%;
  transition: all var(--ease);
}
.toggle-switch input:checked + .toggle-slider { background: var(--clr-primary); border-color: var(--clr-primary); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(20px); background: #fff; }

/* File drop area */
.file-drop {
  border: 2px dashed var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--spc-10) var(--spc-6);
  text-align: center;
  cursor: pointer;
  transition: all var(--ease);
  position: relative;
}
.file-drop:hover, .file-drop.drag-over {
  border-color: var(--clr-primary);
  background: rgba(99, 102, 241, 0.05);
}
.file-drop input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%;
}
.file-drop-icon { font-size: 2.5rem; margin-bottom: var(--spc-3); }
.file-drop-text { color: var(--txt-secondary); font-size: var(--text-sm); }
.file-drop-hint { color: var(--txt-muted); font-size: var(--text-xs); margin-top: var(--spc-2); }

/* ========== TABLE ========== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--clr-border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table thead {
  background: var(--clr-bg-3);
  border-bottom: 1px solid var(--clr-border);
}

.table th {
  padding: var(--spc-3) var(--spc-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--txt-muted);
  white-space: nowrap;
}

.table td {
  padding: var(--spc-3) var(--spc-4);
  color: var(--txt-secondary);
  border-bottom: 1px solid var(--clr-border);
}

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

.table tbody tr {
  transition: background var(--ease);
}
.table tbody tr:hover { background: var(--clr-surface-2); }

/* ========== BADGE / STATUS ========== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: capitalize;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }

.badge-live     { background: rgba(16,185,129,0.15); color: var(--clr-success); }
.badge-planned  { background: rgba(99,102,241,0.15); color: var(--clr-primary-h); }
.badge-ended    { background: rgba(71,85,105,0.2);   color: var(--txt-muted); }
.badge-teacher  { background: rgba(245,158,11,0.15); color: var(--clr-warning); }
.badge-learner  { background: rgba(6,182,212,0.15);  color: var(--clr-secondary); }
.badge-admin    { background: rgba(239,68,68,0.15);  color: var(--clr-danger-h); }
.badge-operator { background: rgba(99,102,241,0.15); color: var(--clr-primary-h); }

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: var(--spc-6);
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--clr-bg-2);
  border: 1px solid var(--clr-border-2);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s cubic-bezier(0.4,0,0.2,1);
}
@keyframes slideUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:none; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spc-6);
  border-bottom: 1px solid var(--clr-border);
}

.modal-body { padding: var(--spc-6); }
.modal-footer {
  padding: var(--spc-4) var(--spc-6);
  border-top: 1px solid var(--clr-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--spc-3);
}

/* ========== TOAST ========== */
#toast-container {
  position: fixed;
  bottom: var(--spc-6);
  right: var(--spc-6);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: var(--spc-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--spc-3);
  padding: var(--spc-3) var(--spc-5);
  background: var(--clr-bg-2);
  border: 1px solid var(--clr-border-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  min-width: 240px;
  max-width: 380px;
  pointer-events: auto;
  animation: toastIn 0.25s cubic-bezier(0.4,0,0.2,1);
}
@keyframes toastIn { from { opacity:0; transform:translateX(30px); } to { opacity:1; transform:none; } }

.toast-icon { font-size: 1.2rem; flex-shrink: 0; }
.toast-success { border-left: 3px solid var(--clr-success); }
.toast-error   { border-left: 3px solid var(--clr-danger); }
.toast-info    { border-left: 3px solid var(--clr-primary); }
.toast-warning { border-left: 3px solid var(--clr-warning); }

/* ========== PAGE HEADERS ========== */
.page-header {
  margin-bottom: var(--spc-8);
}
.page-header h1 { font-size: var(--text-2xl); margin-bottom: var(--spc-2); }
.page-header p  { color: var(--txt-secondary); font-size: var(--text-base); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--spc-2);
  font-size: var(--text-sm);
  color: var(--txt-muted);
  margin-bottom: var(--spc-3);
}
.breadcrumb span { color: var(--txt-secondary); }

/* ========== GRID LAYOUTS ========== */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spc-5);
}
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--spc-5);
  margin-bottom: var(--spc-8);
}

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: var(--spc-12) var(--spc-6);
  color: var(--txt-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: var(--spc-4); opacity: 0.5; }
.empty-state h3 { color: var(--txt-secondary); margin-bottom: var(--spc-2); font-size: var(--text-lg); }
.empty-state p { font-size: var(--text-sm); max-width: 320px; margin: 0 auto var(--spc-5); }

/* ========== SECTION DIVIDER ========== */
.section-divider {
  display: flex;
  align-items: center;
  gap: var(--spc-4);
  margin: var(--spc-6) 0;
}
.section-divider::before, .section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--clr-border);
}
.section-divider span { font-size: var(--text-xs); color: var(--txt-muted); white-space: nowrap; }

/* ========== LOADER INLINE ========== */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--clr-border);
  border-top-color: var(--clr-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ========== ATTENDANCE TABLE ========== */
.duration-bar-bg {
  background: var(--clr-bg-3);
  border-radius: var(--radius-full);
  height: 6px;
  overflow: hidden;
  min-width: 80px;
}
.duration-bar {
  height: 100%;
  background: var(--grad-hero);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .grid-cards, .grid-stats { grid-template-columns: 1fr; }
  .modal { max-width: 100%; }
  .sidebar { display: none; }
}

/* ========== SKELETON ========== */
.skeleton {
  background: linear-gradient(90deg, var(--clr-bg-3) 25%, var(--clr-surface-2) 50%, var(--clr-bg-3) 75%);
  background-size: 200% 100%;
  animation: bgSkeleton 1.5s linear infinite;
  border-radius: var(--radius);
}
@keyframes bgSkeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 16px; border-radius: 4px; margin-bottom: 6px; }
.skeleton-title { height: 28px; width: 50%; margin-bottom: 12px; }
.skeleton-block { height: 60px; width: 100%; border-radius: var(--radius); }
