/* Shift - Global Styles */
/* Fallback brand colors — tenant-theme.css overrides these at runtime */
:root {
  --primary-dark: #003462;
  --primary-light: #00B7A3;
  --primary-gradient: linear-gradient(135deg, #003462 0%, #00B7A3 100%);
  --accent-light-blue: #B5E3F0;
  --accent-yellow: #FFCF01;
  --accent-cream: #F2DFC3;
  --success: #10b981;
  --success-dark: #059669;
  --warning: #f59e0b;
  --warning-dark: #d97706;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --bg-page: #f5f7fa;
  --bg-card: #ffffff;
  --border-light: #e5e7eb;
  --border-medium: #d1d5db;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  /* Hover & interaction states */
  --primary-dark-hover: #004a8c;
  /* Extended text palette */
  --text-label: #374151;
  /* Extended background palette */
  --bg-hover: #f9fafb;
  --bg-neutral: #f3f4f6;
  --bg-selected: #f0f7ff;
  /* Status surface colors (backgrounds + text for badges/alerts) */
  --surface-success: #d1fae5;
  --surface-success-text: #065f46;
  --surface-warning: #fef3c7;
  --surface-warning-text: #92400e;
  --surface-danger: #fee2e2;
  --surface-danger-text: #991b1b;
  --surface-info: #dbeafe;
  --surface-info-text: #1e40af;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  color: var(--primary-dark);
}

h1 {
  text-align: center;
  margin-bottom: 24px;
  font-size: 28px;
  font-weight: 600;
}

/* Controls Section */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

input, select {
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(0, 183, 163, 0.15);
}

/* Buttons */
button {
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button.primary {
  background: var(--primary-dark);
  color: white;
  box-shadow: var(--shadow-sm);
}

button.primary:hover {
  background: #004a8c;
  box-shadow: var(--shadow-md);
}

button.secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

button.secondary:hover {
  background: #f9fafb;
  border-color: var(--border-light);
}

button.success {
  background: var(--success);
  color: white;
}

button.success:hover {
  background: var(--success-dark);
}

button.danger {
  background: var(--danger);
  color: white;
}

button.danger:hover {
  background: var(--danger-dark);
}

button.perfect {
  background: #f59e0b;
  color: #1f2937;
  font-weight: 600;
}

button.perfect:hover {
  background: #d97706;
}

button.toggled {
  outline: 2px solid var(--primary-dark);
  outline-offset: 2px;
}

button.small {
  font-size: 12px;
  padding: 4px 8px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Status Message */
#status {
  margin: 12px 0;
  padding: 12px 16px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary-light);
}

#status:empty {
  display: none;
}

/* Tables */
table.report-table {
  border-collapse: collapse;
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table.report-table thead {
  position: sticky;
  top: 0;
  background: var(--primary-dark);
  z-index: 2;
}

table.report-table th {
  color: white;
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  border: none;
}

table.report-table th:hover {
  background: rgba(255, 255, 255, 0.1);
}

table.report-table td {
  border: none;
  border-bottom: 1px solid var(--border-light);
  padding: 12px 16px;
  font-size: 14px;
}

table.report-table tbody tr:hover {
  background: #f9fafb;
}

table.report-table tbody tr:last-child td {
  border-bottom: none;
}

/* Clickable student links in report table (ID, names) */
.report-student-link {
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}
.report-student-link:hover {
  color: var(--primary-light);
  text-decoration: underline;
}

/* Detail Tables (used on student detail, compliance, etc.) */
table.detail-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table.detail-table th,
table.detail-table td {
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
}

table.detail-table th {
  background: var(--primary-dark);
  color: white;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

table.detail-table tbody tr:hover {
  background: #f8fafc;
}

table.detail-table tbody tr:last-child td {
  border-bottom: none;
}

tr.alert-row {
  background: #fef2f2 !important;
}

tr.alert-row:hover {
  background: #fee2e2 !important;
}

/* Perfect attendance (98%+) - golden star feel matching the button */
tr.perfect-row {
  background: #fde68a !important;
}

tr.perfect-row:hover {
  background: #fcd34d !important;
}

/* Good attendance (above threshold but not perfect) - positive green */
tr.good-row {
  background: #dcfce7 !important;
}

tr.good-row:hover {
  background: #bbf7d0 !important;
}

/* Links in highlighted rows - use dark blue for better contrast */
tr.perfect-row a,
tr.good-row a,
tr.alert-row a {
  color: var(--primary-dark);
  font-weight: 600;
}

tr.perfect-row a:hover,
tr.good-row a:hover,
tr.alert-row a:hover {
  color: #1e3a5f;
  text-decoration: underline;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-dark);
}

.card-body {
  padding: 24px;
}

/* Loading Overlay */
#loadingOverlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

#loadingOverlay.visible {
  display: flex;
}

.loading-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
}

.loading-box {
  position: relative;
  background: var(--bg-card);
  padding: 20px 28px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 1;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-light);
  border-top: 3px solid var(--primary-dark);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-weight: 600;
  color: var(--text-primary);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 9999px;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

.badge-neutral {
  background: #f3f4f6;
  color: #4b5563;
}

/* Links */
a {
  color: var(--primary-light);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: var(--text-muted, #9ca3af);
  margin-bottom: 16px;
  opacity: 0.7;
}

.empty-state p {
  margin: 0;
  font-size: 15px;
  color: var(--text-secondary, #6b7280);
}

/* === Ghost Date Inputs === */
input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  outline: none;
  position: relative;
}

input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-clear-button {
  display: none;
  -webkit-appearance: none;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  cursor: pointer;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: auto;
  height: auto;
}

input[type="date"]:hover,
input[type="date"]:focus {
  border-bottom: 1px solid var(--primary-dark);
  background: rgba(0, 183, 163, 0.05);
}

input[type="date"]:hover::-webkit-calendar-picker-indicator {
  opacity: 0.3;
}

/* Ensure parent containers allow absolute picker indicator */
td:has(input[type="date"]) {
  position: relative;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  .controls {
    padding: 12px;
    gap: 8px;
  }

  table.report-table th,
  table.report-table td {
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* Compliance page pill navigation */
.compliance-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #e0e0e0;
}
.compliance-pill {
  padding: 7px 16px;
  text-decoration: none;
  color: var(--primary-dark);
  font-weight: 500;
  font-size: 13px;
  border-radius: 20px;
  transition: all 0.15s;
  background: #f0f4f8;
}
.compliance-pill:hover {
  background: #e3eaf2;
  text-decoration: none;
  color: var(--primary-light);
}
.compliance-pill.active {
  background: var(--primary-dark);
  color: #fff;
}
