/* ==========================================================================
   High School Equipment Management System - Premium Design System (index.css)
   ========================================================================== */

/* Variables */
:root {
  --font-main: 'Inter', 'Noto Sans JP', sans-serif;
  
  /* Color Palette - Indigo & Slate */
  --bg-app: #0b0f19;
  --bg-card: #151e2e;
  --bg-card-hover: #1e293b;
  --border-color: #243049;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  
  /* Accents */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  
  --emerald: #10b981;
  --emerald-hover: #059669;
  --emerald-glow: rgba(16, 185, 129, 0.35);
  
  --danger: #f43f5e;
  --danger-hover: #e11d48;
  --orange: #f97316;
  --teal: #14b8a6;
  
  /* Shadows & Radius */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow-loan: 0 0 35px rgba(99, 102, 241, 0.25);
  --shadow-glow-return: 0 0 35px rgba(16, 185, 129, 0.25);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* Config Warning Banner */
.config-warning {
  background-color: #7f1d1d;
  border-bottom: 1px solid #b91c1c;
  color: #fca5a5;
  padding: 10px 20px;
  font-size: 0.9rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: transform var(--transition-normal);
}
.config-warning.hidden {
  display: none;
}
.warning-content {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1200px;
  width: 100%;
}
.warning-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Layout Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 20px 30px 20px;
}

/* Header & Terminal Switcher */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 25px;
}

.header-logo {
  display: flex;
  flex-direction: column;
}
.logo-accent {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--primary);
  text-transform: uppercase;
}
.header-logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 40%, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.terminal-selector {
  display: flex;
  background-color: rgba(21, 30, 46, 0.6);
  padding: 5px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
.toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px 20px;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}
.toggle-btn:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.05);
}
.toggle-btn.active {
  color: var(--text-main);
  background-color: var(--primary);
  box-shadow: 0 4px 12px var(--primary-glow);
}
.icon {
  width: 18px;
  height: 18px;
}

/* Main Content Views */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.terminal-view {
  display: none;
  flex-direction: column;
  flex: 1;
  animation: fadeIn 0.4s ease forwards;
}
.terminal-view.active {
  display: flex;
}

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

/* ==========================================================================
   SUBSECTION: STUDENT COUNCIL TERMINAL (DASHBOARD)
   ========================================================================== */

/* Dashboard Stats Cards */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}
.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}
.stat-card:hover {
  transform: translateY(-2px);
}
.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg {
  width: 26px;
  height: 26px;
  color: #fff;
}
.bg-indigo { background-color: var(--primary); }
.bg-orange { background-color: var(--orange); }
.bg-emerald { background-color: var(--emerald); }
.bg-teal { background-color: var(--teal); }

.stat-info {
  display: flex;
  flex-direction: column;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}
.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

/* Council Layout Grid */
.council-grid {
  display: flex;
  gap: 25px;
  align-items: flex-start;
}
.flex-2 { flex: 2; }
.flex-1 { flex: 1.1; }

.panel-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 24px;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.panel-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

/* Add Item Form */
.add-form {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 20px;
  transition: all var(--transition-normal);
  overflow: hidden;
  max-height: 500px;
}
.add-form.collapsed {
  max-height: 0;
  padding: 0;
  margin: 0;
  border: none;
  opacity: 0;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.form-group input,
.form-group select {
  background-color: rgba(11, 15, 25, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 10px 14px;
  font-family: var(--font-main);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast);
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* General Button Styles */
.btn {
  border: none;
  font-family: var(--font-main);
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
}
.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}
.btn-lg {
  padding: 14px 28px;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
}
.btn-primary {
  background-color: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-indigo {
  background-color: var(--primary);
  color: #fff;
}
.btn-indigo:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-secondary {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}
.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.12);
}
.btn-danger {
  background-color: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background-color: var(--danger-hover);
}
.btn-icon-only {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}
.btn-icon-only:hover {
  background-color: rgba(255, 255, 255, 0.15);
}
.btn-icon-only svg {
  width: 22px;
  height: 22px;
}

/* Toolbar and Search */
.table-toolbar {
  margin-bottom: 15px;
}
.table-toolbar input {
  width: 100%;
  background-color: rgba(11, 15, 25, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 12px 16px;
  font-family: var(--font-main);
  font-size: 0.9rem;
}
.table-toolbar input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Inventory Table */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}
th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}
th {
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background-color: rgba(255, 255, 255, 0.01);
}

.actions-col {
  text-align: right;
  width: 150px;
}

.loading-cell {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-style: italic;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}
.badge-available {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.badge-loaned {
  background-color: rgba(249, 115, 22, 0.15);
  color: var(--orange);
  border: 1px solid rgba(249, 115, 22, 0.2);
}
.badge-category {
  background-color: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
}

.code-font {
  font-family: monospace;
  font-size: 0.85rem;
  background-color: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  color: #e2e8f0;
}

/* Operations Buttons in Table */
.btn-table-action {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-muted);
  border-radius: 4px;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-table-action:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.08);
}
.btn-delete:hover {
  color: var(--danger);
  background-color: rgba(244, 63, 94, 0.1);
}
.btn-table-action svg {
  width: 16px;
  height: 16px;
}

