@import url('https://fonts.googleapis.com/css2?family=Red+Hat+Display:wght@400;500;600;700&family=Red+Hat+Mono&display=swap');

:root {
  --rh-red:        #EE0000;
  --rh-red-dark:   #BE0000;
  --rh-dark:       #151515;
  --rh-gray-dark:  #3C3F42;
  --rh-gray-mid:   #6A6E73;
  --rh-gray-light: #D2D2D2;
  --rh-gray-bg:    #F5F5F5;
  --rh-white:      #FFFFFF;
  --rh-font:       'Red Hat Display', 'Liberation Sans', Arial, sans-serif;
  --rh-mono:       'Red Hat Mono', 'Liberation Mono', monospace;
  --timer-size:    10rem;
  --radius:        4px;
  --base-font:     20px;
}

/* ── LIGHT THEME ─────────────────────────────────────────────── */
body.theme-light {
  --rh-dark:       #F5F5F5;
  --rh-gray-dark:  #E0E0E0;
  --rh-gray-mid:   #6A6E73;
  --rh-gray-light: #3C3F42;
  --rh-white:      #151515;
}

body.theme-light .timer-card       { background: #FFFFFF; }
body.theme-light .info-panel       { background: #FFFFFF; }
body.theme-light .schedule-row.active { background: var(--rh-red); color: #FFFFFF; }
body.theme-light .schedule-row.active .break-name,
body.theme-light .schedule-row.active .break-time { color: #FFFFFF; }
body.theme-light .cred-field       { border-bottom-color: #CCCCCC; }
body.theme-light .cred-icon-btn    { border-color: #AAAAAA; color: #3C3F42; }
body.theme-light .cred-icon-btn:hover { border-color: var(--rh-red); color: var(--rh-red); }

/* ── VISUALLY IMPAIRED THEME ─────────────────────────────────── */
body.theme-vi {
  --rh-dark:       #000000;
  --rh-gray-dark:  #1a1a1a;
  --rh-gray-mid:   #ffffff;
  --rh-gray-light: #ffffff;
  --rh-white:      #ffffff;
  --timer-size:    14rem;
  --base-font:     26px;
  --rh-red:        #ff3333;
}

body.theme-vi .header { border-bottom-width: 5px; }
body.theme-vi .info-panel h3 { font-size: 1rem; }
body.theme-vi .schedule-row { font-size: 1.3rem; padding: 0.5rem 0.6rem; }
body.theme-vi .lab-field { font-size: 1.2rem; }
body.theme-vi .timer-card { border-width: 4px; }
body.theme-vi .cert-badge { font-size: 1rem; padding: 0.2rem 0.7rem; }

/* ── HIGH CONTRAST + LIGHT (white surfaces + black text) ─────── */
body.theme-light.theme-vi {
  --rh-dark:       #FFFFFF;
  --rh-gray-dark:  #E0E0E0;
  --rh-gray-mid:   #000000;
  --rh-gray-light: #000000;
  --rh-white:      #000000;
  --rh-red:        #B30000;
}
body.theme-light.theme-vi .timer-card,
body.theme-light.theme-vi .info-panel { background: #FFFFFF; border-color: #000000; }
body.theme-light.theme-vi .schedule-row.active,
body.theme-light.theme-vi .schedule-row.active .break-name,
body.theme-light.theme-vi .schedule-row.active .break-time { background: var(--rh-red); color: #FFFFFF; }

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

body {
  font-family: var(--rh-font);
  font-size: var(--base-font);
  background: var(--rh-dark);
  color: var(--rh-white);
  min-height: 100vh;
}

/* ── HEADER ─────────────────────────────────────────────────── */
.header {
  background: var(--rh-dark);
  border-bottom: 3px solid var(--rh-red);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-logo svg { display: block; }

.header-info { flex: 1; }

.header-course {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--rh-white);
  line-height: 1.2;
}

.header-instructor {
  font-size: 0.85rem;
  color: var(--rh-gray-light);
  margin-top: 0.15rem;
}

.header-certs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.cert-badge {
  background: var(--rh-red);
  color: var(--rh-white);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 2px;
  letter-spacing: 0.03em;
}

.header-clock {
  text-align: right;
  font-size: 0.85rem;
  color: var(--rh-gray-light);
  white-space: nowrap;
}

.header-clock .clock-time {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--rh-white);
  font-family: var(--rh-mono);
}

/* ── TIMER BLOCK ─────────────────────────────────────────────── */
.timer-section {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem 1.5rem;
  background: var(--rh-dark);
}

.timer-card {
  background: var(--rh-gray-dark);
  border: 2px solid var(--rh-red);
  border-radius: var(--radius);
  padding: 2rem 4rem;
  text-align: center;
  min-width: 400px;
}

.timer-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--rh-gray-light);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  min-height: 1.4em;
}

.timer-display {
  font-family: var(--rh-mono);
  font-size: var(--timer-size);
  font-weight: 700;
  color: var(--rh-white);
  line-height: 1;
  letter-spacing: -0.02em;
}

.timer-display.running { color: var(--rh-white); }
.timer-display.paused  { color: var(--rh-gray-light); }
.timer-display.overtime { color: var(--rh-red); }

.timer-mode {
  font-size: 0.75rem;
  color: var(--rh-gray-mid);
  margin-top: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── INFO GRID (schedule + lab access) ───────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--rh-gray-dark);
}

.info-panel {
  padding: 1.25rem 1.5rem;
  border-right: 1px solid var(--rh-gray-dark);
}

.info-panel:last-child { border-right: none; }

.info-panel h3 {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rh-red);
  margin-bottom: 0.75rem;
}

.schedule-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  gap: 1rem;
}

.schedule-row.active {
  background: var(--rh-red);
  color: var(--rh-white);
  font-weight: 600;
}

.schedule-row .break-name { color: var(--rh-gray-light); }
.schedule-row.active .break-name { color: var(--rh-white); }

.schedule-row .break-time {
  font-family: var(--rh-mono);
  font-size: 0.85rem;
  color: var(--rh-gray-light);
  white-space: nowrap;
}
.schedule-row.active .break-time { color: var(--rh-white); }

.lab-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.6rem;
  font-size: 0.88rem;
}

.lab-field label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rh-gray-mid);
  margin-bottom: 0.15rem;
}

