/* PENGAJAR PRO — Smart Digital Workspace */
:root {
  --bg: #071b36;
  --bg2: #0b2748;
  --bg3: #0f3259;
  --card: #0d2a4a;
  --border: rgba(148, 163, 184, 0.18);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent2: #0ea5e9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,0.35);
  --sidebar-w: 280px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow: hidden;
}
body.light {
  --bg: #f1f5f9;
  --bg2: #e2e8f0;
  --bg3: #cbd5e1;
  --card: #ffffff;
  --border: rgba(15, 23, 42, 0.12);
  --text: #0f172a;
  --muted: #64748b;
  --shadow: 0 8px 24px rgba(15,23,42,0.08);
}

/* Layout */
.layout { display: flex; height: 100vh; height: 100dvh; }
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--bg2) 0%, var(--bg) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform .28s ease;
  z-index: 40;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.brand img {
  width: 48px; height: 48px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(14,165,233,.25);
}
.brand b { display: block; font-size: 15px; letter-spacing: .3px; }
.brand small { color: var(--muted); font-size: 10px; letter-spacing: 1px; }
.profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #4f46e5);
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
  box-shadow: 0 4px 14px rgba(14,165,233,.3);
  flex-shrink: 0;
}
.profile b { font-size: 13px; display: block; }
.profile small { color: var(--muted); font-size: 11px; }

nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
nav label {
  display: block;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted);
  padding: 10px 10px 6px;
  font-weight: 600;
}
.nav {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 2px 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background .2s, transform .15s, padding-left .2s;
}
.nav i { font-style: normal; width: 22px; text-align: center; opacity: .85; font-size: 15px; }
.nav:hover { background: rgba(56,189,248,.08); padding-left: 16px; }
.nav.active {
  background: linear-gradient(90deg, rgba(14,165,233,.22) 0%, transparent 100%);
  border-left: 3px solid var(--accent2);
  color: var(--accent);
}
.side-bottom {
  padding: 12px 14px 16px;
  border-top: 1px solid var(--border);
}
.connection {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}
.connection span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse 1.5s infinite;
}
.connection.online span { background: var(--success); animation: none; }
.connection.offline span { background: var(--danger); animation: none; }
.side-bottom small { display: block; text-align: center; color: var(--muted); font-size: 10px; margin-top: 8px; }

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.topbar small { display: block; font-size: 10px; color: var(--muted); letter-spacing: 1px; }
.topbar b { font-size: 16px; }
.topbar-clock {
  margin-left: auto;
  text-align: right;
  padding: 0 14px;
  line-height: 1.25;
  min-width: 120px;
}
.clock-time {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
  color: var(--accent);
}
.clock-date {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
body.light .clock-time { color: #0284c7; }
.topright { display: flex; align-items: center; gap: 8px; }
.icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .2s, transform .15s, color .2s;
}
.icon:hover { background: var(--bg3); transform: translateY(-1px); }
.icon.mobile { display: none; }

.view {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scroll-behavior: smooth;
}
footer {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  padding: 10px;
  letter-spacing: 1px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Cards & grid */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-2px); }
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-card .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat-card .value { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.stat-card .icon-wrap {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 18px;
  margin-bottom: 4px;
}

/* Page header */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head h2 { font-size: 20px; font-weight: 700; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s, opacity .2s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff;
  box-shadow: 0 4px 14px rgba(14,165,233,.35);
}
.btn-primary:hover { opacity: .92; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--bg3); }
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
}
.btn-sm { padding: 7px 12px; font-size: 12px; }

