/* =========================================================
   TRYOUT UKOM KEPERAWATAN - UI COMPONENTS & CBT STYLES
   ========================================================= */

/* Cards & Containers */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Stat Cards */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--primary-light);
  color: var(--primary-dark);
  flex-shrink: 0;
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

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

.btn-secondary {
  background-color: var(--surface-alt);
  color: var(--text-main);
  border-color: var(--border);
}

.btn-secondary:hover {
  background-color: var(--border);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background-color: var(--primary-light);
}

.btn-warning {
  background-color: var(--warning);
  color: white;
}

.btn-warning:hover {
  background-color: #b45309;
}

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

.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

/* Form Elements */
.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  color: var(--text-main);
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  outline: none;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.badge-success {
  background-color: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background-color: var(--warning-bg);
  color: var(--warning);
}

.badge-danger {
  background-color: var(--danger-bg);
  color: var(--danger);
}

.badge-info {
  background-color: var(--info-bg);
  color: var(--info);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  background-color: var(--surface-alt);
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-main);
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background-color: var(--background);
}

/* =========================================================
   CBT ENGINE UI COMPONENTS
   ========================================================= */
.cbt-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #f1f5f9;
}

.cbt-header {
  height: 60px;
  background-color: #0f172a;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  flex-shrink: 0;
}

.cbt-brand {
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cbt-timer {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 0.375rem 1rem;
  border-radius: var(--radius-full);
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cbt-timer.warning {
  color: #f87171;
  animation: pulse 1s infinite;
}

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

.cbt-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.cbt-main-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.cbt-question-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.question-number {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--primary);
}

.question-case {
  background-color: #f8fafc;
  border-left: 4px solid var(--primary);
  padding: 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
  color: var(--text-main);
}

.question-text {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
  color: #0f172a;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  background-color: white;
}

.option-item:hover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.option-item.selected {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.option-key {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  background: white;
}

.option-item.selected .option-key {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.option-label {
  font-size: 0.95rem;
  line-height: 1.5;
  padding-top: 0.15rem;
}

.cbt-footer {
  padding: 1rem 1.5rem;
  background-color: white;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Anti-Cheat Strict Protection Styles */
body.cbt-mode {
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
}

body.cbt-mode ::selection {
  background: transparent !important;
  color: inherit !important;
}

.cbt-sidebar {
  width: 320px;
  background-color: white;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
}

.palette-header {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  overflow-y: auto;
  flex: 1;
  align-content: start;
}

.palette-btn {
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: #f8fafc;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.palette-btn:hover {
  border-color: var(--primary);
}

.palette-btn.answered {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.palette-btn.marked {
  background-color: var(--warning);
  color: white;
  border-color: var(--warning);
}

.palette-btn.active {
  ring: 2px solid #0284c7;
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

/* CBT Identity Card */
.cbt-user-card {
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cbt-user-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.cbt-user-name {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cbt-user-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* CBT Calculator Widget */
.cbt-calculator {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.calc-header {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calc-screen {
  background-color: #0f172a;
  color: #38bdf8;
  font-family: monospace;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: right;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  min-height: 42px;
  word-break: break-all;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.calc-btn {
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--surface-alt);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.calc-btn:hover {
  background-color: var(--border);
}

.calc-btn.op {
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

.calc-btn.action {
  background-color: var(--danger-bg);
  color: var(--danger);
}

.calc-btn.equals {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
  grid-column: span 2;
}

/* PWA Mobile Installation Gate & Guide Styles */
.pwa-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #0f172a, #0f766e);
  color: white;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
}

.pwa-box {
  background-color: white;
  color: var(--text-main);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  padding: 2rem 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.pwa-guide-step {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  text-align: left;
  background-color: var(--surface-alt);
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
}

.pwa-step-num {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background-color: var(--primary);
  color: white;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Modals & Toast */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  padding: 1rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background-color: white;
  border-radius: var(--radius-lg);
  width: 95%;
  max-width: 780px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 2rem 2.25rem;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-card.modal-lg {
  max-width: 920px;
}

.modal-header {
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.modal-body-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  color: var(--text-main);
}

.modal-body-scroll::-webkit-scrollbar {
  width: 6px;
}
.modal-body-scroll::-webkit-scrollbar-track {
  background: var(--surface-alt);
  border-radius: 4px;
}
.modal-body-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.modal-body-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  background-color: #0f172a;
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Live Monitoring Pulse Animations */
.live-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 rgba(34, 197, 94, 0.7);
  animation: livePulse 1.6s infinite;
}

@keyframes livePulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  70% {
    transform: scale(1.15);
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