.lab-field a {
  color: var(--rh-red);
  text-decoration: none;
  word-break: break-all;
}
.lab-field a:hover { text-decoration: underline; }

.lab-field span { color: var(--rh-gray-light); }

/* ── CREDENTIALS ─────────────────────────────────────────────── */
.credentials-section {
  border-top: 1px solid var(--rh-gray-dark);
  padding: 1.25rem 1.5rem;
}

.credentials-section h3 {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rh-red);
  margin-bottom: 0.75rem;
}

.creds-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.cred-card {
  background: var(--rh-gray-dark);
  border: 1px solid #555;
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--rh-mono);
  font-size: 0.9rem;
}

.cred-role {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--rh-gray-mid);
  letter-spacing: 0.07em;
  margin-bottom: 0.1rem;
}

.cred-user { color: var(--rh-white); font-weight: 600; }

.cred-sep {
  color: var(--rh-gray-mid);
  font-size: 0.85rem;
}

.cred-pass {
  color: var(--rh-gray-light);
  cursor: pointer;
  position: relative;
}

.cred-pass.masked::after {
  content: attr(data-mask);
  position: absolute;
  inset: 0;
  background: var(--rh-gray-dark);
  display: flex;
  align-items: center;
  letter-spacing: 0.15em;
  color: var(--rh-gray-mid);
}

.cred-copy {
  background: none;
  border: 1px solid var(--rh-gray-mid);
  color: var(--rh-gray-light);
  border-radius: 2px;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  cursor: pointer;
  font-family: var(--rh-font);
}
.cred-copy:hover { border-color: var(--rh-red); color: var(--rh-red); }
.cred-copy.copied { border-color: #3d9970; color: #3d9970; }

/* ── ADMIN STYLES ────────────────────────────────────────────── */
body.admin-body {
  background: var(--rh-gray-bg);
  color: var(--rh-dark);
}

body.admin-body .header {
  background: var(--rh-dark);
}

.admin-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-card {
  background: var(--rh-white);
  border: 1px solid var(--rh-gray-light);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.admin-card h3 {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rh-red);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rh-gray-light);
}

.form-field {
  margin-bottom: 0.85rem;
}

.form-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rh-gray-mid);
  margin-bottom: 0.3rem;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--rh-gray-light);
  border-radius: var(--radius);
  font-family: var(--rh-font);
  font-size: 0.9rem;
  background: var(--rh-white);
  color: var(--rh-dark);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--rh-red);
  box-shadow: 0 0 0 2px rgba(238,0,0,0.15);
}

.form-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.form-row .form-field { flex: 1; margin-bottom: 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-family: var(--rh-font);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--rh-red);
  color: var(--rh-white);
}
.btn-primary:hover { background: var(--rh-red-dark); }

