/* =========================================
   GLOBAL BASE
========================================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.error {
  color: #e74c3c;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}

.hidden {
  display: none;
}

/* =========================================
   LOGIN PAGE LAYOUT
========================================= */

body.login-page {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #0a3d62, #07456d);
}

.card {
  width: 420px;
  background: #ffffff;
  padding: 32px 40px;
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

.card h1 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 30px;
}

.card p {
  margin-top: 0;
  margin-bottom: 18px;
  font-size: 14px;
}

.card label {
  display: block;
  margin-top: 12px;
  margin-bottom: 4px;
  font-weight: 600;
}

.card input {
  width: 100%;
  padding: 9px 10px;
  border-radius: 6px;
  border: 1px solid #dcdde1;
  font-size: 14px;
}

.card button {
  width: 100%;
  padding: 10px;
  margin-top: 16px;
  border-radius: 8px;
  border: none;
  background: #00c6ff;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.card button:hover {
  background: #0096c7;
}

.links {
  margin-top: 14px;
  font-size: 14px;
}

.links a {
  color: #000;
  font-weight: 600;
  text-decoration: underline;
}

/* =========================================
   APP PAGES WITH SIDEBAR
========================================= */

#sidebar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  z-index: 100;
  background: #07456d;
  color: white;
  box-shadow: 3px 0 10px rgba(0,0,0,0.25);
}

.sidebar {
  padding: 30px 25px;
}

.sidebar .logo {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 40px;
  line-height: 1.2;
}

.sidebar nav a {
  display: block;
  color: #cfe7ff;
  text-decoration: none;
  padding: 12px 0;
  font-size: 17px;
  font-weight: 500;
  transition: padding-left .2s, color .2s;
}

.sidebar nav a:hover {
  padding-left: 10px;
  color: white;
}

.sidebar nav a.active {
  color: #fff;
  font-weight: 700;
  background: rgba(255,255,255,0.15);
  padding-left: 10px;
  border-radius: 6px;
}

.logout-btn {
  margin-top: 50px;
  width: 100%;
  padding: 12px 0;
  background: #c0392b;
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  cursor: pointer;
}

.logout-btn:hover {
  background: #992d22;
}

.page-content {
  margin-left: 230px;
  padding: 40px 50px;
  min-height: 100vh;
  background: #f7f9fc;
}

/* Dashboard stat boxes */
.stats-row {
  display: flex;
  gap: 24px;
  margin-top: 30px;
}

.stat-box {
  background: #ffffff;
  padding: 18px 20px;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  width: 220px;
}

.stat-box h3 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 16px;
}

.stat-box p {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

/* =========================================
   SECTION BLOCKS (REPORT TEXT)
========================================= */

/* Default: allow HTML (for references) */
.section {
  background: #ffffff;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  margin-bottom: 16px;
  white-space: normal !important;
}

/* Clinical text sections (preserve newlines) */
.section.preformatted {
  white-space: pre-wrap !important;
}

/* Spinner overlay */
.spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  margin-left: -60px;
  margin-top: -60px;
  border: 6px solid #eee;
  border-top-color: #3498db;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #2c3e50;
  text-align: center;
  padding: 10px;
  box-sizing: border-box;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner.hidden {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 800px) {
  #sidebar-container {
    position: static;
    width: 100%;
    height: auto;
  }

  .page-content {
    margin-left: 0;
    padding: 20px;
  }

  .stats-row {
    flex-direction: column;
  }

  .stat-box {
    width: 100%;
  }
}

/* =========================================
   SPINNER + STEPS (NON-ROTATING TEXT)
========================================= */

/* Spinner circle (no text) */
#spinner {
  position: fixed;
  top: 45%;
  left: 50%;
  width: 60px;
  height: 60px;
  margin-left: -30px;
  margin-top: -30px;
  border: 6px solid #eee;
  border-top-color: #3498db;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  z-index: 99999;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#spinner.hidden {
  display: none;
}

/* Text near spinner */
#spinner-overlay-text {
  position: fixed;
  top: calc(45% + 60px);
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 14px;
  color: #2c3e50;
  z-index: 99999;
}

/* Text under main button */
#spinner-text {
  font-size: 14px;
  color: #2c3e50;
  margin-top: 8px;
  margin-bottom: 8px;
}

/* Progress steps bar */
.progress-steps {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  align-items: center;
}

.progress-step {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #bdc3c7;
  background: #ecf0f1;
  color: #7f8c8d;
}

.progress-step.step-active {
  border-color: #2980b9;
  background: #3498db;
  color: white;
  font-weight: 600;
}

.progress-step.step-done {
  border-color: #27ae60;
  background: #2ecc71;
  color: white;
  font-weight: 600;
}

.progress-step.step-pending {
  opacity: 0.6;
}

/* =========================================
   SPINNER (CIRCLE) + STEP BAR
========================================= */

#spinner {
  position: fixed;
  top: 45%;
  left: 50%;
  width: 60px;
  height: 60px;
  margin-left: -30px;
  margin-top: -30px;
  border: 6px solid #eee;
  border-top-color: #3498db;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  z-index: 99999;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#spinner.hidden {
  display: none;
}

/* Text under button & near spinner */
#spinner-overlay-text {
  position: fixed;
  top: calc(45% + 70px);
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 14px;
  color: #2c3e50;
  z-index: 99999;
}

#spinner-text {
  font-size: 14px;
  color: #2c3e50;
  margin-top: 8px;
  margin-bottom: 8px;
}

/* Progress steps bar */
.progress-steps {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.progress-step {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #bdc3c7;
  background: #ecf0f1;
  color: #7f8c8d;
}

.progress-step.step-active {
  border-color: #2980b9;
  background: #3498db;
  color: white;
  font-weight: 600;
}

.progress-step.step-done {
  border-color: #27ae60;
  background: #2ecc71;
  color: white;
  font-weight: 600;
}

.progress-step.step-pending {
  opacity: 0.6;
}

/* =========================================
   IMAGE INPUT UI
========================================= */

.image-drop-zone {
  border: 2px dashed #bdc3c7;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  color: #7f8c8d;
  font-size: 14px;
  margin-top: 10px;
  margin-bottom: 6px;
  background: #f8f9fb;
  cursor: pointer;
}

.image-drop-zone.dragover {
  border-color: #2980b9;
  background: #ecf5ff;
}

.image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.image-thumb {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  border: 1px solid #dcdde1;
  object-fit: cover;
}


