:root {
  --primary-color: #0d6efd;
  --bg-color: #f8f9fa;
  --surface-color: #ffffff;
  --text-color: #212529;
  --text-muted: #6c757d;
  --border-color: #dee2e6;
  --bottom-nav-height: 60px;
  --top-bar-height: 56px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-color: #333333;
  }
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  padding-top: var(--top-bar-height);
  padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
  overscroll-behavior-y: none; /* helps with pull-to-refresh feel */
}

/* TOP BAR */
.m-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--top-bar-height);
  background-color: var(--surface-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  z-index: 1000;
}

.m-top-bar .title {
  font-weight: 600;
  font-size: 1.1rem;
}

/* =============================================
   MOBILE BOTTOM NAVIGATION & RESPONSIVE LAYOUT
   ============================================= */
@media (max-width: 768px) {
  /* Hide vertical sidebar on mobile phones/screens */
  #accordionSidebar,
  .sidebar {
    display: none !important;
  }
  
  #wrapper {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    overflow-x: hidden !important;
  }

  #content-wrapper {
    width: 100% !important;
    min-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #content {
    width: 100% !important;
  }

  #spa-content {
    width: 100% !important;
    padding: 12px 14px !important;
    padding-bottom: calc(75px + var(--safe-area-bottom)) !important;
  }

  .m-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(60px + var(--safe-area-bottom));
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.08);
    z-index: 1040;
    padding-bottom: var(--safe-area-bottom);
    justify-content: space-around;
    align-items: center;
  }

  .m-bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #64748b;
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 6px 0;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  .m-bottom-nav .nav-item i {
    font-size: 1.25rem;
    margin-bottom: 2px;
    transition: transform 0.15s ease, color 0.15s ease;
  }

  .m-bottom-nav .nav-item:active i {
    transform: scale(0.88);
  }

  .m-bottom-nav .nav-item.active,
  .m-bottom-nav .nav-item.active i {
    color: #8c1d18 !important;
    font-weight: 700;
  }

  .m-bottom-nav .nav-item.active i {
    transform: translateY(-2px);
  }
}

@media (min-width: 769px) {
  .m-bottom-nav {
    display: none !important;
  }
}

/* CONTENT AREA */
#spa-content {
  padding: 16px;
  min-height: calc(100vh - var(--top-bar-height) - var(--bottom-nav-height) - var(--safe-area-bottom));
  min-width: 0; /* Prevent flexbox blowout */
}

/* Fix flexbox blowout for wide tables */
#content-wrapper, #content {
  min-width: 0;
  overflow-x: hidden;
}

/* BOTTOM SHEET */
.m-bottom-sheet-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 2000;
}
.m-bottom-sheet-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.m-bottom-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface-color);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2001;
  padding: 24px 16px calc(24px + var(--safe-area-bottom));
  box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
}
.m-bottom-sheet.active {
  transform: translateY(0);
}
.m-bottom-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  margin: -12px auto 16px;
}