/* Timeline/Log View */
.log-timeline-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 5px;
}
.log-card {
  background-color: rgba(11, 15, 25, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all var(--transition-fast);
}
.log-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}
.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.log-type {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}
.log-type.loan {
  background-color: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}
.log-type.return {
  background-color: rgba(16, 185, 129, 0.2);
  color: #a7f3d0;
}
.log-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.log-body {
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.log-title {
  font-weight: 600;
  color: var(--text-main);
}
.log-borrower {
  color: var(--text-muted);
}
.log-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  padding-top: 8px;
}
.btn-signature-view {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
}
.btn-signature-view:hover {
  background-color: rgba(99, 102, 241, 0.1);
  color: #818cf8;
}

/* Custom Scrollbar for panels */
.log-timeline-container::-webkit-scrollbar,
.table-container::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.log-timeline-container::-webkit-scrollbar-track,
.table-container::-webkit-scrollbar-track {
  background: transparent;
}
.log-timeline-container::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
.log-timeline-container::-webkit-scrollbar-thumb:hover,
.table-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}


/* ==========================================================================
   SUBSECTION: LOAN / RETURN TERMINAL (MAIN UI)
   ========================================================================== */

.subview {
  display: none;
  flex-direction: column;
  flex: 1;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 0;
  animation: slideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.subview.active {
  display: flex;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.terminal-welcome {
  text-align: center;
  margin-bottom: 40px;
}
.school-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.terminal-welcome h2 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.terminal-instruction {
  font-size: 1.1rem;
  color: var(--text-muted);
}

/* Big Action Buttons */
.big-buttons-container {
  display: flex;
  gap: 30px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.big-btn {
  flex: 1;
  min-width: 280px;
  max-width: 380px;
  height: 280px;
  background-color: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

/* Button Themes */
.big-btn.loan-theme::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at center, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-normal);
}
.big-btn.loan-theme:hover {
  border-color: var(--primary);
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-glow-loan);
}
.big-btn.loan-theme:hover::before {
  opacity: 1;
}
.big-btn.loan-theme .btn-icon-wrapper {
  color: var(--primary);
}

.big-btn.return-theme::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at center, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-normal);
}
.big-btn.return-theme:hover {
  border-color: var(--emerald);
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-glow-return);
}
.big-btn.return-theme:hover::before {
  opacity: 1;
}
.big-btn.return-theme .btn-icon-wrapper {
  color: var(--emerald);
}

/* Icons on buttons */
.btn-icon-wrapper {
  width: 80px;
  height: 80px;
  background-color: rgba(255, 255, 255, 0.02);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
  transition: all var(--transition-normal);
}
.big-btn:hover .btn-icon-wrapper {
  transform: scale(1.1);
  background-color: rgba(255, 255, 255, 0.05);
  border-color: transparent;
}
.btn-icon-wrapper svg {
  width: 38px;
  height: 38px;
}

.btn-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}
.btn-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Flow Headers (Subviews) */
.flow-header {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 20px;
  margin-bottom: 25px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
}
.flow-header h3 {
  font-size: 1.4rem;
  font-weight: 700;
}

/* QR Scanner Card */
.scanner-card {
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow-lg);
}
.scanner-instruction {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 25px;
  text-align: center;
}

.scanner-container-outer {
  position: relative;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 1;
  background-color: #050811;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
  margin-bottom: 25px;
}

/* Scanner Frame and Laser */
.qr-reader {
  width: 100%;
  height: 100%;
}
#qr-reader {
  width: 100%;
  height: 100%;
  border: none !important;
}
#qr-reader video {
  object-fit: cover !important;
  width: 100% !important;
  height: 100% !important;
}

.scan-laser-line {
  position: absolute;
  top: 0;
  left: 5%;
  width: 90%;
  height: 3px;
  background: linear-gradient(to right, transparent, var(--primary), transparent);
  box-shadow: 0 0 10px var(--primary);
  animation: laserScan 2s linear infinite;
  z-index: 10;
  pointer-events: none;
}
@keyframes laserScan {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}

.scanner-frame-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 5;
}
.corner {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 4px solid var(--primary);
}
.top-left { top: 20px; left: 20px; border-right: none; border-bottom: none; }
.top-right { top: 20px; right: 20px; border-left: none; border-bottom: none; }
.bottom-left { bottom: 20px; left: 20px; border-right: none; border-top: none; }
.bottom-right { bottom: 20px; right: 20px; border-left: none; border-top: none; }

.scanner-controls {
  width: 100%;
  max-width: 380px;
}
.scanner-fallback-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 15px;
}

