:root {
  --primary: #0d6efd;
  --primary-dark: #0b5ed7;
  --page: #f6f7fb;          /* Solid page background fixes the "column" */
  --card-bg: #ffffff;
  --radius: 16px;
  --transition: 0.25s ease;
}

/* Reset & base */
* { box-sizing: border-box; }
html { height: 100%; }
body {
  min-height: 100svh;
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--page);
  display: grid;
  place-items: center;       /* centers the card */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Card ---------- */
.card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px 36px;
  background: var(--card-bg);       /* solid white, no frosted blur */
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
  text-align: center;
  animation: fade-in 0.45s ease both;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.logo {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--primary);
}

.subtitle {
  font-size: 0.95rem;
  color: #6b7280;
  margin-bottom: 24px;
}

/* ---------- Form ---------- */
.field { position: relative; margin-bottom: 14px; }

.field input {
  width: 100%;
  padding: 14px 44px 14px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.field input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: #9ca3af;
  padding: 2px 6px;
  border-radius: 8px;
}

.toggle-password:hover { color: var(--primary); }

/* ---------- Button ---------- */
.btn {
  width: 100%;
  padding: 14px;
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition), transform 0.05s ease;
}

.btn:hover,
.btn:focus-visible { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }

/* ---------- Messages ---------- */
#message {
  margin-top: 14px;
  font-size: 0.93rem;
  font-weight: 500;
  min-height: 1.2em;
}

.error { color: #d52731; }
.success { color: #269f53; }

/* ---------- Logout button ---------- */
/* Tiny logout icon (top-left of the page) */
.logout-icon {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(16, 24, 40, 0.12);
  transition: background var(--transition), transform 0.05s ease;
  z-index: 1000;
}
.logout-icon i {
  font-size: 14px;   /* slightly larger than before */
  line-height: 1;
}

.logout-icon:hover { background: var(--primary-dark); }
.logout-icon:active { transform: translateY(1px); }



/* ... existing css ... */

/* ---------- Floating Bottom-Left Button ---------- */
.fab-left {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--primary);
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.2s, color 0.2s;
  z-index: 100;
}

.fab-left:hover {
  color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

/* ---------- Modal Overlay & Card ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: grid; /* Toggled via JS */
  place-items: center;
  padding: 20px;
  animation: fade-in 0.2s ease-out;
}

.modal-card {
  max-width: 380px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

/* Modal specific buttons */
.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
}
.btn-secondary:hover {
  background: #e5e7eb;
}


/* ---------- Key List Items ---------- */
.key-item {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  padding: 12px;
  border-radius: 8px;
  text-align: left;
}

.key-value {
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  word-break: break-all;
}

.key-meta {
  font-size: 0.85rem;
  color: #6b7280;
}


/* ========== ADMIN PANEL REDESIGN ========== */

.admin-panel {
  width: 100%;
  max-width: 600px;
  animation: fade-in 0.5s ease both;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: var(--radius);
  color: white;
  box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

.panel-icon {
  width: 56px;
  height: 56px;
  background: rgba(255,255,255,0.2);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
}

.panel-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.panel-subtitle {
  margin: 4px 0 0 0;
  opacity: 0.85;
  font-size: 0.9rem;
}

.keys-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: #6b7280;
  font-size: 0.95rem;
}

/* ========== KEY CARD ========== */

.key-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid #e5e7eb;
  transition: transform 0.2s, box-shadow 0.2s;
}

.key-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.key-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 500px) {
  .key-row {
    grid-template-columns: 1fr;
  }
}

.key-box {
  position: relative;
  padding: 16px;
  border-radius: 12px;
  border: 2px solid;
}

.admin-box {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #f59e0b;
}

.teacher-box {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border-color: #10b981;
}

.key-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.admin-box .key-label {
  color: #b45309;
}

.teacher-box .key-label {
  color: #047857;
}

.key-code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 2px;
}

.admin-box .key-code {
  color: #92400e;
}

.teacher-box .key-code {
  color: #065f46;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: rgba(255,255,255,0.7);
  color: #6b7280;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: white;
  color: var(--primary);
  transform: scale(1.1);
}

.key-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  font-size: 0.85rem;
  color: #6b7280;
}

.creator-info,
.date-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.creator-info i,
.date-info i {
  color: #9ca3af;
}

/* ========== TOAST NOTIFICATION ========== */

.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  animation: toast-in 0.3s ease, toast-out 0.3s ease 1.7s forwards;
  z-index: 9999;
}

.toast-notification i {
  color: #10b981;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
}

/* ========== EMPTY STATE ========== */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}

.empty-state i {
  font-size: 3rem;
  color: #d1d5db;
  margin-bottom: 12px;
}

.empty-state p {
  margin: 0;
  font-size: 0.95rem;
}
