:root {
  --bg: #f0f2f5;
  --panel: #ffffff;
  --muted: #64748b;
  --text: #1e293b;
  --accent: #0f172a; /* Darker accent for high tech feel */
  --border: #cbd5e1;
  --radius: 0px; /* Sharp corners */
  --primary-red: #8C1515; /* Stanford Red for login */
}

* { box-sizing: border-box; }
html, body { margin:0; height:100%; background:var(--bg); color:var(--text); font: 14px/1.5 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }

.topbar {
  position: sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 16px; background:#8C1515; border-bottom:1px solid #731010; color: white;
}
.topbar h1 { margin:0; font-size:18px; font-weight:600; text-transform: uppercase; letter-spacing: 0.5px; }
.auth { display:flex; align-items:center; gap:10px; }
.muted { color:var(--muted); }

/* --- CUSTOM STYLES REQUESTED --- */
#user-label {
  color: white !important;
}

#submit {
  background-color: #b91c1c !important; /* Red */
  color: white !important;
}
/* ------------------------------- */

.icon-btn { border:1px solid var(--border); background:#fff; padding:6px 10px; border-radius:var(--radius); cursor:pointer; }

/* Login Modal - Replaces Popover */
#login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-box {
    background: white;
    padding: 30px;
    border-radius: 0; /* Sharp corners */
    width: 300px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    text-align: center;
    border: 1px solid #999;
}

.login-box h2 { margin-top: 0; color: var(--primary-red); }
.login-box input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 0; /* Sharp corners */
}
.login-box button {
    width: 100%;
    padding: 10px;
    background: var(--primary-red);
    color: white;
    border: none;
    border-radius: 0; /* Sharp corners */
    cursor: pointer;
    font-weight: bold;
}
.login-box button:hover { background: #b71c1c; }
.error-msg { color: red; font-size: 0.9em; margin-top: 10px; display: none; }


.hidden { display:none !important; }
.row { display:flex; flex-direction:column; gap:6px; margin-bottom:10px; }
.row.actions { flex-direction:row; gap:8px; justify-content:flex-end; margin-top:12px; align-items: center; }
#demo-btn { margin-right: auto; }
.error { color:#b91c1c; font-size:13px; min-height:16px; }

/* FIX: Removing fixed height to allow content to dictate height */
.wrap { max-width: 1220px; margin:24px auto; padding:0 12px; min-height: calc(100vh - 100px); }        
.card { background:var(--panel); border:1px solid var(--border); border-radius:var(--radius); padding:12px; }
textarea { width:100%; min-height:180px; border:1px solid var(--border); border-radius:var(--radius); padding:10px; resize: vertical; font-family: inherit; }

.btn {
  border:0; background:var(--accent); color:#fff;
  padding: 6px 14px; /* Reduced from 8px 16px */
  font-size: 12px; /* Reduced from 13px */
  border-radius:var(--radius); cursor:pointer; font-weight:600; text-transform: uppercase; letter-spacing: 0.5px;
  transition: all 0.2s ease;
}
.btn[disabled] { opacity:.6; cursor:not-allowed; }
.btn.secondary { background:#e2e8f0; color:#0f172a; }
.btn:hover:not([disabled]) { opacity: 0.9; transform: translateY(-1px); }

/* FIX: Removing fixed height from grid */
.grid { display:grid; grid-template-columns:1fr; gap:16px; }
@media (min-width: 840px) { .grid { grid-template-columns: 0.83fr 1fr 1.5fr; } }

.pane {
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:16px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.row.spaced { display:flex; justify-content:flex-start; align-items:center; gap:8px; flex-shrink: 0; margin-bottom: 12px; }
.row.spaced h3 { margin: 0; font-size: 14px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: 1px; }

.badge { font-size:10px; padding:2px 6px; border:1px solid var(--border); border-radius:var(--radius); text-transform: uppercase; }

/* Fonts unified */
.user-text, .copy-area {
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px; /* Reduced from 14px */
  padding: 12px;
  border-radius: var(--radius);
  overflow-y: auto;
  resize: none;
  border: 1px solid var(--border);
  line-height: 1.6;
}

.user-text { background-color: #fff; }
.copy-area { width:100%; flex-grow: 1; background-color: #f8fafc; }

/* Specific adjustment for Describe Tumor input to be shorter */
#report-input {
  flex-grow: 0;
  height: 269px;
  min-height: 150px;
  margin-bottom: 8px;
}

/* Image Grid */
.image-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.image-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  background: #fff;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s;
}
.image-item:hover { border-color: var(--accent); }

.image-item img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin-bottom: 6px;
  cursor: pointer;
  object-fit: cover;
  aspect-ratio: 1/1;
}

.image-caption {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.demo-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1200;
}

.demo-modal-card {
  width: min(920px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  padding: 14px;
}

.demo-close {
  flex-shrink: 0;
  margin-left: 12px;
}

.demo-image {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
}

.demo-caption {
  margin: 0;
  font-size: 14px;
}

.demo-caption-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
