/* Stylesheet chuyên biệt cho Dịch vụ Xác thực CCCD - Tối ưu Mobile First */
:root {
  --dthu-primary: #0876ad;
  --dthu-primary-hover: #065d89;
  --glass-bg: rgba(255, 255, 255, 0.92);
  --glass-border: rgba(255, 255, 255, 0.6);
}

body {
  background-color: #f4f7fa;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* Ép màu chuẩn Tiêu đề DThU Brand Primary */
.text-primary,
h1.text-primary, h2.text-primary, h3.text-primary,
h4.text-primary, h5.text-primary, h6.text-primary,
#cardStepTitle,
.card-step-title,
.review-title,
.queue-title {
  color: #0876ad !important;
}

/* Header Bar Component - Sticky top giữ dải màu xanh tiêu đề luôn hiển thị ở trên cùng */
.header-bar {
  position: sticky !important;
  top: 0 !important;
  z-index: 1020 !important;
  background: linear-gradient(135deg, #0876ad 0%, #054c70 100%) !important;
  color: #ffffff !important;
  padding: 14px 0;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  box-shadow: 0 4px 14px rgba(8, 118, 173, 0.3);
}

.header-bar h1,
.header-bar h2,
.header-bar h3,
.header-bar h4,
.header-bar h5,
.header-bar h6,
.header-bar .text-white {
  color: #ffffff !important;
  font-weight: 700 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.header-bar .text-white-75 {
  color: rgba(255, 255, 255, 0.92) !important;
}

.header-bar .text-white-50 {
  color: rgba(255, 255, 255, 0.75) !important;
}

/* Biến card glassmorphism */
.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

/* Khung Dropzone Thẻ CCCD tương tác cao trên Mobile */
.card-dropzone-interactive {
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  border: 2px dashed #0d6efd !important;
  background-color: #f8fbfe !important;
  touch-action: manipulation;
  user-select: none;
}
.card-dropzone-interactive:active,
.card-dropzone-interactive:hover {
  background-color: #e6f3ff !important;
  border-color: #0876ad !important;
  transform: scale(0.99);
}

/* Giao diện Slide trượt ngang tách biệt từng bước */
.slides-container {
  overflow: hidden !important;
  position: relative;
  width: 100%;
}
.slides-wrapper {
  display: block;
  width: 100%;
}
.slide-pane {
  width: 100%;
  box-sizing: border-box;
  padding: 2px;
  transition: opacity 0.3s ease;
}
.slide-pane:not(.slide-active) {
  display: none !important;
  visibility: hidden;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.slide-pane.slide-active {
  display: block !important;
  visibility: visible;
  height: auto;
  opacity: 1;
  pointer-events: auto;
}

/* Camera Stream Container */
.camera-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  aspect-ratio: 4/3;
  background-color: #000;
  border-radius: 14px;
  overflow: hidden;
  border: 3px solid var(--dthu-primary);
  box-shadow: 0 6px 20px rgba(8, 118, 173, 0.2);
}

.camera-container-selfie {
  max-width: 320px;
  aspect-ratio: 3/4;
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Layer phủ khung Scanner Overlay */
.scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Overlay định vị phôi thẻ CCCD (Bước 2) */
.overlay-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 84%;
  height: 72%;
  max-width: 380px;
  max-height: 240px;
  border: 2px dashed #00e676;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.52);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.overlay-card::after {
  content: "ĐẶT MẶT THẺ NẰM VỪA KHUNG";
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: #00e676;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

/* Overlay định vị khuôn mặt Selfie (Bước 4) */
.overlay-selfie {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72%;
  height: 76%;
  max-width: 230px;
  max-height: 290px;
  border: 2px dashed #00e676;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.52);
  border-radius: 50% / 46%; /* Khung hình elip oval ôm chuẩn khuôn mặt */
  transition: all 0.3s ease;
}

.overlay-selfie::after {
  content: "CĂN MẶT VÀO GIỮA KHUNG";
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: #00e676;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

/* Thanh điều hướng dính đáy cho Mobile Ergonomics - One-Handed UX */
.mobile-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  /* Safe area cho iPhone notch/home indicator */
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1.5px solid #dee2e6;
  z-index: 1030;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.10);
}
/* Nút Quay lại: nhỏ hơn, ở bên trái */
.mobile-bottom-bar .btn-mobile-back {
  flex: 1;
  min-height: 52px;
  font-size: 15px;
  border-radius: 12px;
  font-weight: 700;
}
/* Nút Tiếp theo / Action chính: to hơn, bên phải - chuẩn one-handed thumb */
.mobile-bottom-bar .btn-mobile-next {
  flex: 2;
  min-height: 52px;
  font-size: 16px;
  border-radius: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Cropper Modal & Layout trên Mobile */
@media (max-width: 767.98px) {
  body {
    /* Safe area cho iPhone notch + thanh bottom nav */
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
  }
  #cropperModal .modal-dialog {
    margin: 0;
    max-width: 100%;
    height: 100%;
  }
  #cropperModal .modal-content {
    height: 100%;
    border-radius: 0 !important;
  }
  #cropperModal .modal-body {
    max-height: calc(100vh - 120px) !important;
  }
}
