/* Modern CSS Design System for Anti-Cheat Coding Assessment */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fef2f2;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-focus: #818cf8;
  --code-bg: #1e293b;
  --code-text: #f1f5f9;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Header Banner - Google Forms style with elevated modern touch */
.form-header-card {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  color: #ffffff;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.form-header-card::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.form-header-card h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.form-header-card p {
  font-size: 15px;
  opacity: 0.9;
  max-width: 700px;
  line-height: 1.6;
}

/* Security Notice Card */
.security-notice-card {
  background: #fff;
  border-left: 5px solid #f59e0b;
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.security-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--warning-light);
  color: var(--warning);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}

.security-text h3 {
  font-size: 16px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 6px;
}

.security-text ul {
  list-style-type: none;
  font-size: 14px;
  color: var(--text-muted);
}

.security-text ul li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 4px;
}

.security-text ul li::before {
  content: "•";
  position: absolute;
  left: 6px;
  color: var(--warning);
  font-weight: bold;
}

/* Form Section Cards */
.form-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.form-card:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
}

.form-label .required {
  color: var(--danger);
  margin-left: 3px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 15px;
  font-family: inherit;
  color: var(--text-main);
  background-color: #fff;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-control::placeholder {
  color: #94a3b8;
}

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  appearance: none;
  padding-right: 40px;
}

/* Task Display Box */
.task-box {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 12px;
}

.task-box-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}

.task-box-desc {
  font-size: 14px;
  color: #334155;
  white-space: pre-wrap;
  line-height: 1.6;
  font-family: inherit;
}

/* Rich HTML content from Quill editor */
.task-html-content {
  white-space: normal;
  font-size: 14px;
  color: #334155;
  line-height: 1.7;
  font-family: inherit;
}

.task-html-content p {
  margin-bottom: 10px;
}

.task-html-content h1,
.task-html-content h2,
.task-html-content h3 {
  color: #0f172a;
  font-weight: 700;
  margin-bottom: 8px;
  margin-top: 14px;
}

.task-html-content h1 { font-size: 20px; }
.task-html-content h2 { font-size: 17px; }
.task-html-content h3 { font-size: 15px; }

.task-html-content ul,
.task-html-content ol {
  padding-left: 22px;
  margin-bottom: 10px;
}

.task-html-content li {
  margin-bottom: 4px;
}

.task-html-content strong { font-weight: 700; color: #0f172a; }
.task-html-content em { font-style: italic; }

.task-html-content code {
  background: #1e293b;
  color: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

.task-html-content pre {
  background: #1e293b;
  color: #f1f5f9;
  padding: 14px 18px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.task-html-content blockquote {
  border-left: 4px solid var(--primary);
  padding: 10px 16px;
  background: var(--primary-light);
  border-radius: 0 8px 8px 0;
  color: #3730a3;
  margin-bottom: 10px;
  font-style: italic;
}

/* Tables from Quill editor */
.task-html-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  font-size: 13px;
}

.task-html-content table th {
  background: #4f46e5;
  color: #ffffff;
  font-weight: 700;
  padding: 10px 14px;
  text-align: left;
  border: 1px solid #4338ca;
}

.task-html-content table td {
  padding: 9px 14px;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  background: #fff;
}

.task-html-content table tr:nth-child(even) td {
  background: #f8fafc;
}

.task-html-content table tr:hover td {
  background: #eef2ff;
  transition: background 0.15s ease;
}

/* Code Editor Container */
.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f172a;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  padding: 12px 18px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
}

.editor-dots {
  display: flex;
  gap: 6px;
}

.editor-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.editor-lang-select {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.code-wrapper {
  position: relative;
  background: var(--code-bg);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid #334155;
  border-top: none;
}

.code-editor {
  width: 100%;
  min-height: 360px;
  background: transparent;
  color: var(--code-text);
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  padding: 18px;
  border: none;
  outline: none;
  resize: vertical;
  tab-size: 4;
}

/* Floating Proctoring Bar in Fullscreen / Exam Mode */
.proctor-status-bar {
  position: sticky;
  top: 12px;
  z-index: 100;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: var(--transition);
}

.proctor-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.pulse-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.violations-counter {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.violations-counter.safe {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
}

.violations-counter.warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.4);
}

.timer-box {
  font-family: monospace;
  font-size: 16px;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Submit Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-block {
  width: 100%;
}

/* Fullscreen Violation Alert Modal Overlay */
.violation-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.violation-modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  border: 3px solid var(--danger);
}

.violation-modal-card .alarm-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  background: var(--danger-light);
  color: var(--danger);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  animation: shake 0.6s ease-in-out infinite;
}

