/* ========================================================
   V-LeadTracking Application Styling
   Clinical Navy & Soft Blue Design System
   ======================================================== */

:root {
  --navy-950: #07101E;
  --navy-900: #0B192C; /* Deep Navy from screenshots */
  --navy-850: #0E2038;
  --navy-800: #122846;
  --navy-700: #17345C;
  --navy-600: #1E3A8A;
  --navy-accent: #2563EB;
  --clinical-bg: #F0F6FD; /* Soft ice-blue background */
  --clinical-card: #FFFFFF;
  --clinical-border: #D8E6F5;
  --clinical-input: #F4F8FC;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --safe-green: #10B981;
  --safe-bg: #ECFDF5;
  --danger-red: #EF4444;
  --danger-bg: #FEF2F2;
  --warning-amber: #F59E0B;
  --warning-bg: #FFFBEB;
  --borrow-purple: #8B5CF6;
  --borrow-bg: #F5F3FF;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--clinical-bg);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.7);
}

/* Layout Elements */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 270px;
  background-color: var(--navy-900);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s ease-in-out;
  z-index: 40;
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.sidebar.collapsed {
  width: 76px;
}

.sidebar.collapsed .sidebar-hide-text {
  display: none !important;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px 0;
  position: relative;
}

.sidebar.collapsed .sidebar-header-box {
  justify-content: center;
  padding: 18px 8px;
}

.sidebar.collapsed .sidebar-footer-box {
  justify-content: center;
  padding: 14px 8px;
}

/* Floating Tooltip for collapsed nav items */
.sidebar.collapsed .nav-item:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background-color: #0F172A;
  color: #FFFFFF;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  z-index: 100;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--clinical-bg);
  min-height: 100vh;
  transition: margin-left 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Sidebar Nav Items */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: 12px;
  color: #94A3B8;
  font-size: 0.925rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
  text-decoration: none;
  margin-bottom: 4px;
}

.nav-item:hover {
  color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  background-color: #1D4ED8;
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.35);
}

/* Topbar Header */
.topbar {
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--clinical-border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

/* Cards & Surfaces */
.card {
  background: #FFFFFF;
  border-radius: 18px;
  border: 1px solid var(--clinical-border);
  box-shadow: 0 4px 16px -2px rgba(11, 25, 44, 0.04);
  padding: 24px;
}

.card-interactive {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.card-interactive:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px -4px rgba(11, 25, 44, 0.08);
  border-color: #BFDBFE;
}

/* Buttons */
.btn-primary {
  background-color: #152A4A;
  color: #FFFFFF;
  font-weight: 500;
  border-radius: 12px;
  padding: 10px 20px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-size: 0.925rem;
}

.btn-primary:hover {
  background-color: #0E1E36;
  box-shadow: 0 4px 12px rgba(21, 42, 74, 0.25);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: #FFFFFF;
  color: #1E293B;
  border: 1px solid #CBD5E1;
  font-weight: 500;
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-size: 0.925rem;
}

.btn-secondary:hover {
  background-color: #F8FAFC;
  border-color: #94A3B8;
}

/* Inputs */
.form-input {
  width: 100%;
  background-color: var(--clinical-input);
  border: 1px solid #D0E1F4;
  border-radius: 12px;
  padding: 12px 14px 12px 42px;
  font-size: 0.95rem;
  color: #1E293B;
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus {
  background-color: #FFFFFF;
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.775rem;
  font-weight: 600;
  border-width: 1px;
  border-style: solid;
}

.badge-safe {
  background-color: #ECFDF5;
  color: #065F46;
  border-color: #A7F3D0;
}

.badge-danger {
  background-color: #FEF2F2;
  color: #991B1B;
  border-color: #FECACA;
}

.badge-warning {
  background-color: #FFFBEB;
  color: #92400E;
  border-color: #FDE68A;
}

.badge-borrowed {
  background-color: #F5F3FF;
  color: #5B21B6;
  border-color: #DDD6FE;
}

/* Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--clinical-border);
  background: #FFFFFF;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.custom-table th {
  background-color: #F8FAFD;
  color: #475569;
  font-weight: 600;
  padding: 14px 18px;
  border-bottom: 1px solid var(--clinical-border);
  white-space: nowrap;
}

.custom-table td {
  padding: 14px 18px;
  border-bottom: 1px solid #EDF2F9;
  color: #1E293B;
  vertical-align: middle;
}

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

.custom-table tr:hover td {
  background-color: #F8FBFE;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(11, 25, 44, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #FFFFFF;
  border-radius: 20px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(11, 25, 44, 0.25);
  transform: scale(0.95);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

/* Measurement Canvas and Caliper Tools */
.qc-canvas-container {
  position: relative;
  background-color: #030712;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
  user-select: none;
  touch-action: none;
}

.qc-canvas-container canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.ruler-hud-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background-color: rgba(3, 7, 18, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38BDF8;
  padding: 4px 10px;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

.badge-overdue {
  background-color: #FEF3C7;
  color: #B45309;
  border-color: #FCD34D;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: #FCD34D; }
  50% { border-color: #F59E0B; box-shadow: 0 0 8px rgba(245, 158, 11, 0.35); }
}

/* Print Certificate Styling */
@media print {
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
  }
  .no-print, .sidebar, .topbar, .btn-primary, .btn-secondary, button {
    display: none !important;
  }
  .app-container, .main-content {
    display: block !important;
    width: 100% !important;
    background: #FFFFFF !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .print-only {
    display: block !important;
  }
  .certificate-page {
    page-break-after: always;
    border: 2px solid #0B192C;
    padding: 30px;
    margin: 10px;
    border-radius: 8px;
    background: #FFFFFF !important;
  }
}

.print-only {
  display: none;
}