.btn-secondary {
  background: var(--rh-gray-dark);
  color: var(--rh-white);
}
.btn-secondary:hover { background: #2a2d30; }

.btn-ghost {
  background: transparent;
  color: var(--rh-gray-mid);
  border: 1px solid var(--rh-gray-light);
}
.btn-ghost:hover { border-color: var(--rh-gray-mid); color: var(--rh-dark); }

.btn-danger {
  background: transparent;
  color: var(--rh-red);
  border: 1px solid var(--rh-red);
}
.btn-danger:hover { background: var(--rh-red); color: var(--rh-white); }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Timer control buttons */
.timer-btn-start { background: #3d9970; color: white; }
.timer-btn-start:hover { background: #2e7d5f; }
.timer-btn-pause { background: #e67e22; color: white; }
.timer-btn-pause:hover { background: #c96a15; }
.timer-btn-reset { background: var(--rh-gray-dark); color: white; }
.timer-btn-reset:hover { background: #2a2d30; }

/* Radio group */
.radio-group {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.88rem;
}
.radio-group label { font-size: 0.88rem; cursor: pointer; display: flex; gap: 0.3rem; align-items: center; text-transform: none; letter-spacing: 0; color: var(--rh-dark); font-weight: normal; }

/* Cert tags */
.cert-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.cert-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--rh-gray-bg);
  border: 1px solid var(--rh-gray-light);
  border-radius: 2px;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
}

.cert-tag button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--rh-gray-mid);
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
}
.cert-tag button:hover { color: var(--rh-red); }

/* Credentials table */
.creds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.creds-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--rh-gray-mid);
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid var(--rh-gray-light);
}

.creds-table td {
  padding: 0.3rem 0.4rem;
  vertical-align: middle;
}

.creds-table td input {
  width: 100%;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--rh-gray-light);
  border-radius: var(--radius);
  font-family: var(--rh-mono);
  font-size: 0.85rem;
}

.creds-table td input:focus {
  outline: none;
  border-color: var(--rh-red);
}

/* Token display */
.token-display {
  font-family: var(--rh-mono);
  font-size: 0.8rem;
  color: var(--rh-gray-light);
  background: rgba(255,255,255,0.1);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius);
}

/* Save bar */
.save-bar {
  background: var(--rh-white);
  border: 1px solid var(--rh-gray-light);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.save-status {
  font-size: 0.85rem;
  color: var(--rh-gray-mid);
}

.save-status.success { color: #3d9970; font-weight: 600; }
.save-status.error { color: var(--rh-red); font-weight: 600; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--rh-white);
  border-radius: var(--radius);
  padding: 2rem;
  min-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.modal h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--rh-dark);
}

.modal p {
  font-size: 0.88rem;
  color: var(--rh-gray-mid);
  margin-bottom: 1rem;
}

.hidden { display: none !important; }

/* ── TIMER EXPIRED LABEL ─────────────────────────────────────── */
.timer-expired-label {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--rh-red);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.1;
  padding: 0.5rem 1rem;
  animation: pulse-red 1.5s ease-in-out infinite;
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* ── CREDENTIAL ROWS ─────────────────────────────────────────── */
.cred-row {
  display: grid;
  grid-template-columns: minmax(6rem, 1fr) auto minmax(6rem, 1fr) auto auto;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.cred-field {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rh-gray-dark);
  color: var(--rh-gray-light);
  font-family: var(--rh-mono);
  font-size: 0.85rem;
  padding: 0.15rem 0.25rem;
  width: 100%;
  min-width: 0;
  outline: none;
  cursor: default;
}

.cred-field-user {
  color: var(--rh-white);
  font-weight: 600;
}

/* ── CREDENTIAL ICON BUTTONS ─────────────────────────────────── */
.cred-icon-btn {
  background: none;
  border: 1px solid var(--rh-gray-mid);
  border-radius: 3px;
  color: var(--rh-gray-light);
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem 0.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}
.cred-icon-btn svg { display: block; }
.cred-icon-btn:hover { border-color: var(--rh-red); color: var(--rh-white); }
.cred-icon-btn.copied { border-color: #3d9970; color: #3d9970; }

/* ── VI THEME TOGGLE BUTTON ──────────────────────────────────── */
.vi-toggle-btn {
  background: none;
  border: 2px solid var(--rh-red);
  border-radius: var(--radius);
  color: var(--rh-red);
  cursor: pointer;
  font-family: var(--rh-font);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.5rem;
  align-self: center;
  margin-left: 1rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.vi-toggle-btn:hover { border-color: var(--rh-red-dark); color: var(--rh-red-dark); }
.vi-toggle-btn.active { border-color: var(--rh-red); color: var(--rh-white); background: var(--rh-red); }

/* Notification toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--rh-gray-dark);
  color: var(--rh-white);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  z-index: 2000;
  transition: opacity 0.3s;
}
.toast.success { border-left: 4px solid #3d9970; }
.toast.error   { border-left: 4px solid var(--rh-red); }
