/* SAMS UI Components */

/* 1. Stat Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-wrap.blue {
  background: var(--primary-light);
  color: var(--primary);
}

.stat-icon-wrap.green {
  background: var(--color-present-bg);
  color: var(--color-present);
}

.stat-icon-wrap.red {
  background: var(--color-missed-bg);
  color: var(--color-missed);
  box-shadow: 0 0 12px var(--color-missed-glow);
}

.stat-icon-wrap.orange {
  background: var(--color-leave-bg);
  color: var(--color-leave);
  box-shadow: 0 0 12px var(--color-leave-glow);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin-top: 0.2rem;
}

.stat-value.red {
  color: var(--color-missed);
}

.stat-value.orange {
  color: var(--color-leave);
}

.stat-value.green {
  color: var(--color-present);
}

/* 2. Critical Alert Feeds (Red & Orange) */
.alerts-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.alert-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.alert-panel.red-alert {
  border-color: var(--color-missed-border);
  background: linear-gradient(to bottom, #fffafb, var(--bg-card));
}

.alert-panel.orange-alert {
  border-color: var(--color-leave-border);
  background: linear-gradient(to bottom, #fffbf6, var(--bg-card));
}

.alert-panel-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
}

.alert-panel.red-alert .alert-panel-header {
  border-bottom-color: var(--color-missed-border);
}

.alert-panel.orange-alert .alert-panel-header {
  border-bottom-color: var(--color-leave-border);
}

.alert-panel-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.alert-panel.red-alert .alert-panel-title {
  color: var(--color-missed);
}

.alert-panel.orange-alert .alert-panel-title {
  color: var(--color-leave);
}

.alert-pulsing-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  position: relative;
}

.alert-panel.red-alert .alert-pulsing-dot {
  background: var(--color-missed);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulse-red 2s infinite;
}

.alert-panel.orange-alert .alert-pulsing-dot {
  background: var(--color-leave);
  box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);
  animation: pulse-orange 2s infinite;
}

@keyframes pulse-red {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes pulse-orange {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(249, 115, 22, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}

.alert-count-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.alert-panel.red-alert .alert-count-pill {
  background: var(--color-missed);
  color: white;
}

.alert-panel.orange-alert .alert-count-pill {
  background: var(--color-leave);
  color: white;
}

.alert-list {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 280px;
  overflow-y: auto;
}

.alert-item {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: white;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  transition: transform var(--transition-fast);
}

.alert-item:hover {
  transform: translateX(4px);
}

.alert-item.missed-item {
  border-left: 4px solid var(--color-missed);
}

.alert-item.leave-item {
  border-left: 4px solid var(--color-leave);
}

.alert-student-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.alert-student-name.red {
  color: var(--color-missed);
}

.alert-student-name.orange {
  color: var(--color-leave);
}

.alert-student-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.alert-empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* 3. Cards & Content Sections */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body {
  padding: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}

.btn i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
  font-size: 1.05em;
  flex-shrink: 0;
}

.btn span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

.btn-success {
  background: var(--color-present);
  color: white;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--color-missed);
  color: white;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-orange {
  background: var(--color-leave);
  color: white;
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.3);
}

.btn-orange:hover {
  background: #ea580c;
}

.btn-outline {
  border: 1px solid var(--border-medium);
  background: white;
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: var(--text-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* 5. Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-present {
  background: var(--color-present-bg);
  color: var(--color-present);
  border: 1px solid var(--color-present-border);
}

.badge-absent, .badge-missed {
  background: var(--color-missed-bg);
  color: var(--color-missed);
  border: 1px solid var(--color-missed-border);
}

.badge-leave {
  background: var(--color-leave-bg);
  color: var(--color-leave);
  border: 1px solid var(--color-leave-border);
}

.badge-late {
  background: var(--color-late-bg);
  color: var(--color-late);
  border: 1px solid var(--color-late-border);
}

.badge-neutral {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

/* 6. 1-Click Attendance Toggle Pills (Teacher View) */
.att-pill-group {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-md);
  gap: 2px;
  border: 1px solid var(--border-light);
}

.att-pill {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.att-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.6);
}

.att-pill.active-present {
  background: var(--color-present);
  color: white;
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.4);
}

.att-pill.active-absent {
  background: var(--color-missed);
  color: white;
  box-shadow: 0 1px 4px rgba(239, 68, 68, 0.4);
}

.att-pill.active-late {
  background: var(--color-late);
  color: white;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.4);
}

/* 7. Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.15rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.95rem;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* 8. Progress Bars */
.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0.4rem 0;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-bar-fill.good {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.progress-bar-fill.warning {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.progress-bar-fill.danger {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

/* 9. Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  text-align: left;
  border-collapse: collapse;
}

.data-table th {
  padding: 0.85rem 1rem;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-light);
}

.data-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--bg-card-hover);
}

/* Actions Column & Action Button Alignment (Non-sticky) */
.data-table th.table-col-actions,
.data-table td.table-col-actions {
  white-space: nowrap;
  text-align: left;
}

.action-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.action-btn-group .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.38rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.action-btn-group .btn i {
  font-size: 0.95rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.action-btn-group .btn span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.btn-status-active:hover {
  border-color: #f59e0b;
  color: #d97706;
}

.btn-status-inactive {
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--color-present);
}

.btn-status-inactive:hover {
  background: rgba(16, 185, 129, 0.08);
  border-color: var(--color-present);
}

/* 10. Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: all var(--transition-normal);
}

.modal-backdrop.open .modal-container {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.modal-close-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* 11. Toast Notifications - Disabled */
.toast-container,
.toast {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Global Placeholder Text Suppression */
::placeholder,
::-webkit-input-placeholder,
::-moz-placeholder,
:-ms-input-placeholder {
  color: transparent !important;
  opacity: 0 !important;
}

/* 12. Report Card & Print Styling */
.report-view {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.report-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  background: var(--bg-subtle);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  margin-bottom: 1.25rem;
}

.report-calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 6px;
  margin: 1rem 0;
}

.report-calendar-day {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 6px 4px;
  text-align: center;
  font-size: 0.75rem;
  background: white;
  transition: transform var(--transition-fast);
}

.report-calendar-day.present {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.report-calendar-day.absent {
  background: #fff5f5;
  border-color: var(--color-missed-border);
  color: var(--color-missed);
  font-weight: 700;
}

.report-calendar-day.late {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.report-calendar-day.on_leave {
  background: #fffbf6;
  border-color: var(--color-leave-border);
  color: var(--color-leave);
}

.report-calendar-day.not_marked {
  background: #f8fafc;
  color: #94a3b8;
}

.student-report-modal .modal-container {
  max-width: 820px;
  width: 95%;
}

.printable-report-card {
  background: white;
  color: var(--text-main);
  padding: 0.5rem;
}

.printable-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.printable-report-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.printable-report-logo img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

@media print {
  body {
    background: white !important;
    color: #0f172a !important;
    font-size: 10.5pt !important;
  }
  .app-sidebar,
  .app-header,
  .mobile-backdrop,
  .mobile-bottom-nav,
  .subnav-tabs,
  .no-print,
  .report-filter-bar,
  .modal-close-btn,
  .modal-footer,
  .btn:not(.print-keep),
  .toast-container {
    display: none !important;
  }
  .app-main {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .app-content {
    padding: 0 !important;
    max-width: 100% !important;
  }
  .modal-backdrop {
    position: static !important;
    background: transparent !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
  .modal-container {
    max-width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    transform: none !important;
  }
  .modal-body {
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
  }
  .card {
    box-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
    page-break-inside: avoid;
  }
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

