/* ===========================
   datastyles.css (unified)
   - Includes ALL classes from the previous version
   - Adds shared styles for twin sticky headers & mass update row
   - Standardizes buttons/inputs to your blue
=========================== */

/* ---------- Global resets ---------- */
*{ box-sizing:border-box; margin:0; padding:0; }

:root{
  /* Brand + UI (using your original blue) */
  --brand:#0066cc;
  --brand-dark:#004c99;
  --navy:#001f4d;

  --ui:#e5e7eb;
  --muted:#6b7280;

  /* Feedback */
  --ok:#065f46; --warn:#b45309; --err:#b91c1c;

  /* Tables */
  --thead-primary-bg:#001f4d;   /* navy header for primary row */
  --thead-primary-ink:#ffffff;
  --thead-secondary-bg:#e0f2fe; /* light blue mass-update row */
  --thead-secondary-ink:#000000;
  --row-alt:#f8fafc;

  /* Buttons (match your previous) */
  --btn-bg:#0066cc;
  --btn-ink:#ffffff;
  --btn-shadow:#004c99;

  /* Cards */
  --card-bg:#ffffff;
  --card-border:#d0d5de;
}

body{
  font-family:'Avenir', Arial, sans-serif;
  background:#fafafa;
  color:#333;
  line-height:1.4;
  padding:16px;
}

/* Main header full width */
h1{ width:100%; text-align:center; margin-bottom:16px; }

/* ---------- Layout (legacy schedule board) ---------- */
main#main{ display:flex; }
aside{
  width:300px; flex:0 0 300px;
  display:flex; flex-direction:column; gap:16px;
}
#boardContainer{ flex:1; padding-left:16px; overflow-x:auto; }

/* ---------- Panels ---------- */
.legend, #legend, #instructions, #controls{
  background-color:#e0f0ff;
  border:1px solid #a0c4ff;
  border-radius:5px;
  box-shadow:0 2px 8px rgba(0,0,0,.1);
  padding:16px;
}
#controls{ display:flex; flex-direction:column; gap:8px; }
#controls button{ width:100%; }

/* ---------- Cards / wrappers (shared) ---------- */
.wrap{
  max-width:100%;
  width:min(95vw, 1600px);
  margin:0 auto;
  padding-left:20px;
  padding-right:20px;
}
.card{
  background:var(--card-bg);
  border:1px solid var(--card-border);
  border-radius:12px;
  padding:14px;
  box-shadow:0 1px 2px rgba(16,24,40,.06);
}

/* ---------- Responsive grid helpers for wide viewports ---------- */
.grid{
  display:grid;
  gap:14px;
  grid-template-columns:1fr; /* single column on narrow screens */
}

/* two columns on medium screens */
@media (min-width: 900px){
  .grid{
    grid-template-columns:repeat(2, 1fr);
  }
}

/* three columns on very wide screens */
@media (min-width: 1400px){
  .grid{
    grid-template-columns:repeat(3, 1fr);
  }
}

/* Cards grow to fill grid cells */
.card.flex{ display:flex; flex-direction:column; }

