/* ==========================================================================
   APARTMENT VISITOR MANAGEMENT SYSTEM — MASTER UI/UX STYLESHEET
   Version 1.0 | MVP Design Reference
   ========================================================================== */

:root {
  --vm-primary: #073b36;
  --vm-primary-dark: #042522;
  --vm-primary-light: #0d5c52;
  --vm-secondary: #17665a;
  --vm-accent: #dc9c32;
  --vm-accent-light: #fbeedb;
  --vm-bg: #f4f7f6;
  --vm-card-bg: #ffffff;
  --vm-border: #e2e8f0;
  --vm-text-main: #111827;
  --vm-text-muted: #64748b;

  /* Status Colors from Spec Section 4 */
  --vm-st-pending: #d97706;
  --vm-st-pending-bg: #fef3c7;
  --vm-st-approved: #059669;
  --vm-st-approved-bg: #d1fae5;
  --vm-st-rejected: #dc2626;
  --vm-st-rejected-bg: #fee2e2;
  --vm-st-entry: #0284c7;
  --vm-st-entry-bg: #e0f2fe;
  --vm-st-inside: #2563eb;
  --vm-st-inside-bg: #dbeafe;
  --vm-st-exited: #475569;
  --vm-st-exited-bg: #f1f5f9;
  --vm-st-cancelled: #94a3b8;
  --vm-st-cancelled-bg: #f8fafc;
}

/* Base Body Styles */
body.hms-body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--vm-bg);
  color: var(--vm-text-main);
  -webkit-font-smoothing: antialiased;
}

/* Fast Role Tester Strip */
.vm-role-bar {
  background: linear-gradient(90deg, #073b36 0%, #0a4e46 100%);
  color: #ffffff;
  padding: 8px 16px;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--vm-accent);
  position: sticky;
  top: 0;
  z-index: 1040;
}

.vm-role-bar .badge-role {
  background: rgba(255, 255, 255, 0.15);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.vm-role-bar .role-btn-group .btn {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.2s;
}

.vm-role-bar .role-btn-group .btn.active {
  background: var(--vm-accent);
  color: #073b36;
  border-color: var(--vm-accent);
}

/* Page Header & Breadcrumbs */
.hms-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.hms-page-title {
  font-size: 1.38rem;
  font-weight: 800;
  color: var(--vm-primary-dark);
  letter-spacing: -0.02em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hms-page-title i {
  color: var(--vm-accent);
}

.hms-breadcrumb {
  font-size: 0.8rem;
  color: var(--vm-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hms-breadcrumb .sep {
  color: #cbd5e1;
}

.hms-breadcrumb .current {
  color: var(--vm-primary);
  font-weight: 600;
}

/* Main Cards */
.vm-card {
  background: var(--vm-card-bg);
  border: 1px solid var(--vm-border);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.vm-card:hover {
  box-shadow: 0 8px 24px rgba(7, 59, 54, 0.06);
}

.vm-card .card-header {
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vm-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--vm-primary-dark);
  margin: 0;
}

.vm-sub {
  font-size: 0.8rem;
  color: var(--vm-text-muted);
  margin-top: 2px;
}

/* Large Touch KPI Cards (Watchman W02 & Admin A02 & Resident R02) */
.vm-kpi-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid var(--vm-border);
  padding: 18px 14px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-decoration: none !important;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.vm-kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  border-color: var(--vm-accent);
}

.vm-kpi-card::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--vm-primary);
}

.vm-kpi-card.kpi-amber::after {
  background: var(--vm-st-pending);
}

.vm-kpi-card.kpi-green::after {
  background: var(--vm-st-approved);
}

.vm-kpi-card.kpi-blue::after {
  background: var(--vm-st-inside);
}

.vm-kpi-card.kpi-red::after {
  background: var(--vm-st-rejected);
}

.vm-kpi-card.kpi-dark::after {
  background: var(--vm-st-exited);
}

.vm-kpi-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--vm-primary-dark);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.vm-kpi-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--vm-text-muted);
  margin-top: 4px;
}

