/* ==========================================================================
   ONE EXAM CBT Platform - Base Stylesheet
   ========================================================================== */

@import url('./tokens.css');

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

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--color-surface);
  color: var(--color-on-surface);
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  line-height: var(--lh-body-md);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Accessible focus ring */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-on-primary-container);
}

/* Typography Helpers */
.font-display { font-family: var(--font-display); }
.font-numeric { font-family: var(--font-numeric); font-variant-numeric: tabular-nums; }
.font-label { font-family: var(--font-label); }

/* Common Layout Components */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--color-surface-container-lowest);
  box-shadow: var(--shadow-level-3);
  font-size: var(--text-body-sm);
  font-weight: 500;
  color: var(--color-on-surface);
  border-left: 4px solid var(--color-primary);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 420px;
}

.toast.toast-error {
  border-left-color: var(--color-error);
  background: #fff5f5;
  color: var(--color-on-error-container);
}

.toast.toast-success {
  border-left-color: var(--color-tertiary);
  background: #f2fcf4;
  color: var(--color-on-tertiary-container);
}

.toast.toast-warning {
  border-left-color: #d97706;
  background: #fffbeb;
  color: #92400e;
}

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

/* Modal backdrop & container */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background-color: rgba(17, 28, 45, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  background-color: var(--color-surface-container-lowest);
  border-radius: var(--radius-2xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-level-3);
  max-width: 540px;
  width: 100%;
  position: relative;
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Watermark Layer for Exam Integrity */
.watermark-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  opacity: 0.045;
  overflow: hidden;
  user-select: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  padding: 2rem;
}

.watermark-item {
  font-family: var(--font-numeric);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-on-surface);
  transform: rotate(-25deg);
  white-space: nowrap;
}

/* Alarm Visual Pulse Overlay */
.alarm-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(186, 26, 26, 0.94);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  animation: alarmPulse 1s infinite alternate;
}

.alarm-overlay.hidden {
  display: none !important;
}

@keyframes alarmPulse {
  0% { background: rgba(186, 26, 26, 0.94); }
  100% { background: rgba(147, 0, 10, 0.98); }
}

/* Print blocker rule */
@media print {
  body {
    display: none !important;
  }
}
