/* ============================================================
   CRCC · CCECC Attendance System — Production Style System
   ============================================================ */

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

:root {
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  --bg-app: #f0f4f8;
  --bg-sidebar: #0d1117;
  --bg-card: #ffffff;
  --border-subtle: #e2e8f0;
  --border-card: #e8edf2;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --color-primary: #1e40af;
  --color-primary-hover: #1d4ed8;
  --color-accent: #3b82f6;
  
  --color-success: #15803d;
  --color-success-bg: #dcfce7;
  --color-danger: #b91c1c;
  --color-danger-bg: #fee2e2;
  --color-warning: #b45309;
  --color-warning-bg: #fef3c7;
  --color-purple: #6d28d9;
  --color-purple-bg: #ede9fe;
  --color-teal: #0f766e;
  --color-teal-bg: #f0fdfa;
  --color-cyan: #0e7490;
  --color-cyan-bg: #cffafe;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

html, body, #root {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input, select, button, textarea {
  font-family: inherit;
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Date / Time Picker Polish */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* Loading Splash Screen */
#loading-screen {
  position: fixed;
  inset: 0;
  background: #0d1117;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 16px;
  transition: opacity 0.35s ease-out, visibility 0.35s;
}
#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.load-logo {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: white;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}
.load-title {
  font-size: 19px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.01em;
}
.load-sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
}
.load-bar {
  width: 220px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}
.load-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 2px;
  animation: loadpulse 1.3s ease-in-out infinite;
}
@keyframes loadpulse {
  0%   { width: 0%; transform: translateX(0); }
  50%  { width: 75%; }
  100% { width: 100%; transform: translateX(100%); }
}

/* Error Splash Screen */
#error-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: #0d1117;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  flex-direction: column;
  padding: 20px;
}
#error-screen.show {
  display: flex;
}
.err-box {
  background: #161b22;
  border: 1px solid #f85149;
  border-radius: 16px;
  padding: 32px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.err-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.err-title {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 8px;
}
.err-msg {
  font-size: 12px;
  color: #ff7b72;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  background: #0d1117;
  padding: 12px;
  border-radius: 8px;
  text-align: left;
  word-break: break-all;
  border: 1px solid #30363d;
}
.err-help {
  font-size: 13px;
  color: #8b949e;
  line-height: 1.6;
  margin-bottom: 18px;
}
.err-btn-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.err-btn {
  background: #238636;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.err-btn-sec {
  background: #30363d;
  color: #c9d1d9;
}

/* Pulse animation for sync indicator */
@keyframes syncPulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}
.sync-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3b82f6;
  margin-left: 6px;
  animation: syncPulse 1s infinite ease-in-out;
}

/* Table Enhancements */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-card);
  background: #f8fafc;
  white-space: nowrap;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f8fafc;
  color: var(--text-main);
  vertical-align: middle;
}
.data-table tr:hover td {
  background: #fcfdfe;
}

/* Sticky First Column for Wide Grids */
.sticky-col {
  position: sticky;
  left: 0;
  background: white;
  z-index: 2;
  box-shadow: 2px 0 6px rgba(0,0,0,0.03);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #1e293b;
  color: white;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideInUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.success { background: #065f46; color: #a7f3d0; border-left: 4px solid #34d399; }
.toast.error   { background: #881337; color: #fecdd3; border-left: 4px solid #fb7185; }

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