.vm-kpi-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.vm-kpi-icon.bg-amber-soft {
  background: #fef3c7;
  color: #d97706;
}

.vm-kpi-icon.bg-green-soft {
  background: #d1fae5;
  color: #059669;
}

.vm-kpi-icon.bg-blue-soft {
  background: #dbeafe;
  color: #2563eb;
}

.vm-kpi-icon.bg-red-soft {
  background: #fee2e2;
  color: #dc2626;
}

.vm-kpi-icon.bg-dark-soft {
  background: #f1f5f9;
  color: #475569;
}

.vm-kpi-icon.bg-primary-soft {
  background: #e6f4f1;
  color: var(--vm-primary);
}

/* Prominent Gate Action Button (Watchman Interface Section 12) */
.btn-gate-hero {
  background: linear-gradient(135deg, #073b36 0%, #0d5c52 100%);
  color: #ffffff;
  border: 1.5px solid var(--vm-accent);
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 6px 18px rgba(7, 59, 54, 0.25);
  transition: all 0.25s ease;
  min-height: 52px;
}

.btn-gate-hero:hover {
  background: linear-gradient(135deg, #0d5c52 0%, #17665a 100%);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(7, 59, 54, 0.35);
}

.btn-gate-hero i {
  font-size: 1.25rem;
  color: var(--vm-accent);
}

/* 1-Tap Quick Mark Exit Button */
.btn-quick-exit {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-quick-exit:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

/* Status Badges (Section 4 of Spec) */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.02em;
}

.badge-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

/* 7 Core Statuses from Spec */
.badge-status.st-pending {
  background: var(--vm-st-pending-bg);
  color: var(--vm-st-pending);
  border: 1px solid rgba(217, 119, 6, 0.3);
}

.badge-status.st-pending::before {
  background: var(--vm-st-pending);
  animation: pulse-ring 1.5s infinite;
}

.badge-status.st-approved {
  background: var(--vm-st-approved-bg);
  color: var(--vm-st-approved);
  border: 1px solid rgba(5, 150, 105, 0.3);
}

.badge-status.st-approved::before {
  background: var(--vm-st-approved);
}

.badge-status.st-rejected {
  background: var(--vm-st-rejected-bg);
  color: var(--vm-st-rejected);
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.badge-status.st-rejected::before {
  background: var(--vm-st-rejected);
}

.badge-status.st-entry {
  background: var(--vm-st-entry-bg);
  color: var(--vm-st-entry);
  border: 1px solid rgba(2, 132, 199, 0.3);
}

.badge-status.st-entry::before {
  background: var(--vm-st-entry);
}

.badge-status.st-inside {
  background: var(--vm-st-inside-bg);
  color: var(--vm-st-inside);
  border: 1px solid rgba(37, 99, 235, 0.3);
}

.badge-status.st-inside::before {
  background: var(--vm-st-inside);
}

.badge-status.st-exited {
  background: var(--vm-st-exited-bg);
  color: var(--vm-st-exited);
  border: 1px solid rgba(71, 85, 105, 0.3);
}

.badge-status.st-exited::before {
  background: var(--vm-st-exited);
}

.badge-status.st-cancelled {
  background: var(--vm-st-cancelled-bg);
  color: var(--vm-st-cancelled);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge-status.st-cancelled::before {
  background: var(--vm-st-cancelled);
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    opacity: 0.7;
  }

  50% {
    transform: scale(1.3);
    opacity: 1;
  }

  100% {
    transform: scale(0.95);
    opacity: 0.7;
  }
}

/* Visitor Type Badges */
.badge-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.badge-type.type-guest {
  background: #f3e8ff;
  color: #7e22ce;
  border-color: #e9d5ff;
}

.badge-type.type-delivery {
  background: #ffedd5;
  color: #c2410c;
  border-color: #fed7aa;
}

.badge-type.type-service {
  background: #ecfeff;
  color: #0e7490;
  border-color: #cffafe;
}

.badge-type.type-cab {
  background: #fef9c3;
  color: #a16207;
  border-color: #fef08a;
}

/* Form Controls */
.vm-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--vm-primary-dark);
  margin-bottom: 6px;
  display: block;
}

.vm-label .req {
  color: #dc2626;
  margin-left: 2px;
}

.vm-label .sub-text {
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--vm-text-muted);
}

