/* ============================================================
   Dashboard — additional styles
   ============================================================ */

/* ── Main tab panels ─────────────────────────────────────── */
.main-tab-panel        { display: none; min-height: 100vh; padding-bottom: 80px; overflow: visible !important; }
.main-tab-panel.active { display: block; overflow: visible !important; }
.main-tab-panel.hidden { display: none; }

/* ── Dashboard header ────────────────────────────────────── */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
}
.dash-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dash-logo {
  width: 48px; height: 48px;
  object-fit: contain;
  border-radius: 8px;
}
.dash-title { font-size: 17px; font-weight: 700; color: var(--text); }
.dash-sub   { font-size: 11px; color: var(--text-sub); }

/* ── Stat cards ──────────────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 20px 16px;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  transition: border-color .15s;
}
.stat-card-alert { border-color: var(--amber) !important; }
.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card-alert .stat-value { color: var(--amber); }
.stat-label {
  font-size: 11px;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── RFID card animation ─────────────────────────────────── */
.rfid-anim-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 8px;
}

.rfid-card-anim {
  position: relative;
  width: 140px; height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rfid-card {
  width: 80px; height: 52px;
  background: linear-gradient(135deg, #2e4080 0%, #1a2744 100%);
  border: 2px solid var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 8px;
  gap: 6px;
  animation: cardTap 2s ease-in-out infinite;
  position: relative;
  z-index: 2;
}
@keyframes cardTap {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  40%       { transform: translateX(18px) rotate(-3deg); }
  60%       { transform: translateX(18px) rotate(-3deg); }
  80%       { transform: translateX(0) rotate(0deg); }
}

.rfid-chip {
  width: 14px; height: 18px;
  background: #f0c814;
  border-radius: 3px;
  flex-shrink: 0;
}

.rfid-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.rfid-line {
  height: 3px;
  background: rgba(255,255,255,0.4);
  border-radius: 2px;
}
.rfid-line.short { width: 60%; }

.rfid-waves {
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
}

.rfid-wave {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
  right: 0; top: 50%;
  transform: translateY(-50%);
}
.rfid-wave.w1 { width: 16px; height: 24px; animation: wave 2s ease-out .6s infinite; }
.rfid-wave.w2 { width: 28px; height: 40px; animation: wave 2s ease-out .8s infinite; }
.rfid-wave.w3 { width: 40px; height: 56px; animation: wave 2s ease-out 1s infinite; }

@keyframes wave {
  0%   { opacity: 0; transform: translateY(-50%) scale(.8); }
  30%  { opacity: .8; }
  100% { opacity: 0; transform: translateY(-50%) scale(1.1); }
}

.scan-hint { font-size: 14px; color: var(--text-sub); text-align: center; }

/* ── Recent activity ─────────────────────────────────────── */
.recent-wrap {
  padding: 0 20px;
  margin-top: 8px;
}
.recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.recent-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.activity-tabs {
  display: flex;
  gap: 4px;
  background: var(--card-bg);
  border-radius: 8px;
  padding: 3px;
}
.activity-tab {
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.activity-tab.active {
  background: var(--accent);
  color: #fff;
}

.activity-list { display: flex; flex-direction: column; gap: 8px; }
.activity-empty { font-size: 13px; color: var(--text-sub); text-align: center; padding: 20px 0; }

.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  animation: slideIn .2s ease;
}
.act-left  { display: flex; flex-direction: column; gap: 2px; }
.act-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.act-name  { font-size: 13px; font-weight: 600; }
.act-tool  { font-size: 12px; color: var(--text-sub); }
.act-time  { font-size: 11px; color: var(--text-sub); }
.act-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 8px;
}
.act-badge.borrow { background: rgba(59,130,246,.15); color: var(--accent); border: 1px solid var(--accent); }
.act-badge.return { background: rgba(34,197,94,.15);  color: var(--green);  border: 1px solid var(--green); }

/* ── Tools Out panel ─────────────────────────────────────── */
.tools-out-wrap { padding: 0 20px; display: flex; flex-direction: column; gap: 12px; }
.tools-out-count-pill {
  background: var(--amber);
  color: #000; font-size: 12px; font-weight: 700;
  padding: 4px 12px; border-radius: 12px;
}

.tools-out-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tools-out-card.overdue { border-color: var(--red); }

.toc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.toc-name    { font-size: 15px; font-weight: 700; }
.toc-section { font-size: 12px; color: var(--text-sub); margin-top: 2px; }

.overdue-badge {
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 6px;
  flex-shrink: 0;
}

.toc-tools { display: flex; flex-direction: column; gap: 4px; }
.toc-tool  { font-size: 13px; color: var(--text); }

.toc-meta, .toc-times {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text-sub);
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* ── Mode select modal overlay ───────────────────────────── */
.modal-screen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 9999 !important;
  display: flex !important;
  align-items: flex-end !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: visible !important;
  /* iOS Safari PWA fix */
  -webkit-overflow-scrolling: touch;
}
.modal-screen.hidden { display: none !important; }