/* TOASTS */
.m-toast-container {
  position: fixed;
  top: calc(var(--top-bar-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 3000;
  pointer-events: none;
}
.m-toast {
  background-color: var(--surface-color);
  color: var(--text-color);
  padding: 12px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease;
}
.m-toast.show {
  opacity: 1;
  transform: translateY(0);
}
.m-toast.success { border-left: 4px solid #198754; }
.m-toast.error { border-left: 4px solid #dc3545; }

/* SKELETON LOADER */
.skeleton {
  background: linear-gradient(90deg, var(--border-color) 25%, var(--bg-color) 50%, var(--border-color) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 4px;
}
.skeleton-title { height: 24px; width: 60%; margin-bottom: 16px; }
.skeleton-text { height: 16px; width: 100%; margin-bottom: 8px; }
.skeleton-text.short { width: 80%; }
.skeleton-card { height: 100px; width: 100%; margin-bottom: 16px; border-radius: 8px; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Salary Tabs Row Colors from Finance v2 */
.row-base-salary { background-color: rgba(78, 115, 223, 0.24); }
.row-addition { background-color: rgba(28, 200, 138, 0.30); }
.row-deduction { background-color: rgba(231, 74, 59, 0.30); }
.row-ca { background-color: rgba(246, 194, 62, 0.36); }
.text-warning.text-darken { color: #c78d05 !important; }

/* SIDEBAR ACTIVE HIGHLIGHT */
.sidebar .nav-item .sidebar-link.active {
  background-color: rgba(255, 255, 255, 0.15) !important;
  border-radius: 8px;
  margin: 0 10px;
  padding-left: 10px; /* Offset the margin to keep icon aligned */
  font-weight: bold;
  color: #fff !important;
}
.sidebar .nav-item .sidebar-link.active i {
  color: #fff !important;
}

/* _GUI Protocol: Data-Dense Compression */
.modal-header {
  padding: 8px 16px !important;
}
.modal-body {
  padding: 12px 16px !important;
}
.modal-footer {
  padding: 8px 16px !important;
}
.form-control, .form-control-sm {
  padding: 4px 8px !important;
  font-size: 0.85rem !important;
}
.btn-sm {
  padding: 4px 12px !important;
  font-size: 0.8rem !important;
}
.btn {
  padding: 6px 16px !important;
  font-size: 0.875rem !important;
}
.card-header {
  padding: 8px 12px !important;
}
.card-body {
  padding: 12px !important;
}
table.dataTable thead th, table.dataTable thead td {
  padding: 6px 10px !important;
}
table.dataTable tbody td {
  padding: 6px 10px !important;
}
.custom-control-label {
  font-size: 0.875rem !important;
}
.nav-tabs .nav-link {
  padding: 8px 16px !important;
  font-size: 0.875rem !important;
}

/* =============================================
   SECTION ATTENDANCE — Responsive & Dynamic
   ============================================= */

/* --- Header --- */
.att-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-left: 4px solid #10b981;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-bottom: 16px;
}
.att-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.att-header-left h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 0;
  white-space: nowrap;
}
.att-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 20px;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  white-space: nowrap;
}
.att-date-btn {
  white-space: nowrap;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 6px 16px !important;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #3b82f6;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: all 0.2s ease;
}
.att-date-btn:hover, .att-date-btn:focus {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #2563eb;
  box-shadow: 0 2px 8px rgba(59,130,246,0.15);
}
.att-back-link {
  color: #6b7280;
  transition: transform 0.2s, color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}
.att-back-link:hover {
  color: #111827;
  background: rgba(0,0,0,0.05);
  transform: scale(1.1);
}

/* --- Card --- */
.att-card {
  border-radius: 16px;
  overflow: hidden;
  border: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.07);
  background: #fff;
  position: relative;
}
.att-card-header {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: none;
  position: relative;
  z-index: 1;
}
.att-card-header-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  color: #059669;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  flex-shrink: 0;
}
.att-card-title {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-left: 12px;
}
.att-count-pill {
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255,255,255,0.25);
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

/* --- Student Rows --- */
.att-student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  min-height: 48px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.2s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.att-student-row:last-child {
  border-bottom: none;
}
.att-student-row:nth-child(even) {
  background-color: #f8fafc;
}
.att-student-row:active {
  background-color: #e2e8f0 !important;
}
/* Touch ripple */
.att-student-row::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  background: rgba(16, 185, 129, 0.15);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
  opacity: 0;
  pointer-events: none;
}
.att-student-row:active::after {
  width: 300px; height: 300px;
  opacity: 1;
}
.att-num-circle {
  width: 26px;
  height: 26px;
  line-height: 26px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #6b7280;
  background: #e2e8f0;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 12px;
}
.att-student-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: #1e293b;
  letter-spacing: 0.15px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.att-ghost-circle {
  color: #cbd5e1;
  font-size: 1.1rem;
  opacity: 0.35;
  flex-shrink: 0;
  margin-left: 8px;
}

/* --- Floating Background Orbs --- */
.att-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
  z-index: 0;
}
.att-orb-green {
  width: 160px; height: 160px;
  top: -40px; right: -40px;
  background: radial-gradient(circle, rgba(16,185,129,0.12) 0%, transparent 70%);
  animation: attOrbFloat 12s ease-in-out infinite alternate;
}
.att-orb-blue {
  width: 200px; height: 200px;
  bottom: -60px; left: -50px;
  background: radial-gradient(circle, rgba(59,130,246,0.08) 0%, transparent 70%);
  animation: attOrbFloat 15s ease-in-out infinite alternate-reverse;
}
@keyframes attOrbFloat {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(15px, -10px) scale(1.08); }
  100% { transform: translate(-10px, 12px) scale(0.95); }
}