.form-control,
.form-select {
  border: 1.5px solid var(--vm-border);
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 0.92rem;
  color: var(--vm-text-main);
  background-color: #ffffff;
  transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--vm-accent);
  box-shadow: 0 0 0 3px rgba(220, 156, 50, 0.18);
  outline: none;
}

.input-group-text {
  background-color: #f8fafc;
  border: 1.5px solid var(--vm-border);
  color: var(--vm-text-muted);
  border-radius: 9px;
}

/* Camera Simulation Preview */
.camera-preview-box {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  padding: 16px;
  text-align: center;
  position: relative;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.camera-preview-box:hover {
  border-color: var(--vm-accent);
  background: #fffdfa;
}

.camera-preview-box img.preview-img {
  max-width: 140px;
  max-height: 140px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Visitor Pass Dossier Card (W13 & W05) */
.visitor-pass-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1.5px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(7, 59, 54, 0.08);
}

.visitor-pass-header {
  background: linear-gradient(135deg, #073b36 0%, #0d5c52 100%);
  color: #ffffff;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.visitor-pass-avatar {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.visitor-pass-body {
  padding: 24px;
}

.visitor-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.visitor-detail-item {
  background: #f8fafc;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #edf2f7;
}

.visitor-detail-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--vm-text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.visitor-detail-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--vm-primary-dark);
}

/* Timeline Flow in Detail Review */
.vm-timeline {
  position: relative;
  padding-left: 28px;
  margin-top: 14px;
}

.vm-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: #e2e8f0;
}

.vm-timeline-step {
  position: relative;
  margin-bottom: 16px;
}

.vm-timeline-step:last-child {
  margin-bottom: 0;
}

.vm-timeline-icon {
  position: absolute;
  left: -28px;
  top: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #cbd5e1;
  border: 3px solid #ffffff;
}

.vm-timeline-step.completed .vm-timeline-icon {
  background: var(--vm-st-approved);
}

.vm-timeline-step.active .vm-timeline-icon {
  background: var(--vm-accent);
  box-shadow: 0 0 0 3px rgba(220, 156, 50, 0.25);
}

/* Buttons */
.btn-vm-primary {
  background-color: var(--vm-primary);
  color: #ffffff;
  border: 1px solid var(--vm-primary);
  font-weight: 700;
  border-radius: 10px;
  padding: 10px 20px;
  transition: all 0.2s ease;
}

