/* =========================================================
   Presensi Wajah — Tema Soft Elegan
   ========================================================= */
:root {
  /* ===== SOFT ELEGANT COLORS ===== */
  --bg: #f5f0eb;
  --bg-soft: #faf8f6;
  --bg-card: #ffffff;
  --bg-input: #f5f0eb;
  --border: rgba(180, 160, 150, 0.15);
  --border-strong: rgba(180, 160, 150, 0.25);

  /* ===== TEXT ===== */
  --text: #2c2420;
  --text-secondary: #5a4a42;
  --muted: #a89890;

  /* ===== SOFT COLORS ===== */
  --primary: #c9a78b;
  --primary-dark: #b8927a;
  --primary-light: #e8d5c4;
  --green: #9cbeb0;
  --green-dark: #7aa898;
  --orange: #e8c9a0;
  --red: #dbb0a8;
  --pink: #e8c0c0;
  --purple: #c5b0d8;
  --yellow: #e8d8a0;
  --teal: #a0c8c8;
  --blue: #a8bcd8;

  /* ===== SHADOWS ===== */
  --shadow: 0 4px 20px rgba(180, 160, 150, 0.12);
  --shadow-lg: 0 8px 40px rgba(180, 160, 150, 0.18);
  --shadow-hover: 0 8px 30px rgba(180, 160, 150, 0.20);

  /* ===== RADIUS ===== */
  --radius: 16px;
  --radius-lg: 24px;
  --radius-sm: 10px;
}

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

[v-cloak] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== FONT IMPORT (Inter) ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ========== APP CONTAINER ========== */
.app-layout {
  display: flex;
  gap: 24px;
  padding: 24px;
  max-width: 1440px;
  margin: 0 auto;
  min-height: 100vh;
  align-items: stretch;
}

/* ===== KOLOM KIRI: KAMERA ===== */
.col-camera {
  flex: 0 0 58%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.camera-wrap {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s ease;
}

.camera-wrap:hover {
  box-shadow: var(--shadow-lg);
}

.camera-stage {
  position: relative;
  width: 100%;
  padding-top: 75%;
  background: #1a1614;
  overflow: hidden;
}

.camera-stage video,
.camera-stage canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-stage.mirrored video {
  transform: scaleX(-1);
}

.camera-stage canvas {
  pointer-events: none;
  z-index: 2;
}

/* ===== STATUS BAR ===== */
.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-soft);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-family: "Inter", system-ui, sans-serif;
  letter-spacing: 0.2px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.dot.loading {
  background: var(--orange);
  animation: pulse 1s infinite;
}

.dot.scanning {
  background: var(--primary);
  animation: pulse 1s infinite;
}

.dot.ok {
  background: var(--green);
}

.dot.unknown {
  background: var(--orange);
  animation: pulse 0.5s infinite;
}

.dot.idle {
  background: var(--muted);
}

.dot.error {
  background: var(--red);
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

/* ===== GREETING ===== */
.greeting {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 252, 250, 0.95);
  backdrop-filter: blur(20px);
  padding: 32px 40px;
  border-radius: var(--radius-lg);
  text-align: center;
  z-index: 10;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 90%;
}

.greeting-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.greeting h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  font-family: "Inter", system-ui, sans-serif;
  letter-spacing: -0.3px;
}

.greet-info {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
}

.greet-time {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 400;
}

/* pop transition */
.pop-enter-active {
  transition: all .4s cubic-bezier(.2, 1.4, .4, 1);
}

.pop-leave-active {
  transition: all .3s ease;
}

.pop-enter-from,
.pop-leave-to {
  opacity: 0;
  transform: translate(-50%, -50%) scale(.85);
}

/* ===== CONTROLS ===== */
.controls {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  background: var(--bg-input);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  font-family: "Inter", system-ui, sans-serif;
  letter-spacing: 0.2px;
}

.btn:hover {
  background: #ece5e0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(180, 160, 150, 0.15);
}

.btn.ghost {
  background: var(--bg-input);
  border: 1px solid var(--border);
}

.btn.ghost:hover {
  background: #ece5e0;
  border-color: var(--border-strong);
}

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

.btn.primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 16px rgba(201, 167, 139, 0.35);
}

.btn.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn.success:hover {
  background: var(--green-dark);
}

.btn.small {
  padding: 5px 14px;
  font-size: 11px;
}

.btn.active {
  border-color: var(--primary);
  background: rgba(201, 167, 139, 0.12);
}

.cam-select {
  min-width: 150px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0l5 6 5-6z' fill='%23a89890'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
  font-family: "Inter", system-ui, sans-serif;
}

.cam-select:hover {
  border-color: var(--border-strong);
}

.cam-select option {
  background: var(--bg-card);
  color: var(--text);
}

/* ===== KOLOM KANAN: HISTORY ===== */
.col-history {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.history-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 500px;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.history-panel:hover {
  box-shadow: var(--shadow-lg);
}

.history-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 22px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.history-header h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Inter", system-ui, sans-serif;
  letter-spacing: -0.2px;
}

.history-header h3 .emoji {
  font-size: 20px;
}

.history-date {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
  font-weight: 400;
}

.history-count {
  font-size: 12px;
  font-weight: 600;
  background: var(--primary);
  color: white;
  padding: 3px 12px;
  border-radius: 999px;
  font-family: "Inter", system-ui, sans-serif;
}

.history-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.history-empty .empty-emoji {
  font-size: 48px;
}

.history-list {
  list-style: none;
  padding: 4px 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
}

.history-list::-webkit-scrollbar {
  width: 4px;
}

.history-list::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

/* ===== HISTORY ITEM ===== */
.history-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  transition: all 0.2s ease;
}

.history-item:hover {
  background: var(--bg-soft);
}