/* ---------- Utilities ---------- */
.muted{ color:var(--muted); }
.hidden{ display:none !important; }
.pill{
  display:inline-block; padding:4px 10px; border-radius:999px; font-size:.85rem;
  background:#eef2ff; color:#3730a3; border:1px solid #e0e7ff;
}
.pill.warn{ background:#fffbeb; color:#92400e; border-color:#f59e0b; }
.pill.err{ background:#fee2e2; color:#991b1b; border-color:#fecaca; }
.toolbar{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.toolbar .spacer{ flex:1; }

.status{ margin-top:8px; min-height:1.4em; white-space:pre-wrap; }
.status.ok{ color:var(--ok); }
.status.err{ color:var(--err); }

/* ---------- Buttons (use your blue) ---------- */
.button{
  padding:8px 12px;
  background-color:var(--btn-bg);
  color:var(--btn-ink);
  border:none;
  border-radius:5px;
  font-size:.9rem;
  cursor:pointer;
  transition:background-color .2s, box-shadow .2s, border-bottom .2s;
  font-family:'Avenir', Arial, sans-serif;
  box-shadow:0 4px 6px rgba(0,0,0,.1);
  border-bottom:3px solid var(--btn-shadow);
}
.button:hover{
  background-color:#005bb5;
  box-shadow:0 2px 4px rgba(0,0,0,.15);
  border-bottom:3px solid #003366;
}
.button:disabled{ opacity:.6; cursor:not-allowed; }
.button-secondary{
  background-color:#e2e8f0; color:#1a202c;
  box-shadow:0 4px 6px rgba(0,0,0,.05);
  border-bottom:3px solid #b0b7bf;
}
.button-secondary:hover{
  background-color:#cbd5e1;
  box-shadow:0 2px 4px rgba(0,0,0,.1);
  border-bottom:3px solid #8a929a;
}

/* ---------- Inputs (shared) ---------- */
input[type="text"], input[type="number"], input[type="search"], select, textarea{
  border-radius:5px; padding:6px 8px; border:1px solid #ccc;
  font-family:'Avenir', Arial, sans-serif; font-weight:300; font-size:inherit;
}
input[type="search"]{ -webkit-appearance:none; appearance:none; }
.ipt{ padding:8px 10px; border:1px solid #cbd5e1; border-radius:8px; background:#fff; font:inherit; }
.ipt.small{ padding:6px 8px; width:110px; }
.ipt.search{ width:280px; }
.readonly{ background:#f7f7f7 !important; color:#333 !important; }
.dirty, .modified-field{ background-color:#fff9c4; transition:background-color .3s ease; }

/* ---------- Floating window (magnets) ---------- */
.floating-window{
  position:absolute; top:16px; right:16px; width:240px; max-height:80vh;
  display:flex; flex-direction:column; background:#fff;
  border:1px solid #d0d5de; border-radius:5px;
  box-shadow:0 4px 8px rgba(0,0,0,.1); overflow:hidden; z-index:10;
}
.floating-window .title-bar{
  /* navy header per request */
  background:#0f3b8f; color:#fff;
  padding:8px; font-weight:bold; cursor:grab;
  border-bottom:1px solid #0b2e6e;
}
#magnetList{ overflow-y:auto; padding:8px; flex:1; }
#magnetList .magnet{
  margin-bottom:6px; border-radius:5px; padding:8px; cursor:grab; position:relative;
}
#magnetList .magnet.dragging{ opacity:.6; cursor:grabbing; }
.magnet-label{ font-weight:600; margin-bottom:4px; }

/* legacy magnet color accents */
.magnet[data-semester="Fall"]{ background-color:rgba(235,83,83,.1); border-left:4px solid #eb5353; }
.magnet[data-semester="Spring"]{ background-color:rgba(70,130,180,.1); border-left:4px solid #4682b4; }

/* ---------- Legacy board table (scheduleboard) ---------- */
.schedule-table-wrapper{
  overflow-x:auto; overflow-y:auto;
  max-height:calc(100vh - 200px);
}
.schedule-table{ width:100%; border-collapse:collapse; table-layout:fixed; }
.schedule-table th, .schedule-table td{
  padding:8px; border:1px solid #d0d5de; vertical-align:top; word-break:break-word; min-width:120px; border-radius:5px;
}
.schedule-table thead th{
  position:sticky; top:0; background:#001f4d; color:#fff;
  border-bottom:2px solid #003366; z-index:2; text-align:center;
}
.schedule-table thead th:first-child{ background:#001a40; }
.schedule-table tbody tr:nth-child(even) td{ background:#e6f0ff; }

/* Drop highlighting */
.board-cell.valid-drop{ background-color:#e0ffe0 !important; }
.board-cell.conflict{ background-color:#ffe0e0 !important; }

/* Placed magnet styling */
.placed-magnet{
  background-color:#edf2ff; border:1px solid #a3bffa; border-radius:5px;
  padding:4px 6px; margin-bottom:4px; display:flex; justify-content:space-between; align-items:center;
  font-family:'Avenir', Arial, sans-serif !important; font-size:.85em !important;
}
.placed-magnet .magnet-label,
.placed-magnet span,
.placed-magnet .magnet-course-id{
  font-family:'Avenir', Arial, sans-serif !important; font-size:.85em !important;
}

/* ---------- Shared tables (for list pages) ---------- */
.tableWrap{
  overflow:auto; border:1px solid var(--ui); border-radius:10px; max-height:75vh; background:#fff;
}
@media (min-width: 1200px){
  .tableWrap{ max-height:80vh; }
}
table{ width:100%; border-collapse:separate; border-spacing:0; background:#fff; }
th, td{ border-bottom:1px solid #f1f5f9; padding:10px 12px; text-align:left; white-space:nowrap; }

/* Primary sticky header row (navy / white) */
thead tr.header1 th,
thead tr.thead-primary th{
  position:sticky; top:0; z-index:3;
  background:var(--thead-primary-bg); color:var(--thead-primary-ink);
  box-shadow:0 2px 0 rgba(0,0,0,.18);
}

/* Secondary sticky header (mass-update controls) */
thead tr.header2 th,
thead tr.thead-secondary th{
  position:sticky; top:44px; z-index:2;
  background:var(--thead-secondary-bg); color:var(--thead-secondary-ink);
  border-bottom:1px solid rgba(0,0,0,.15);
}

/* Zebra rows for shared tables */
tbody tr:nth-child(even){ background:var(--row-alt); }

/* Header-row inline controls */
.hdr-controls{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.hdr-note{ font-size:.8rem; opacity:.85; }

/* CourseID links (courselist) */
a.courseid-link{ color:#0f3b8f; font-weight:700; text-decoration:none; }
a.courseid-link:hover{ text-decoration:underline; }

/* Semester badges (courselist) */
td.sem-badge{ font-weight:600; }
.sem-F{ color:#92400e; }  /* Fall */
.sem-S{ color:#065f46; }  /* Spring */
.sem-Y{ color:#334155; }  /* Year/default */

/* Dialog base (mapping dialogs) */
dialog{ border:none; border-radius:12px; padding:0; max-width:640px; width:90vw; background:#fff; }
.dlg{ display:flex; flex-direction:column; gap:10px; padding:14px; }
.dlg header{ display:flex; align-items:center; gap:8px; }
.dlg h2{ margin:0; font-size:1.1rem; }
.dlg .list{ border:1px solid var(--ui); border-radius:10px; padding:8px; max-height:50vh; overflow:auto; background:#fff; }
.dlg .row{ display:grid; grid-template-columns:1fr 190px; gap:10px; align-items:center; padding:6px 4px; border-bottom:1px dashed #eef2f7; }
.dlg .row:last-child{ border-bottom:none; }
.kbd{ font-family:ui-monospace, SFMono-Regular, Menlo, monospace; background:#f3f4f6; border:1px solid #e5e7eb; border-radius:6px; padding:2px 6px; }