/* --- Staggered Fade-In --- */
.att-fade-in {
  opacity: 0;
  transform: translateY(12px);
  animation: attFadeUp 0.35s ease forwards;
}
@keyframes attFadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* --- Empty State --- */
.att-empty-icon-wrap {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: #f1f5f9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

/* =============================================
   ATTENDANCE — Mobile Breakpoints
   ============================================= */
@media (max-width: 576px) {
  .att-header {
    padding: 10px 12px;
    border-radius: 10px;
  }
  .att-header-left h2 {
    font-size: 1.05rem;
  }
  .att-date-btn {
    font-size: 0.78rem;
    padding: 5px 12px !important;
  }
  .att-card {
    border-radius: 12px;
  }
  .att-card-header {
    padding: 10px 12px;
  }
  .att-card-title {
    font-size: 0.78rem;
    letter-spacing: 0.5px;
  }
  .att-student-row {
    padding: 10px 12px;
    min-height: 44px;
  }
  .att-num-circle {
    width: 22px; height: 22px;
    line-height: 22px;
    font-size: 0.65rem;
    margin-right: 10px;
  }
  .att-student-name {
    font-size: 0.85rem;
  }
}

@media (max-width: 400px) {
  .att-header {
    flex-direction: column;
    align-items: stretch;
  }
  .att-date-btn {
    width: 100%;
    text-align: center;
  }
  .att-header-left h2 {
    font-size: 0.95rem;
  }
  .att-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
  }
  .att-student-name {
    font-size: 0.82rem;
    max-width: 200px;
  }
}

/* =============================================
   LIBRARY: Printing Request Component
   ============================================= */
:root {
  --lib-primary: #4e73df;
  --lib-accent:  #1cc88a;
  --lib-danger:  #e74a3b;
  --lib-warn:    #f6c23e;
  --lib-muted:   #858796;
  --lib-surface: rgba(255,255,255,0.97);
  --lib-radius:  14px;
  --lib-shadow:  0 4px 18px rgba(0,0,0,0.07);
}

.glass-card {
  background: var(--lib-surface);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(78,115,223,0.10);
  border-radius: var(--lib-radius);
  box-shadow: var(--lib-shadow);
}

/* =============================================
   MOBILE BODEGA CATALOG STICKY CONTROLS HEADER
   ============================================= */
#wrapper, #content-wrapper, #content {
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
}

.sticky-top {
  position: -webkit-sticky !important;
  position: sticky !important;
  top: 70px !important;
  z-index: 1020 !important;
}

@media (max-width: 768px) {
  .sticky-top {
    top: 56px !important;
  }
}

/* =============================================
   STAFF ATTENDANCE & DTR MOBILE UI STYLES
   ============================================= */
.att-hero-card {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(30, 60, 114, 0.18);
}
.att-kpi-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e3e6f0;
  padding: 10px 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
  text-align: center;
  flex: 1;
  min-width: 70px;
}
.att-kpi-num {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
}
.att-kpi-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6c757d;
  font-weight: 600;
}
.att-day-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e3e6f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  margin-bottom: 12px;
  overflow: hidden;
}
.att-day-card.is-today {
  border: 2px solid #4e73df !important;
  box-shadow: 0 4px 14px rgba(78, 115, 223, 0.22) !important;
}
.att-day-card-header {
  padding: 10px 14px;
  background: #f8f9fc;
  border-bottom: 1px solid #eaecf4;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.att-day-card-body {
  padding: 12px 14px;
}
.att-time-badge {
  display: inline-block;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.76rem;
  font-weight: 600;
}
.att-time-badge.in {
  background: #e6f4ea;
  color: #137333;
  border-color: #a8dab5;
}
.att-time-badge.out {
  background: #fef7e0;
  color: #b06000;
  border-color: #fde293;
}
/* =============================================
   CLASSROOM PROGRAM TIME CONFLICT PULSING ANIMATION
   ============================================= */
@keyframes csConflictPulse {
  0% { background-color: rgba(220, 53, 69, 0.12); }
  50% { background-color: rgba(220, 53, 69, 0.32); }
  100% { background-color: rgba(220, 53, 69, 0.12); }
}

.cs-row-conflict {
  animation: csConflictPulse 1.4s ease-in-out infinite !important;
  border-left: 3.5px solid #dc3545 !important;
}

.cs-conflict-badge {
  background-color: #dc3545;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(220, 53, 69, 0.3);
}



