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

:root {
  --primary: #6c63ff;
  --primary-dark: #5a52d5;
  --secondary: #f50057;
  --success: #00c853;
  --warning: #ff6d00;
  --bg: #f0f2ff;
  --card: #ffffff;
  --text: #1a1a2e;
  --muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 10px 40px rgba(108, 99, 255, 0.15);
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 30px 16px;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(108,99,255,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(245,0,87,0.06) 0%, transparent 50%);
}

.container {
  width: 100%;
  max-width: 580px;
}

/* ── CARD ── */
.card {
  background: var(--card);
  border-radius: 24px;
  padding: 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(108,99,255,0.08);
  animation: slideUp 0.4s ease;
}

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

/* ── HEADER ── */
.app-header {
  text-align: center;
  margin-bottom: 28px;
}

.app-logo {
  font-size: 3rem;
  display: block;
  margin-bottom: 8px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.app-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-header p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 6px;
}

/* ── TYPOGRAPHY ── */
h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── INPUTS ── */
.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: 1rem;
  outline: none;
  transition: all 0.2s;
  background: #fafafa;
  color: var(--text);
}

input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(108,99,255,0.1);
}

/* ── BUTTONS ── */
.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.3px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 15px rgba(108,99,255,0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(108,99,255,0.5);
}

.btn-primary:active { transform: translateY(0); }

.btn-danger {
  background: linear-gradient(135deg, #ff4444, #cc0000);
  color: white;
  box-shadow: 0 4px 15px rgba(255,68,68,0.3);
  margin-top: 12px;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255,68,68,0.4);
}

.btn-secondary {
  background: #f3f4f6;
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-secondary:hover { background: #e5e7eb; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-sm {
  width: auto;
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: 10px;
}

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-open   { background: #d1fae5; color: #065f46; }
.badge-closed { background: #fee2e2; color: #991b1b; }
.badge-count  { background: #ede9fe; color: #4c1d95; }

/* ── TIMER ── */
.timer-box {
  background: linear-gradient(135deg, #fff5f5, #ffe4e4);
  border: 2px solid #fecaca;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  margin: 16px 0;
}

.timer-box .timer-text {
  font-size: 1.8rem;
  font-weight: 800;
  color: #dc2626;
  font-variant-numeric: tabular-nums;
}

.timer-box .timer-label {
  font-size: 0.8rem;
  color: #ef4444;
  margin-top: 2px;
}

/* ── LINK BOX ── */
.link-box {
  background: linear-gradient(135deg, #f0f4ff, #e8ecff);
  border: 2px dashed var(--primary);
  border-radius: 14px;
  padding: 16px;
  margin: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.link-text {
  font-size: 0.8rem;
  color: var(--primary-dark);
  word-break: break-all;
  flex: 1;
  font-weight: 500;
}

/* ── SESSION INFO ── */
.session-badge {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.info-chip {
  background: #f3f4f6;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── ATTENDANCE LIST ── */
.attendance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.count-badge {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.85rem;
  font-weight: 700;
}

.student-list {
  max-height: 320px;
  overflow-y: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.student-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.student-item:last-child { border-bottom: none; }
.student-item:hover { background: #f9fafb; }

.student-num {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 12px;
  flex-shrink: 0;
}

.student-name {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.student-time {
  font-size: 0.78rem;
  color: var(--muted);
  background: #f3f4f6;
  padding: 3px 8px;
  border-radius: 6px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 10px; }

/* ── ACTION BUTTONS ROW ── */
.action-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.action-row .btn { margin-top: 0; }

/* ── PAST SESSIONS ── */
.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  flex-wrap: wrap;
}

.session-item:last-child { border-bottom: none; }

.session-item-info strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text);
}

.session-item-info span {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── SUCCESS / ERROR CARDS ── */
.result-card {
  text-align: center;
  padding: 20px 0;
}

.result-icon {
  font-size: 5rem;
  margin-bottom: 16px;
  animation: pop 0.5s ease;
}

@keyframes pop {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.result-card h2 {
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.result-card p {
  color: var(--muted);
  font-size: 0.95rem;
}

.result-card .name-highlight {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 10px 0;
}

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ── ERROR TEXT ── */
.error-text {
  color: #dc2626;
  font-size: 0.88rem;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── LOGOUT BTN ── */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.top-bar h1 { margin-bottom: 0; }

/* ── SCROLLBAR ── */
.student-list::-webkit-scrollbar { width: 6px; }
.student-list::-webkit-scrollbar-track { background: #f1f1f1; }
.student-list::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

/* ── HIDDEN ── */
.hidden { display: none !important; }

/* ── PULSE ANIMATION ── */
.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(108,99,255,0.4); }
  70%  { box-shadow: 0 0 0 10px rgba(108,99,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(108,99,255,0); }
}

/* ── MOBILE ── */
@media (max-width: 480px) {
  .card { padding: 22px 18px; }
  .action-row { flex-direction: column; }
  .link-box { flex-direction: column; }
}