/* ================================================
   MEDICAL PORTAL STYLESHEET
   Matches the dark theme of pairings dashboard
   ================================================ */

/* Import existing variables and base styles */
:root {
  color-scheme: dark;

  /* Color Palette */
  --bg: #0b0f14;
  --card: #121821;
  --row: #0f141b;
  --row-alt: #0d1219;
  --border: #1e2a38;
  
  /* Text Colors */
  --text: #e8edf2;
  --muted: #9fb0c0;
  --accent: #6fb1ff;
  --strike: #84a1b7;
  
  /* Status Colors */
  --green: #98f5a7;
  --yellow: #ffd166;
  --red: #ff6b6b;
  --orange: #ffae60;
  --chip: #182231;

  /* Requirement row colors */
  --req-bg: rgba(66, 135, 245, .12);
  --req-bg-hover: rgba(66, 135, 245, .20);
  --req-border: rgba(66, 135, 245, .35);
}

/* ========================
   BASE STYLES
   ======================== */
* {
  box-sizing: border-box;
}

html, body {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, 
       Cantarell, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

/* ========================
   LAYOUT CONTAINERS
   ======================== */
.wrap {
  max-width: 1100px;
  margin: 28px auto;
  padding: 0 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}

h1 {
  margin: 0 0 8px;
  font-size: 22px;
}

h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

h3 {
  margin: 16px 0 8px;
  font-size: 16px;
  color: var(--muted);
}

/* ========================
   CHIPS & CONTROLS
   ======================== */
.sub {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0 16px;
}

.chip {
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

/* ========================
   BUTTONS
   ======================== */
.btn {
  background: var(--accent);
  color: #031323;
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: all .2s;
}

.btn:hover {
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(111, 177, 255, 0.3);
}

.btn.secondary {
  background: var(--chip);
  color: var(--text);
  border: 1px solid var(--border);
}

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

/* ========================
   REQUIREMENTS TABLE
   ======================== */
#requirements {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
  table-layout: fixed;
  margin-top: 16px;
}

#requirements th,
#requirements td {
  padding: 10px 12px;
  vertical-align: middle;
  text-align: left;
}

#requirements th {
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

/* ========================
   REQUIREMENT ROWS
   ======================== */
tr.req-row {
  cursor: pointer;
}

tr.req-row td {
  background: var(--req-bg);
  border-top: 1px solid var(--req-border);
  border-bottom: 1px solid var(--req-border);
}

tr.req-row:hover td {
  background: var(--req-bg-hover);
}

tr.req-row td:first-child {
  border-left: 1px solid var(--req-border);
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

tr.req-row td:last-child {
  border-right: 1px solid var(--req-border);
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 999px;
}

.status-scheduled {
  background: var(--green);
  color: #021216;
}

.status-not-scheduled {
  background: var(--yellow);
  color: #1a1508;
}

.status-overdue {
  background: var(--red);
  color: #130606;
}

.status-completed {
  background: var(--chip);
  color: var(--muted);
  text-decoration: line-through;
}

/* ========================
   MODAL STYLES
   ======================== */
body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  touch-action: none;
}

.modal.hidden {
  display: none;
}

.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: calc(100% - 32px);
  max-width: 600px;
  max-height: 85vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}

.modal-header,
.modal-footer {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.modal-footer {
  border-top: 1px solid var(--border);
  border-bottom: 0;
  justify-content: flex-end;
  gap: 8px;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  flex: 1;
}

.modal-close {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

.modal-content {
  padding: 14px;
}

/* ========================
   FORM STYLES
   ======================== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text);
}

.form-input {
  width: 100%;
  background: var(--row);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(111, 177, 255, 0.1);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

select.form-input {
  cursor: pointer;
}

input[type="file"].form-input {
  padding: 6px;
  cursor: pointer;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ========================
   UPLOADED DOCS
   ======================== */
#uploaded-docs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--row);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.doc-item a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  flex: 1;
}

.doc-item a:hover {
  text-decoration: underline;
}

.doc-item button {
  background: transparent;
  border: 0;
  color: var(--red);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 16px;
}

/* ========================
   UTILITY CLASSES
   ======================== */
.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 740px) {
  html, body {
    overflow-x: hidden !important;
  }
  
  .wrap {
    padding: 0 12px;
  }

  #requirements th,
  #requirements td {
    padding: 8px 10px;
    font-size: 13px;
  }

  .modal-card {
    max-width: 100%;
  }
}