.violation-modal-card h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--danger);
  margin-bottom: 12px;
}

.violation-modal-card p {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.violation-badge-stat {
  background: #f1f5f9;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text-main);
  font-size: 16px;
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  20%, 60% { transform: rotate(-8deg); }
  40%, 80% { transform: rotate(8deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Toast Notification for Paste / Copy block */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  border-left: 4px solid var(--danger);
  z-index: 100000;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

/* Agreement Screen Before Starting */
.agreement-card {
  text-align: center;
  padding: 40px 30px;
}

.agreement-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.agreement-rules {
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 20px 0;
  font-size: 14px;
  color: #334155;
}

.agreement-rules li {
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.agreement-rules li:last-child {
  margin-bottom: 0;
}

/* Success Page Styling */
.success-card {
  text-align: center;
  padding: 60px 40px;
  max-width: 600px;
  margin: 40px auto;
}

.success-icon-wrap {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--success-light);
  color: var(--success);
  font-size: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    padding: 16px 12px;
  }
  .form-header-card {
    padding: 24px 20px;
  }
  .form-card {
    padding: 20px 16px;
  }
  .proctor-status-bar {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
}

/* Rich HTML task content styling (Quill editor output) */
.task-html-content {
  line-height: 1.7;
  color: var(--text-main, #0f172a);
  font-size: 15px;
}

.task-html-content h1,
.task-html-content h2,
.task-html-content h3,
.task-html-content h4 {
  margin-top: 16px;
  margin-bottom: 8px;
  font-weight: 700;
  color: #0f172a;
}

.task-html-content h1 { font-size: 20px; }
.task-html-content h2 { font-size: 18px; }
.task-html-content h3 { font-size: 16px; }

.task-html-content p {
  margin-bottom: 10px;
}

.task-html-content ul,
.task-html-content ol {
  margin: 10px 0 14px 24px;
}

.task-html-content li {
  margin-bottom: 4px;
}

.task-html-content blockquote {
  border-left: 4px solid var(--primary, #6366f1);
  padding: 8px 16px;
  background: #f8fafc;
  margin: 12px 0;
  border-radius: 0 6px 6px 0;
  color: #475569;
  font-style: italic;
}

.task-html-content pre,
.task-html-content .ql-syntax {
  background: #0f172a;
  color: #f8fafc;
  padding: 14px 18px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  overflow-x: auto;
  margin: 12px 0;
}

.task-html-content code {
  font-family: 'JetBrains Mono', monospace;
  background: #f1f5f9;
  color: #4f46e5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.task-html-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid #cbd5e1;
}

.task-html-content th,
.task-html-content td {
  border: 1px solid #e2e8f0;
  padding: 10px 14px;
  text-align: left;
  font-size: 14px;
}

.task-html-content th {
  background: #f8fafc;
  font-weight: 700;
  color: #1e293b;
  border-bottom: 2px solid #cbd5e1;
}

.task-html-content tr:nth-child(even) td {
  background: #fcfcfd;
}

.task-html-content tr:hover td {
  background: #f1f5f9;
}

.task-html-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 14px 0;
  display: block;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
}

