/* ═══════════════════════════════════════════
   U: THE MIND COMPANY — CLINICAL TRIALS PORTAL
   Brand Design System — Adapted from uthemindcompany
   ═══════════════════════════════════════════ */

:root {
  --red: #E53E3E;
  --red-hover: #C53030;
  --red-light: #FED7D7;
  --blue: #3182CE;
  --blue-hover: #2B6CB0;
  --blue-light: #BEE3F8;
  --black: #1A202C;
  --white: #FFFFFF;
  --gray-50: #F7FAFC;
  --gray-100: #EDF2F7;
  --gray-200: #E2E8F0;
  --gray-400: #A0AEC0;
  --gray-600: #4A5568;
  --green: #38A169;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Avenir', 'Nunito Sans', -apple-system, sans-serif;
  color: var(--black);
  background: var(--white);
  line-height: 1.7;
  font-weight: 400;
}

/* ── Typography ── */
h1, h2, h3 { font-family: 'Instrument Serif', serif; color: var(--black); }
h1 { font-size: clamp(28px, 4vw, 48px); line-height: 1.1; margin-bottom: 16px; }
h2 { font-size: clamp(24px, 3vw, 36px); line-height: 1.2; margin-bottom: 16px; }
h3 { font-size: clamp(18px, 2vw, 24px); line-height: 1.3; margin-bottom: 12px; }
h4 {
  font-size: 14px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--blue); margin-bottom: 8px;
  font-family: 'Avenir', 'Nunito Sans', sans-serif;
}
h5 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
p { margin-bottom: 12px; color: var(--gray-600); }
b, strong { font-weight: 700; }
a { color: var(--blue); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--blue-hover); }
label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--black); font-size: 14px; }
li { color: var(--gray-600); margin-bottom: 4px; }