/* Table / list */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.list-item:hover { background: var(--bg3); transform: translateX(3px); }
.list-item .meta { flex: 1; min-width: 0; }
.list-item .meta b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .meta small { color: var(--muted); font-size: 12px; }
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-blue { background: rgba(14,165,233,.15); color: #38bdf8; }
.badge-green { background: rgba(16,185,129,.15); color: #34d399; }
.badge-amber { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge-red { background: rgba(239,68,68,.15); color: #f87171; }
.badge-gray { background: rgba(148,163,184,.15); color: #94a3b8; }

/* Empty state */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty .big { font-size: 42px; margin-bottom: 12px; opacity: .5; }
.empty p { margin-bottom: 16px; font-size: 14px; }

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: .3px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: box-shadow .2s, border-color .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(14,165,233,.18);
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* Modal */
.modal-wrap {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-wrap.open { display: flex; }
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
  animation: fadeIn .25s ease;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.modal-head small { font-size: 10px; color: var(--muted); letter-spacing: 1px; }
.modal-head h2 { font-size: 18px; margin-top: 2px; }
#modalContent { padding: 18px 20px 22px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 200;
  opacity: 0;
  transition: transform .3s, opacity .3s;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

/* Search bar */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.search-bar input {
  flex: 1;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
}
.search-bar input:focus {
  outline: none;
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(14,165,233,.15);
}

/* Interactive Calendar */
.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.cal-toolbar h3 {
  font-size: 17px;
  font-weight: 700;
  min-width: 160px;
  text-align: center;
}
.cal-nav-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s, transform .15s;
}
.cal-nav-btn:hover { background: var(--bg3); transform: translateY(-1px); }
.cal-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 18px;
  align-items: start;
}
@media (max-width: 720px) {
  .cal-layout { grid-template-columns: 1fr; }
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  background: var(--card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .12s;
  position: relative;
  padding: 4px;
}
.cal-day:hover { background: var(--bg3); transform: scale(1.04); }
.cal-day.today {
  border-color: var(--accent2);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(14,165,233,.25);
}
.cal-day.has-event { background: rgba(14,165,233,.12); }
.cal-day.selected {
  background: linear-gradient(135deg, rgba(14,165,233,.28), rgba(79,70,229,.18));
  border-color: var(--accent2);
  color: var(--accent);
  font-weight: 700;
}
.cal-day.other-month { opacity: 0.35; }
.cal-day .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent2);
}
.cal-day.today .dot { background: var(--accent); }
.cal-head {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  padding: 6px 0;
}
.cal-side {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 220px;
}
.cal-side h4 {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--accent);
}
.cal-side .empty-day {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 24px 8px;
}
.cal-event-item {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background .15s;
}
.cal-event-item:hover { background: var(--bg3); }
.cal-event-item b { display: block; font-size: 13px; margin-bottom: 2px; }
.cal-event-item small { color: var(--muted); font-size: 11px; }

/* Dashboard clock widget */
.dash-clock {
  background: linear-gradient(135deg, rgba(14,165,233,.15), rgba(79,70,229,.12));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.dash-clock .big-time {
  font-size: 36px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  color: var(--accent);
  line-height: 1;
}
.dash-clock .big-date {
  font-size: 14px;
  color: var(--muted);
  margin-top: 6px;
  font-weight: 500;
}
.dash-clock .greeting {
  font-size: 15px;
  font-weight: 600;
}
body.light .dash-clock .big-time { color: #0284c7; }

/* AI Assistant */
.chat-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  margin-bottom: 14px;
  padding: 4px;
}
.chat-msg {
  padding: 12px 16px;
  border-radius: 14px;
  max-width: 85%;
  font-size: 13.5px;
  line-height: 1.55;
}
.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff;
}
.chat-msg.bot {
  align-self: flex-start;
  background: var(--bg3);
  border: 1px solid var(--border);
}
.chat-input {
  display: flex;
  gap: 10px;
}
.chat-input textarea {
  flex: 1;
  min-height: 48px;
  max-height: 120px;
  resize: none;
}

/* Settings */
.settings-section {
  margin-bottom: 24px;
}
.settings-section h3 {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--accent);
  letter-spacing: .3px;
}

/* Loader */
.loader {
  width: 36px; height: 36px;
  border: 3px solid var(--bg3);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,.4); }
  .icon.mobile { display: grid; }
  .view { padding: 14px; }
  .grid-4, .grid-3 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .topbar-clock { padding: 0 6px; min-width: 90px; }
  .clock-time { font-size: 15px; }
  .clock-date { font-size: 10px; }
  .dash-clock .big-time { font-size: 28px; }
}
@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .topbar-clock { display: none; }
  .dash-clock { flex-direction: column; align-items: flex-start; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
body.light ::-webkit-scrollbar-thumb { background: #94a3b8; }