.modal-overlay-bg {
  position: fixed !important;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1;
}
.modal-content {
  position: relative;
  background: var(--navy-mid);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 120px;
  width: 100%;
  z-index: 2;
  animation: slideUp .25s ease;
  /* iOS safe area */
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ── Bottom nav ──────────────────────────────────────────── */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--navy-mid);
  border-top: 1px solid var(--border);
  display: flex;
  padding: 8px 0 env(safe-area-inset-bottom);
  z-index: 200;
}
.bottom-nav-btn {
  flex: 1;
  background: none; border: none;
  color: var(--text-sub);
  font-size: 10px;
  padding: 6px 4px;
  cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; gap: 3px;
  transition: color .15s;
}
.bottom-nav-btn span { font-size: 10px; }
.bottom-nav-btn:first-child { font-size: 18px; }
.bottom-nav-btn > *:first-child { font-size: 20px; }
.bottom-nav-btn.active { color: var(--accent); }

/* ── Screens inside dashboard panel ─────────────────────── */
#panel-dashboard .screen {
  position: relative;
  display: none;
  padding: 0 0 20px;
}
#panel-dashboard .screen.active { display: block; }
#panel-dashboard .screen.hidden { display: none; }
#panel-dashboard .modal-screen  {
  position: fixed !important;
  display: flex !important;
}
#panel-dashboard .modal-screen.hidden { display: none !important; }

#panel-dashboard .form-wrap,
#panel-dashboard .page-header,
#panel-dashboard .scan-status-bar,
#panel-dashboard .tool-list,
#panel-dashboard .scan-actions,
#panel-dashboard .another-cards,
#panel-dashboard .summary-wrap,
#panel-dashboard .btn-primary,
#panel-dashboard .btn-secondary {
  margin-left: 20px;
  margin-right: 20px;
}
#panel-dashboard .scan-status-bar { margin-bottom: 12px; }
#panel-dashboard .page-header { padding-top: 16px; margin-bottom: 16px; }

/* ── SVG Nav icons ───────────────────────────────────────── */
.bottom-nav-btn svg {
  width: 22px; height: 22px;
  stroke: currentColor;
  display: block;
  margin: 0 auto 2px;
}

/* ── Student confirm card ────────────────────────────────── */
.student-confirm-card {
  background: var(--card-bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.scc-name   { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.scc-detail { font-size: 13px; color: var(--text-sub); margin-bottom: 4px; }
.scc-email  { font-size: 12px; color: var(--accent); }

/* ── Terms & Conditions ──────────────────────────────────── */
.tc-student-info {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 0 20px 16px;
  font-size: 14px;
  font-weight: 600;
}
.tc-tools { color: var(--accent); font-weight: 400; }

.tc-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 0 20px 16px;
  max-height: 320px;
  overflow-y: auto;
}
.tc-content h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--amber);
}
.tc-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tc-list li { font-size: 13px; color: var(--text-sub); line-height: 1.5; }
.tc-list li strong { color: var(--text); }

.tc-actions {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Tools panel filter pills ────────────────────────────── */
.tools-filter-pills {
  display: flex;
  gap: 6px;
}
.filter-pill {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text-sub);
  font-size: 12px;
  padding: 4px 12px;
  cursor: pointer;
  transition: all .15s;
}
.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Tool card in tools panel ────────────────────────────── */
.tool-panel-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.tool-panel-img {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--navy-mid);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.tool-panel-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}
.tool-panel-info { flex: 1; min-width: 0; }
.tool-panel-name { font-size: 14px; font-weight: 700; }
.tool-panel-borrower { font-size: 12px; color: var(--text-sub); margin-top: 3px; }
.tool-panel-time  { font-size: 11px; color: var(--text-sub); margin-top: 2px; }

/* ── Analytics ───────────────────────────────────────────── */
.analytics-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 20px 16px;
}
.analytics-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
}
.analytics-card .stat-value { font-size: 24px; }
.analytics-card.alert-card  { border-color: var(--red); }
.analytics-card.alert-card .stat-value { color: var(--red); }

.analytics-section {
  padding: 0 20px;
  margin-bottom: 20px;
}
.analytics-section-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

/* ── Simple bar chart ────────────────────────────────────── */
.bar-chart-wrap { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.bar-label { width: 120px; color: var(--text-sub); text-align: right; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; background: var(--navy-mid); border-radius: 4px; height: 20px; overflow: hidden; }
.bar-fill  { height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s ease; display: flex; align-items: center; padding-left: 6px; }
.bar-fill.green { background: var(--green); }
.bar-count { font-size: 11px; color: var(--text-sub); flex-shrink: 0; width: 28px; }

/* ── AI Report button ────────────────────────────────────── */
.btn-ai {
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  border: none; border-radius: var(--radius-sm);
  color: #fff; font-size: 12px; font-weight: 700;
  padding: 6px 14px; cursor: pointer;
}

/* ── Penalty section ─────────────────────────────────────── */
.penalty-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.btn-penalty {
  background: rgba(239,68,68,.15);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  color: var(--red); font-size: 12px; font-weight: 700;
  padding: 6px 12px; cursor: pointer;
}

/* ── Analytics empty ─────────────────────────────────────── */
.analytics-empty { color: var(--text-sub); font-size: 13px; text-align: center; padding: 20px; grid-column: 1/-1; }