/* ── Buttons ── */
.btn-red {
  display: inline-block; padding: 12px 28px; background: var(--red); color: white;
  border: none; border-radius: 100px; font-weight: 800; font-size: 14px;
  cursor: pointer; text-decoration: none; transition: all 0.2s;
}
.btn-red:hover {
  background: var(--red-hover); transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(229,62,62,0.25);
}
.btn-blue {
  display: inline-block; padding: 12px 28px; background: var(--blue); color: white;
  border: none; border-radius: 100px; font-weight: 800; font-size: 14px;
  cursor: pointer; text-decoration: none; transition: all 0.2s;
}
.btn-blue:hover {
  background: var(--blue-hover); transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(49,130,206,0.25);
}
.btn-outline {
  display: inline-block; padding: 12px 28px; background: transparent;
  color: var(--blue); border: 1.5px solid var(--blue); border-radius: 100px;
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; transition: all 0.2s;
}
.btn-outline:hover { background: var(--blue-light); }
.btn-success {
  display: inline-block; padding: 12px 28px; background: var(--green); color: white;
  border: none; border-radius: 100px; font-weight: 800; font-size: 14px;
  cursor: pointer; text-decoration: none; transition: all 0.2s;
}
.btn-success:hover { background: #2F855A; transform: translateY(-2px); }
button:disabled, .btn-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* Gradient button (carried over — brand signature) */
.gradient-button {
  display: inline-block; padding: 12px 28px;
  background-image: linear-gradient(to right, #ef4444, #3b82f6);
  border: none; color: white; border-radius: 100px;
  font-weight: 800; font-size: 14px; cursor: pointer;
  text-decoration: none; transition: all 0.2s;
}
.gradient-button:hover { opacity: 0.9; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.section { padding: 64px 0; position: relative; }
.section-alt { background: var(--gray-50); }
.centered-narrow { max-width: 680px; margin: 0 auto; }
.row { display: flex; flex-wrap: wrap; gap: 20px; }

/* ── Cards ── */
.card {
  background: white; border-radius: 16px; padding: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06); transition: transform 0.2s;
  overflow: hidden;
}
.card:hover { transform: translateY(-2px); }
.card-header {
  padding: 20px 24px; border-bottom: 1px solid var(--gray-100);
  font-family: 'Instrument Serif', serif;
}
.card-header h3, .card-header h4, .card-header h5 { margin-bottom: 0; }
.card-body { padding: 24px; }
.card-footer { padding: 20px 24px; border-top: 1px solid var(--gray-100); }
.card-title { font-family: 'Instrument Serif', serif; font-size: 20px; margin-bottom: 4px; }

/* ── Form Controls ── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
textarea,
select {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--gray-400); border-radius: 10px;
  font-size: 14px; font-family: inherit; color: var(--black);
  background: var(--white); transition: border-color 0.2s;
  margin-bottom: 4px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(49,130,206,0.15);
}
.form-field { margin-bottom: 16px; }
.form-field label { margin-bottom: 6px; }

/* Checkbox styling */
.check-field {
  display: flex; align-items: flex-start; gap: 10px; margin: 12px 0;
}
.check-field input[type="checkbox"] {
  width: 18px; height: 18px; margin-top: 3px; accent-color: var(--blue);
  flex-shrink: 0;
}
.check-field label { display: inline; font-weight: 400; margin-bottom: 0; }

/* ── Navigation (matches uthemind) ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 48px;
  background: rgba(255,255,255,0.94); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--gray-100);
  transition: box-shadow 0.2s;
}
nav.scrolled { box-shadow: 0 4px 24px rgba(0,0,0,0.08); }
.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 16px; color: var(--black); text-decoration: none;
}
.logo-image {
  height: 36px;
  width: auto;
  object-fit: contain;
}
.logo-mark {
  width: 32px; height: 32px; border-radius: 8px; background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 16px; font-weight: 700; flex-shrink: 0;
}
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a {
  text-decoration: none; color: var(--gray-600); font-size: 14px;
  transition: color 0.2s; font-weight: 600;
}
.nav-links a:hover, .nav-links a.active { color: var(--blue); }
.nav-mobile-toggle { display: none; }

/* ── Sidebar (clinical-trials specific) ── */
.app-layout { display: flex; min-height: 100vh; padding-top: 60px; }
.sidebar {
  width: 240px; background: var(--black); color: white;
  padding: 24px 0; flex-shrink: 0; position: fixed; top: 60px; bottom: 0;
  overflow-y: auto; z-index: 50;
}
.sidebar-nav { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px; color: #CBD5E0; text-decoration: none;
  font-size: 14px; font-weight: 600; transition: all 0.2s;
}
.sidebar-nav li a:hover { background: rgba(255,255,255,0.08); color: white; }
.sidebar-nav li a.active { background: rgba(49,130,206,0.2); color: var(--blue-light); border-left: 3px solid var(--blue); }
.sidebar-nav li a i { width: 20px; text-align: center; font-size: 16px; }
.main-content { flex: 1; margin-left: 240px; min-height: calc(100vh - 60px); }

/* ── Footer ── */
footer {
  background: var(--black); color: white; padding: 32px 48px 20px;
  text-align: center; font-size: 13px;
}
footer p { color: var(--gray-400); margin-bottom: 4px; }
footer a { color: var(--blue-light); }

/* ── Dashboard ── */
.dashboard-container { padding: 32px; background: var(--gray-50); min-height: calc(100vh - 60px); }
.dashboard-container header h1 { margin-bottom: 24px; }
.card-grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: start;
}
.card-grid .full-width-card { grid-column: 1 / -1; }
.dashboard-card { border-radius: 16px; overflow: hidden; }
.timeline-card { border-left: 4px solid var(--blue); }
.daily-questionnaire-card { border-left: 4px solid var(--red); }
.support-contact-card { background: var(--gray-50); border: 1px dashed var(--gray-400); }

/* ── Page-level helpers ── */
.page-center { display: flex; justify-content: center; padding: 32px; }
.page-center .card { width: 100%; max-width: 680px; }
.page-wide { padding: 32px; max-width: 900px; margin: 0 auto; }
.three-card-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin: 24px 0; }

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); z-index: 1000; display: flex; justify-content: center; align-items: center; }
.modal-card { background: white; border-radius: 20px; padding: 32px; max-width: 520px; width: 90%; position: relative; }
.modal-card h3 { margin-bottom: 12px; }
.modal-close { position: absolute; top: 12px; right: 16px; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--gray-400); }

/* ── Blazor error UI ── */
#blazor-error-ui {
  background: #ffffe0; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2);
  display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; right: 0; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

.blazor-error-boundary {
  background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwy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── Responsive ── */
@media (max-width: 768px) {
  .three-card-row, .card-grid { grid-template-columns: 1fr; }
  .row { flex-direction: column; }
  nav { padding: 14px 20px; }
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .dashboard-container { padding: 20px; }
  .page-center { padding: 16px; }
  .container { padding: 0 16px; }
  footer { padding: 24px 20px 16px; }
  .nav-links { display: none; }
  .nav-mobile-toggle {
    display: flex; flex-direction: column; gap: 5px;
    background: none; border: none; cursor: pointer;
  }
  .nav-mobile-toggle span { width: 24px; height: 2px; background: var(--black); }
}

/* Loading spinner */
.loader {
  border: 4px solid var(--gray-100);
  border-top: 4px solid var(--blue);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
