:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --secondary: #0f172a;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text: #475569;
  --text-h: #0f172a;
  --text-muted: #94a3b8;
  --bg: #ffffff;
  --bg-muted: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, Consolas, monospace;

  font: 16px/1.6 var(--sans);
  color-scheme: light;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

html, body, #root {
  width: 100%;
  min-height: 100vh;
}

body {
  overflow-x: hidden;
  background: var(--bg-muted);
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button {
  font-family: var(--sans);
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
button:active {
  transform: translateY(0);
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 10px 20px;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #fff;
  color: var(--text-h);
  border: 1px solid var(--border);
  padding: 10px 20px;
}
.btn-secondary:hover {
  background: var(--bg-muted);
  border-color: #cbd5e1;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  padding: 6px 14px;
  font-size: 13px;
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-success {
  background: var(--success);
  color: #fff;
  padding: 10px 20px;
}
.btn-success:hover {
  background: #059669;
}

input, select, textarea {
  font-family: var(--sans);
  font-size: 14px;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #f8fafc;
  color: var(--text-h);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
  background: #fff;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

/* ─── Responsive Table Wrapper ─── */
.responsive-table {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.responsive-table table {
  width: 100%;
  min-width: 500px;
  border-collapse: collapse;
  font-size: 14px;
}
.responsive-table th {
  background: var(--bg-muted);
  color: var(--text-h);
  font-weight: 600;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.responsive-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}
.responsive-table tr:last-child td {
  border-bottom: none;
}
.responsive-table tr:hover td {
  background: var(--bg-muted);
}

/* ─── Badge / Tag ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success {
  background: #d1fae5;
  color: #065f46;
}
.badge-danger {
  background: #fef2f2;
  color: #991b1b;
}
.badge-warning {
  background: #fffbeb;
  color: #92400e;
}

/* ─── Modal Backdrop ─── */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15,23,42,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}

.modal-content {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}

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

/* ─── Responsive ─── */
@media (max-width: 768px) {
  :root {
    font-size: 15px;
  }
  .card {
    padding: 16px;
  }
  .responsive-table table {
    min-width: 0;
    font-size: 13px;
  }
  .responsive-table th,
  .responsive-table td {
    padding: 6px 8px;
  }
  .responsive-table td label,
  .responsive-table td input[type="radio"] {
    min-height: 36px;
    min-width: 36px;
  }
  .responsive-table input[type="radio"] {
    transform: scale(1.3);
  }
}
@media (max-width: 600px) {
  :root {
    font-size: 14px;
  }
  .responsive-table table {
    font-size: 12px;
  }
  .responsive-table th,
  .responsive-table td {
    padding: 4px 6px;
    white-space: normal;
    word-break: break-word;
  }
  .responsive-table th {
    white-space: nowrap;
    font-size: 11px;
  }
}

/* ─── Attendance Status Badge Animations ─── */
@keyframes pulse-attention {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}
@keyframes pop-in {
  0% { transform: scale(0.8); opacity: 0; }
  80% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

.attendance-badge-not-taken {
  animation: pulse-attention 1.5s ease 3;
}
.attendance-badge-taken {
  animation: pop-in 0.35s ease;
}

body {
  margin: 0;
}

#root {
  width: 100%;
  max-width: 1126px;
  margin: 0 auto;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.responsive-table td,
.responsive-table th {
  text-align: left;
}
.responsive-table td:nth-child(3),
.responsive-table td:nth-child(4),
.responsive-table th:nth-child(3),
.responsive-table th:nth-child(4) {
  text-align: center;
}

h1,
h2 {
  font-family: var(--heading);
  font-weight: 500;
  color: var(--text-h);
}

h1 {
  font-size: 56px;
  letter-spacing: -1.68px;
  margin: 32px 0;
  @media (max-width: 1024px) {
    font-size: 36px;
    margin: 20px 0;
  }
}
h2 {
  font-size: 24px;
  line-height: 118%;
  letter-spacing: -0.24px;
  margin: 0 0 8px;
  @media (max-width: 1024px) {
    font-size: 20px;
  }
}
p {
  margin: 0;
}

code,
.counter {
  font-family: var(--mono);
  display: inline-flex;
  border-radius: 4px;
  color: var(--text-h);
}

code {
  font-size: 15px;
  line-height: 135%;
  padding: 4px 8px;
  background: var(--code-bg);
}
