/* VISION Modern Offline Stylesheet (100% Standalone - No external CDN) */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-focus: #93c5fd;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --unknown: #f97316;
  --radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
}

/* Header & Navigation */
.header {
  background: #1e293b;
  color: #ffffff;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 1px;
}

.logo-title {
  font-size: 18px;
  font-weight: 600;
}

.logo-sub {
  font-size: 12px;
  color: #94a3b8;
}

.nav-tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid transparent;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover {
  background: #334155;
  color: #ffffff;
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: #cbd5e1;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

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

/* Tab Content */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Grid & Cards */
.grid-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

/* Form Controls */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  margin-bottom: 5px;
}

.form-control, .form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-main);
  background: #fff;
  transition: border-color 0.15s;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.3);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

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

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

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

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

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

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

.btn-outline {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: #f1f5f9;
}

.btn-block {
  width: 100%;
}

.btn-group {
  display: flex;
  gap: 8px;
}

/* File Drop Zone */
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 14px;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: #eff6ff;
}

.dropzone-icon {
  font-size: 32px;
  color: #64748b;
  margin-bottom: 8px;
}

.dropzone-text {
  font-size: 13px;
  font-weight: 500;
  color: #334155;
}

.dropzone-sub {
  font-size: 12px;
  color: var(--text-muted);
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.data-table th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-unknown { background: #ffedd5; color: #9a3412; }
.badge-gray    { background: #e2e8f0; color: #475569; }

/* Photo Preview Box */
.preview-container {
  text-align: center;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.preview-container img, .preview-container video {
  max-width: 100%;
  max-height: 520px;
  object-fit: contain;
}

/* Face Comparison Box */
.compare-box {
  display: flex;
  gap: 16px;
  background: #f8fafc;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 10px;
}

.thumb-frame {
  width: 110px;
  height: 140px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.thumb-frame img {
  width: 100%;
  height: 115px;
  object-fit: cover;
}

.thumb-caption {
  font-size: 10px;
  color: var(--text-muted);
  padding: 2px 0;
  text-align: center;
}

/* Progress Bar */
.progress-container {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin: 10px 0;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.3s ease;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: #fff;
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #64748b;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
}

.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-error   { border-left: 4px solid var(--danger); }
.toast.toast-info    { border-left: 4px solid var(--primary); }

/* ==================== PHIÊN BẢN MOBI (MOBILE RESPONSIVE UI) ==================== */

.desktop-only { display: flex; }
.mobile-only { display: none; }

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 990;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.18);
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px 0;
  gap: 2px;
  transition: all 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.mobile-nav-item .mobile-nav-icon {
  font-size: 20px;
  line-height: 1;
}

.mobile-nav-item .mobile-nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.mobile-nav-item.active {
  color: #38bdf8;
}

.mobile-nav-item.active .mobile-nav-icon {
  transform: scale(1.15);
}

/* Mobile Quick Action Buttons */
.mobile-photo-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
}

.preview-hint {
  font-size: 11px;
  color: #64748b;
  text-align: center;
  margin-top: 6px;
}

/* Mobile Responsive Breakpoint (Điện thoại và máy tính bảng nhỏ) */
@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: inline-flex !important; }
  .mobile-bottom-nav { display: flex !important; }

  body {
    padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  }

  .header {
    padding: 8px 12px;
    position: sticky;
    top: 0;
    z-index: 800;
  }

  .logo-area {
    gap: 8px;
  }

  .logo-badge {
    font-size: 14px;
    padding: 2px 7px;
  }

  .logo-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
  }

  .logo-sub {
    display: none;
  }

  .header-status {
    gap: 6px;
    font-size: 11px;
  }

  .container {
    margin: 8px auto;
    padding: 0 8px;
  }

  .grid-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .card {
    padding: 12px 10px;
    margin-bottom: 12px;
    border-radius: 8px;
  }

  .card-title {
    font-size: 14px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .preview-container {
    min-height: 200px;
    max-height: 480px;
    padding: 4px;
    cursor: pointer;
  }

  .preview-container img, .preview-container video {
    max-height: 440px;
    border-radius: 6px;
  }

  .form-control, .form-select {
    font-size: 14px;
    padding: 9px 10px;
  }

  .btn {
    padding: 10px 14px;
    font-size: 13px;
  }

  .modal-content {
    width: 96%;
    max-height: 90vh;
    padding: 16px 12px;
    border-radius: 12px;
  }

  .toast-container {
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    right: 12px;
    left: 12px;
  }

  .toast {
    min-width: unset;
    width: 100%;
    font-size: 12px;
    padding: 10px 14px;
  }
}