/* Borrower Info Card */
.info-card {
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-lg);
}
.scanned-item-badge {
  background-color: rgba(99, 102, 241, 0.08);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 25px;
  display: flex;
  flex-direction: column;
}
.badge-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.badge-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
}
.badge-sub-value {
  font-size: 0.85rem;
  font-family: monospace;
  color: var(--text-muted);
}

.borrower-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.form-group-row {
  display: flex;
  gap: 15px;
}
.form-group-row .form-group {
  flex: 1;
}

.form-control-lg {
  background-color: rgba(11, 15, 25, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 14px 18px;
  font-family: var(--font-main);
  font-size: 1.05rem;
  width: 100%;
}
.form-control-lg:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.info-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  margin-top: 10px;
}

/* Signature Card & Drawing Canvas */
.signature-card {
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.context-card {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  width: 100%;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 600;
  font-size: 1.05rem;
}

.signature-notice {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 15px;
  text-align: center;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
  background-color: #f8fafc; /* White canvas background for signatures */
  border: 3px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 30px;
}
#signature-canvas {
  width: 100%;
  height: 250px;
  display: block;
  cursor: crosshair;
}
.canvas-clear-btn-container {
  position: absolute;
  bottom: 12px;
  right: 12px;
}
.icon-sm {
  width: 14px;
  height: 14px;
}

/* Long Press Confirmation Button styling */
.longpress-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}
.longpress-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.long-press-btn {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: none;
  background-color: var(--bg-app);
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md), inset 0 0 10px rgba(0,0,0,0.5);
  transition: transform 0.1s ease, box-shadow var(--transition-fast);
  user-select: none;
  -webkit-user-select: none;
}
.long-press-btn:hover {
  box-shadow: var(--shadow-glow-loan), inset 0 0 10px rgba(0,0,0,0.5);
}
.long-press-btn:active {
  transform: scale(0.96);
}

.progress-circle {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* Start progress from the top */
  pointer-events: none;
}

.circle-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 5px;
}
.circle-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 5px;
  stroke-linecap: round;
  /* Circumference for r=46 is 2 * PI * 46 = 289.02 */
  stroke-dasharray: 289;
  stroke-dashoffset: 289;
  transition: stroke-dashoffset 0.1s linear; /* Smooth progress updates */
}

.btn-text-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
}
.main-txt {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.sub-txt {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
}


/* ==========================================================================
   SECTION: MODALS & OVERLAYS
   ========================================================================= */

/* Modal Base */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(5, 8, 17, 0.85);
  backdrop-filter: blur(8px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.active {
  display: flex;
}
.modal-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}
.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}
.btn-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
}
.text-center {
  text-align: center;
}
.modal-instructions {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 15px;
}

.modal-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: rgba(0, 0, 0, 0.1);
}

/* QR Code Printable Area */
.qr-print-card {
  background-color: #ffffff;
  color: #0b0f19;
  border-radius: var(--radius-md);
  padding: 25px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
  margin: 0 auto;
}
.school-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 15px;
}
.qr-canvas-holder {
  padding: 10px;
  background: white;
  border-radius: var(--radius-sm);
  margin-bottom: 15px;
}
.qr-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}
.qr-info strong {
  font-size: 1.15rem;
  font-weight: 700;
}
.qr-info span {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
}

/* Print Specific styling */
@media print {
  body * {
    visibility: hidden;
  }
  #printable-qr-area, #printable-qr-area * {
    visibility: visible;
  }
  #printable-qr-area {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(1.5);
    border: none;
    box-shadow: none;
  }
}

/* Signature Details Modal View */
.sig-detail-badge {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 15px;
  font-weight: 600;
  font-size: 0.95rem;
}
.sig-view-box {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.sig-box-label {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
}
.sig-img {
  max-width: 100%;
  height: auto;
  max-height: 180px;
  display: block;
  margin: 0 auto;
}
.sig-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 15px;
  text-align: left;
  line-height: 1.5;
}

/* Global Loading Spinner Overlay */
.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(5, 8, 17, 0.85);
  backdrop-filter: blur(5px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-overlay.hidden {
  display: none;
}
.spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
#loading-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #1e293b;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: 50px;
  padding: 12px 28px;
  z-index: 4000;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  animation: toastFadeIn 0.3s ease forwards;
}
.toast.hidden {
  display: none;
}
@keyframes toastFadeIn {
  from { opacity: 0; bottom: 15px; }
  to { opacity: 1; bottom: 25px; }
}

/* Responsive Overrides */
@media (max-width: 900px) {
  .council-grid {
    flex-direction: column;
  }
  .flex-2, .flex-1 {
    width: 100%;
    flex: none;
  }
  .main-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
  .terminal-selector {
    width: 100%;
  }
  .toggle-btn {
    flex: 1;
    justify-content: center;
  }
}

/* Equipment Photo Thumbnails */
.item-thumbnail {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: #0b0f19;
  display: block;
}

.item-thumbnail-placeholder {
  width: 44px;
  height: 44px;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.item-thumbnail-placeholder svg {
  width: 20px;
  height: 20px;
}