.history-item:last-child {
  border-bottom: none;
}

/* ===== AVATAR ===== */
.history-avatar {
  flex-shrink: 0;
}

.history-thumb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-input);
  border: 2px solid var(--border);
}

.history-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.15);
  font-family: "Inter", system-ui, sans-serif;
}

/* ===== INFO ===== */
.history-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.history-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  letter-spacing: -0.2px;
}

.history-name .nis-badge {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  background: var(--bg-input);
  padding: 1px 12px;
  border-radius: 999px;
  margin-left: 8px;
  font-family: "Inter", system-ui, sans-serif;
}

.history-time {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
}

/* ===== PHOTO THUMBNAIL ===== */
.history-photo {
  flex-shrink: 0;
}

.history-photo img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
  transition: all 0.25s ease;
}

.history-photo img:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow);
}

/* ===== HISTORY FOOTER ===== */
.history-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.face-count {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
}

.face-count strong {
  color: var(--text);
  font-weight: 600;
}

/* slide transition */
.slide-enter-active,
.slide-leave-active {
  transition: all .25s ease;
}

.slide-enter-from,
.slide-leave-to {
  opacity: 0;
  transform: translateY(-8px);
}

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(44, 36, 32, 0.5);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  max-width: 440px;
  width: 100%;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.modal-head {
  display: flex;
  gap: 18px;
  margin-bottom: 22px;
  align-items: center;
}

.face-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
  flex-shrink: 0;
  box-shadow: 0 0 0 6px rgba(201, 167, 139, 0.12);
}

.modal-head h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  letter-spacing: -0.3px;
}

.modal-head p {
  font-size: 14px;
  color: var(--muted);
  margin: 4px 0 0;
  font-weight: 400;
}

.modal label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-family: "Inter", system-ui, sans-serif;
}

.modal input {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 18px;
  font-family: "Inter", "SF Mono", monospace;
  letter-spacing: 4px;
  transition: all 0.25s ease;
  font-weight: 500;
}

.modal input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(201, 167, 139, 0.15);
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.modal-actions .btn {
  flex: 1;
  font-weight: 600;
}

.error {
  color: var(--red);
  font-size: 13px;
  margin-top: 8px;
  font-weight: 500;
}

.siswa-info {
  color: var(--green);
  font-size: 13px;
  margin-top: 6px;
  font-weight: 500;
}

/* fade transition */
.fade-enter-active,
.fade-leave-active {
  transition: opacity .25s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  box-shadow: var(--shadow-lg);
  font-family: "Inter", system-ui, sans-serif;
  letter-spacing: 0.2px;
}

.toast.success {
  background: var(--green);
}

.toast.error {
  background: var(--red);
}

.toast.warning {
  background: var(--orange);
}

/* ===== DEBUG PANEL ===== */
.debug-panel {
  position: fixed !important;
  bottom: 80px !important;
  left: 20px !important;
  right: 20px !important;
  max-height: 50vh !important;
  overflow: auto !important;
  z-index: 9999 !important;
  background: #ffffff !important;
  border: 2px solid var(--orange) !important;
  padding: 16px 20px !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg);
}

.debug-panel h3 {
  color: var(--orange);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "Inter", system-ui, sans-serif;
}

.debug-textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "SF Mono", monospace;
  font-size: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  white-space: pre;
  min-height: 150px;
  line-height: 1.6;
}

.debug-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .app-layout {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }

  .col-camera {
    flex: none;
    width: 100%;
  }

  .col-history {
    flex: none;
    width: 100%;
    max-height: 450px;
  }

  .history-panel {
    min-height: 320px;
  }

  .history-list {
    max-height: 280px;
  }

  .camera-stage {
    padding-top: 56.25%;
  }

  .history-thumb {
    width: 48px;
    height: 48px;
  }
}

@media (max-width: 600px) {
  .app-layout {
    padding: 12px;
    gap: 12px;
  }

  .col-history {
    max-height: 380px;
  }

  .history-panel {
    min-height: 280px;
  }

  .history-list {
    max-height: 220px;
  }

  .history-item {
    padding: 12px 16px;
    gap: 12px;
  }

  .history-thumb {
    width: 44px;
    height: 44px;
  }

  .history-thumb.placeholder {
    font-size: 18px;
  }

  .history-name {
    font-size: 15px;
  }

  .history-time {
    font-size: 12px;
  }

  .history-photo img {
    width: 40px;
    height: 40px;
  }

  .controls {
    gap: 8px;
    padding: 10px 14px;
  }

  .btn {
    font-size: 12px;
    padding: 7px 14px;
  }

  .cam-select {
    min-width: 100px;
    font-size: 12px;
    padding-right: 28px;
  }

  .history-header {
    padding: 12px 16px;
  }

  .history-header h3 {
    font-size: 15px;
  }

  .modal {
    padding: 24px;
    margin: 10px;
  }

  .greeting {
    padding: 22px 24px;
    min-width: auto;
    width: 90%;
  }

  .greeting h2 {
    font-size: 18px;
  }

  .debug-toggle {
    bottom: 12px;
    right: 12px;
  }

  .debug-panel {
    left: 12px !important;
    right: 12px !important;
    bottom: 70px !important;
    padding: 12px !important;
  }
}

@media (max-width: 400px) {
  .history-header h3 {
    font-size: 13px;
  }

  .history-date {
    font-size: 10px;
  }

  .history-count {
    font-size: 10px;
    padding: 1px 8px;
  }

  .controls .btn span {
    display: none;
  }

  .history-thumb {
    width: 38px;
    height: 38px;
  }

  .history-name {
    font-size: 13px;
  }

  .history-name .nis-badge {
    font-size: 10px;
    padding: 1px 8px;
  }
}