.btn-vm-primary:hover {
  background-color: var(--vm-primary-light);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-vm-accent {
  background-color: var(--vm-accent);
  color: #073b36;
  border: 1px solid var(--vm-accent);
  font-weight: 700;
  border-radius: 10px;
  padding: 10px 20px;
  transition: all 0.2s ease;
}

.btn-vm-accent:hover {
  background-color: #c98c26;
  color: #042522;
}

/* Filter Strip */
.vm-filter-strip {
  background: #ffffff;
  border: 1px solid var(--vm-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

/* Flat Grid Selector (W04) */
.flat-card-btn {
  background: #ffffff;
  border: 1.5px solid var(--vm-border);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.flat-card-btn:hover,
.flat-card-btn.selected {
  border-color: var(--vm-primary);
  background: #f0fdf9;
  box-shadow: 0 4px 14px rgba(7, 59, 54, 0.08);
}

.flat-card-btn .flat-num {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--vm-primary);
}

.flat-card-btn .resident-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--vm-text-muted);
  margin-top: 2px;
}

/* Notification Items (Section 8) */
.notif-card-item {
  border-left: 4px solid var(--vm-primary);
  background: #ffffff;
  border-radius: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--vm-border);
  border-right: 1px solid var(--vm-border);
  border-bottom: 1px solid var(--vm-border);
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.notif-card-item:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.notif-card-item.notif-urgent {
  border-left-color: #dc2626;
  background: #fffafa;
}

.notif-card-item.notif-approved {
  border-left-color: #059669;
}

.notif-card-item.notif-pending {
  border-left-color: #d97706;
}

/* Mobile responsive adjustments */
@media (max-width: 767.98px) {
  .hms-page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .btn-gate-hero {
    width: 100%;
  }

  .vm-role-bar {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
}

/* =========================================================
   PDF SCOPE COMPLETION - RESPONSIVE HARDENING
   Applied across Watchman, Resident and Admin MVP screens.
   ========================================================= */
.vm-scope-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  padding: .65rem;
  border: 1px solid var(--hms-border, #e2e8f0);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15,23,42,.05);
}
.vm-scope-tab {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 42px;
  padding: .65rem .9rem;
  border-radius: 10px;
  color: #475569;
  text-decoration: none;
  font-weight: 700;
  font-size: .84rem;
  transition: .2s ease;
}
.vm-scope-tab:hover { background: #f8fafc; color: #073b36; }
.vm-scope-tab.active { background: #073b36; color: #fff; box-shadow: 0 6px 16px rgba(7,59,54,.18); }

.table-responsive { -webkit-overflow-scrolling: touch; }
.table-responsive > .table { min-width: 760px; }
.card, .vm-card { max-width: 100%; }
img, video, canvas { max-width: 100%; }
.form-control, .form-select, .btn { min-height: 42px; }
.btn-sm { min-height: 34px; }

@media (max-width: 991.98px) {
  .hms-page-header { align-items: flex-start !important; gap: 1rem; }
  .hms-page-header > .d-flex { width: 100%; flex-wrap: wrap; }
  .hms-page-header > .d-flex .btn { flex: 1 1 180px; }
  .vm-kpi-card { min-height: 118px; }
  .modal-dialog { margin: .75rem; max-width: calc(100% - 1.5rem); }
}

@media (max-width: 767.98px) {
  .hms-page-content { padding: 14px !important; }
  .hms-page-header { display: flex; flex-direction: column; margin-bottom: 1rem !important; }
  .hms-page-title { font-size: 1.25rem !important; line-height: 1.35; }
  .hms-breadcrumb { overflow-x: auto; white-space: nowrap; max-width: 100%; padding-bottom: 2px; }
  .card-body.p-4 { padding: 1rem !important; }
  .card-header { padding: .85rem 1rem !important; }
  .vm-scope-tabs { display: grid; grid-template-columns: 1fr; padding: .5rem; }
  .vm-scope-tab { width: 100%; }
  .table-responsive > .table { min-width: 680px; font-size: .83rem; }
  .table .btn { white-space: nowrap; }
  .modal-content { border-radius: 14px; }
  .modal-body { max-height: calc(100vh - 170px); overflow-y: auto; }
  .d-flex.justify-content-end.gap-2,
  .d-flex.justify-content-between.gap-2 { flex-wrap: wrap; }
  .d-flex.justify-content-end.gap-2 > .btn { flex: 1 1 150px; }
}

@media (max-width: 575.98px) {
  .hms-page-content { padding: 10px !important; }
  .hms-topbar { padding-left: 10px !important; padding-right: 10px !important; }
  .hms-page-title { font-size: 1.12rem !important; }
  .vm-kpi-number { font-size: 1.45rem !important; }
  .btn { font-size: .82rem; }
  .row.g-3, .row.g-4 { --bs-gutter-x: .8rem; }
  .alert { padding: .8rem; }
  .input-group > .btn { flex: 0 0 auto !important; }
}
