/* ==========================================================================
   Rig Asset Tagger - Inter-Unit Loans & Central Repair Hub Tracker Stylesheet
   High-Contrast Industrial Dark-Mode Theme
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Inter-Unit Loan Countdown Pills & Overdue Flashing Animation
   -------------------------------------------------------------------------- */
.loan-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  border-radius: 9999px;
  line-height: 1;
  transition: all 0.2s ease-in-out;
}

.loan-pill.active {
  background-color: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.15);
}

.loan-pill.due-soon {
  background-color: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
  animation: glow-loan-amber 2s ease-in-out infinite;
}

.loan-pill.overdue {
  background-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.8);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
  animation: pulse-overdue 1.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.loan-pill.returned {
  background-color: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.loan-pill.dispatched {
  background-color: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

/* Flashing Red Animation for Overdue Equipment Loans */
@keyframes pulse-overdue {
  0%, 100% {
    background-color: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.8);
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
    transform: scale(1);
  }
  50% {
    background-color: rgba(239, 68, 68, 0.65);
    border-color: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 16px 4px rgba(239, 68, 68, 0.8);
    transform: scale(1.03);
  }
}

@keyframes glow-loan-amber {
  0%, 100% {
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.2);
  }
  50% {
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.5);
  }
}

/* --------------------------------------------------------------------------
   2. 5-Stage Central Workshop Pipeline Step Bar
   -------------------------------------------------------------------------- */
.pipeline-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  width: 100%;
  padding: 0.75rem 0.5rem;
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  flex: 1;
  text-align: center;
}

.pipeline-step-node {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 900;
  border: 2px solid #334155;
  background-color: #0f172a;
  color: #64748b;
  transition: all 0.3s ease;
}

.pipeline-step.completed .pipeline-step-node {
  background-color: #065f46;
  border-color: #10b981;
  color: #34d399;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}

.pipeline-step.active .pipeline-step-node {
  background-color: #78350f;
  border-color: #f59e0b;
  color: #fde68a;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.5);
  animation: pulse-node 2s infinite;
}

.pipeline-step.pending .pipeline-step-node {
  background-color: #1e293b;
  border-color: #334155;
  color: #475569;
}

.pipeline-step-title {
  margin-top: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  transition: color 0.2s ease;
}

.pipeline-step.completed .pipeline-step-title {
  color: #34d399;
}

.pipeline-step.active .pipeline-step-title {
  color: #fbbf24;
  font-weight: 800;
}

.pipeline-step-bar {
  position: absolute;
  top: 1.875rem;
  left: 10%;
  right: 10%;
  height: 3px;
  background-color: #334155;
  z-index: 1;
}

.pipeline-step-progress {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #f59e0b);
  transition: width 0.4s ease-in-out;
}

@keyframes pulse-node {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

/* --------------------------------------------------------------------------
   3. 3-Photo Upload Dropzones & Inspection Gallery
   -------------------------------------------------------------------------- */
.photo-slot-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .photo-slot-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.photo-upload-slot {
  position: relative;
  background-color: #090d16;
  border: 2px dashed #334155;
  border-radius: 0.875rem;
  padding: 0.75rem;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.2s ease-in-out;
}

.photo-upload-slot:hover {
  border-color: #f59e0b;
  background-color: #0f172a;
}

.photo-upload-slot.has-image {
  border-style: solid;
  border-color: #10b981;
  padding: 0;
}

.photo-upload-slot img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 0.75rem;
}

.photo-slot-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10;
  padding: 0.2rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 800;
  text-transform: uppercase;
  border-radius: 0.375rem;
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.photo-slot-actions {
  position: absolute;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 11;
}

.photo-upload-slot:hover .photo-slot-actions {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   4. Formal Standalone Repair Certificate & QA Stamp
   -------------------------------------------------------------------------- */
.cert-formal-container {
  background: radial-gradient(circle at top left, #1e293b, #090d16);
  border: 2px solid #b45309;
  border-radius: 1.25rem;
  padding: 2rem;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), inset 0 0 20px rgba(245, 158, 11, 0.08);
}

.cert-security-border {
  border: 1px dashed rgba(245, 158, 11, 0.4);
  padding: 1.5rem;
  border-radius: 0.875rem;
  position: relative;
}

.qa-stamp-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  border: 3px double #ef4444;
  border-radius: 0.75rem;
  background-color: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  font-family: 'Courier New', Courier, monospace;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform: rotate(-4deg);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.25);
  user-select: none;
}

.qa-stamp-badge .stamp-title {
  font-size: 0.875rem;
  font-weight: 900;
  border-bottom: 2px solid #ef4444;
  padding-bottom: 0.2rem;
  margin-bottom: 0.2rem;
}

.qa-stamp-badge .stamp-sub {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fca5a5;
}

/* Priority Badges for Repair Orders */
.priority-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 800;
  border-radius: 0.375rem;
  text-transform: uppercase;
}

.priority-pill.critical {
  background-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.priority-pill.high {
  background-color: rgba(249, 115, 22, 0.2);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.5);
}

.priority-pill.medium {
  background-color: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.priority-pill.low {
  background-color: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* --------------------------------------------------------------------------
   5. Printable View for Standalone Workshop Repair Certificates
   -------------------------------------------------------------------------- */
@media print {
  body * {
    visibility: hidden;
  }
  #modalViewRepairCert, #modalViewRepairCert * {
    visibility: visible;
  }
  #modalViewRepairCert {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #ffffff !important;
  }
  .cert-formal-container {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
    box-shadow: none !important;
    padding: 1.5rem !important;
  }
  .cert-security-border {
    border: 1px solid #000000 !important;
  }
  .cert-formal-container * {
    color: #000000 !important;
  }
  .qa-stamp-badge {
    border-color: #b91c1c !important;
    color: #b91c1c !important;
    background: transparent !important;
  }
  .no-print {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   6. Wide-Screen Fluid Layout & Table Styling for Loans & Repair Hub
   -------------------------------------------------------------------------- */
#tableUnitLoans,
#tableRepairHub {
  width: 100%;
  min-width: 100%;
}

@media (min-width: 1536px) {
  #tableUnitLoans th,
  #tableUnitLoans td,
  #tableRepairHub th,
  #tableRepairHub td {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
  }
}

@media (min-width: 1920px) {
  #tableUnitLoans th,
  #tableUnitLoans td,
  #tableRepairHub th,
  #tableRepairHub td {
    font-size: 0.8125rem;
  }
  .pipeline-track {
    max-width: 1200px;
    margin: 0 auto;
  }
}
