/* =============================================
   SwayMind – Main Stylesheet
   ============================================= */

:root {
  --bg:       #0f1117;
  --bg2:      #161b27;
  --bg3:      #1e2536;
  --border:   #2a3045;
  --text:     #e8eaf0;
  --text-muted: #8892a4;
  --primary:  #6366f1;
  --primary-dark: #4f52d4;
  --green:    #10b981;
  --yellow:   #f59e0b;
  --red:      #ef4444;
  --blue:     #3b82f6;
  --radius:   10px;
  --radius-lg: 16px;
  --shadow:   0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- NAVBAR ---- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 60px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand { display: flex; align-items: center; gap: 8px; }
.logo-icon  { height: 150px;
  width: auto;
  object-fit: contain; 
}
.logo-text  { font-weight: 700; font-size: 18px; color: var(--text); }
.nav-badge  { font-size: 11px; background: var(--primary); color: #fff;
               padding: 2px 8px; border-radius: 99px; font-weight: 600; }
.nav-links  { display: flex; align-items: center; gap: 6px; }
.nav-link   { color: var(--text-muted); padding: 6px 12px; border-radius: var(--radius);
               font-size: 14px; transition: var(--transition); }
.nav-link:hover, .nav-link.active { background: var(--bg3); color: var(--text); text-decoration: none; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--radius); border: none; cursor: pointer;
  font-size: 14px; font-weight: 500; font-family: 'Inter', sans-serif;
  transition: var(--transition); text-decoration: none; line-height: 1;
}
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary{ background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); text-decoration: none; }
.btn-ghost    { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg3); text-decoration: none; }
.btn-full     { width: 100%; }
.btn-lg       { padding: 12px 24px; font-size: 16px; }
.btn-sm       { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- MAIN CONTENT ---- */
.main-content { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }
.page-header  { margin-bottom: 28px; }
.page-header h2 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.section-title { font-size: 18px; font-weight: 600; margin: 28px 0 16px; }

/* ---- CARD ---- */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-body  { padding: 24px; }
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 12px; justify-content: flex-end;
}

/* ---- GRIDS ---- */
.card-grid { display: grid; gap: 16px; margin-bottom: 20px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .cols-4, .cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr; }
}

/* ---- ACTION CARDS ---- */
.action-card {
  display: block; padding: 24px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); transition: var(--transition);
  text-decoration: none; color: var(--text);
}
.action-card:hover { border-color: var(--primary); transform: translateY(-2px);
                     box-shadow: var(--shadow); text-decoration: none; }
.action-card.accent { border-color: var(--primary); background: rgba(99,102,241,0.08); }
.action-icon  { font-size: 32px; margin-bottom: 12px; }
.action-title { font-weight: 600; font-size: 16px; margin-bottom: 6px; }
.action-desc  { font-size: 13px; color: var(--text-muted); }

/* ---- STAT CARDS ---- */
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; text-align: center;
}
.stat-card.accent-red    { border-color: rgba(239,68,68,0.4); }
.stat-card.accent-yellow { border-color: rgba(245,158,11,0.4); }
.stat-card.accent-green  { border-color: rgba(16,185,129,0.4); }
.stat-icon  { font-size: 28px; margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 700; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ---- BADGES ---- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
}
.badge-gray   { background: rgba(255,255,255,0.08); color: var(--text-muted); }
.badge-green  { background: rgba(16,185,129,0.15);  color: var(--green); }
.badge-blue   { background: rgba(59,130,246,0.15);  color: var(--blue); }
.badge-yellow { background: rgba(245,158,11,0.15);  color: var(--yellow); }
.badge-red    { background: rgba(239,68,68,0.15);   color: var(--red); }

/* ---- SCORES ---- */
.score-grid  { display: flex; flex-direction: column; gap: 14px; }
.score-item  { display: grid; grid-template-columns: 160px 1fr 80px; align-items: center; gap: 12px; }
.score-label { font-size: 14px; font-weight: 500; }
.score-bar-wrap { background: var(--bg3); border-radius: 99px; height: 8px; overflow: hidden; }
.score-bar   { height: 100%; border-radius: 99px; transition: width 0.6s ease; }
.score-value { font-size: 13px; font-weight: 600; text-align: right; }
.text-green  { color: var(--green); }
.text-yellow { color: var(--yellow); }
.text-red    { color: var(--red); }

/* ---- REFERRAL CARDS ---- */
.referral-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.referral-card.severity-severe   { border-left: 4px solid var(--red); }
.referral-card.severity-moderate { border-left: 4px solid var(--yellow); }
.referral-card.severity-mild     { border-left: 4px solid var(--blue); }
.referral-card.severity-minimal  { border-left: 4px solid var(--green); }
.referral-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; gap: 8px; }
.referral-condition { font-size: 12px; color: var(--text-muted); margin-left: 8px; }
.referral-type-icon { font-size: 28px; }
.referral-type { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.referral-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 500;
                    color: var(--text-muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=datetime-local], textarea, select {
  width: 100%; padding: 10px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 14px; font-family: 'Inter', sans-serif;
  transition: var(--transition);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ---- AUTH ---- */
.auth-body { background: var(--bg); display: flex; align-items: center;
             justify-content: center; min-height: 100vh; }
.auth-container { width: 100%; max-width: 460px; padding: 24px; }
.auth-card { background: var(--bg2); border: 1px solid var(--border);
             border-radius: var(--radius-lg); padding: 40px; }
.auth-card.wide { max-width: 560px; margin: 0 auto; }
.auth-brand { text-align: center; margin-bottom: 28px; }
.logo-icon-lg { font-size: 48px; display: block; margin-bottom: 8px; }
.auth-brand h1 { font-size: 28px; font-weight: 700; }
.auth-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.auth-footer { text-align: center; font-size: 14px; color: var(--text-muted); margin-top: 20px; }

.tab-switcher { display: flex; background: var(--bg3); border-radius: var(--radius);
                padding: 4px; margin-bottom: 24px; }
.tab-btn { flex: 1; padding: 8px; background: none; border: none; color: var(--text-muted);
           border-radius: 7px; cursor: pointer; font-size: 14px; font-weight: 500;
           transition: var(--transition); }
.tab-btn.active { background: var(--bg2); color: var(--text);
                  box-shadow: 0 1px 4px rgba(0,0,0,0.3); }

/* ---- MESSAGES ---- */
.error-msg   { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
               color: #fca5a5; padding: 10px 14px; border-radius: var(--radius);
               font-size: 14px; margin-top: 12px; }
.success-msg { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3);
               color: #6ee7b7; padding: 10px 14px; border-radius: var(--radius);
               font-size: 14px; margin-top: 12px; }
.info-banner { background: rgba(99,102,241,0.08); border: 1px solid rgba(99,102,241,0.2);
               border-radius: var(--radius); padding: 14px 18px;
               display: flex; gap: 12px; align-items: flex-start;
               font-size: 14px; margin-bottom: 20px; }
.info-banner-sm { padding: 10px 14px; font-size: 13px; }
.info-icon { font-size: 20px; flex-shrink: 0; }

/* ---- TABLES ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 600;
                  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
                  border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid rgba(42,48,69,0.5); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ---- STEP INDICATOR ---- */
.step-indicator { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.step { font-size: 13px; color: var(--text-muted); padding: 4px 10px;
        border-radius: 99px; background: var(--bg3); }
.step.active { background: rgba(99,102,241,0.15); color: var(--primary); font-weight: 600; }
.step.done   { background: rgba(16,185,129,0.1); color: var(--green); }
.step-arrow  { color: var(--text-muted); font-size: 12px; }

/* ---- DISORDER SLIDERS ---- */
.disorders-grid { display: flex; flex-direction: column; gap: 20px; }
.disorder-row {
  display: grid; grid-template-columns: 220px 1fr 100px;
  align-items: center; gap: 20px;
  padding: 16px; background: var(--bg3); border-radius: var(--radius); border: 1px solid var(--border);
}
.disorder-meta { display: flex; align-items: center; gap: 12px; }
.disorder-icon { font-size: 28px; }
.disorder-name { font-weight: 600; font-size: 15px; }
.disorder-desc { font-size: 12px; color: var(--text-muted); }
.disorder-slider-wrap { display: flex; flex-direction: column; gap: 6px; }
.disorder-slider {
  -webkit-appearance: none; width: 100%; height: 6px;
  background: linear-gradient(to right, var(--primary) var(--val, 0%), var(--bg) var(--val, 0%));
  border-radius: 3px; outline: none;
}
.disorder-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  background: var(--primary); border-radius: 50%; cursor: pointer;
  box-shadow: 0 0 6px rgba(99,102,241,0.5);
}
.slider-labels { display: flex; justify-content: space-between;
                 font-size: 11px; color: var(--text-muted); }

/* ---- QUESTIONNAIRE ---- */
.disorder-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.disorder-tab {
  padding: 6px 14px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 99px; color: var(--text-muted); font-size: 13px; cursor: pointer;
  transition: var(--transition);
}
.disorder-tab.active { background: rgba(99,102,241,0.15); border-color: var(--primary); color: var(--primary); }
.disorder-tab.complete { border-color: var(--green); color: var(--green); }
.disorder-tab.complete::after { content: ' ✓'; }
.instructions { font-style: italic; color: var(--text-muted); margin-bottom: 20px; font-size: 14px; }
.questions-list { display: flex; flex-direction: column; gap: 24px; }
.question-item { border-bottom: 1px solid var(--border); padding-bottom: 20px; }
.question-item:last-child { border-bottom: none; }
.question-text { margin-bottom: 12px; font-size: 15px; }
.answer-options { display: flex; flex-wrap: wrap; gap: 8px; }
.answer-option {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 99px;
  cursor: pointer; font-size: 13px; transition: var(--transition);
  background: var(--bg3);
}
.answer-option input[type=radio] { display: none; }
.answer-option:hover { border-color: var(--primary); }
.answer-option.selected { border-color: var(--primary); background: rgba(99,102,241,0.15); color: var(--primary); }

/* ---- CONTACTS / FOLLOWUP ---- */
.two-col-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 800px) { .two-col-layout { grid-template-columns: 1fr; } }
.contact-list { display: flex; flex-direction: column; gap: 2px; max-height: 400px; overflow-y: auto; }
.contact-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--radius); cursor: pointer;
  transition: var(--transition);
}
.contact-item:hover { background: var(--bg3); }
.contact-item input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.contact-info { flex: 1; }
.contact-name { font-weight: 500; }
.selected-count { font-size: 13px; color: var(--text-muted); padding-top: 12px;
                  border-top: 1px solid var(--border); margin-top: 8px; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 200;
}
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 90%; max-width: 680px; max-height: 85vh; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); z-index: 201;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg2);
}
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; }
.modal-body { padding: 24px; }
.modal-section { margin-bottom: 24px; }
.modal-section h4 { font-size: 14px; font-weight: 600; color: var(--text-muted); margin-bottom: 10px; text-transform: uppercase; }

/* ---- SETTINGS ---- */
.clinic-code-box {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--bg3); padding: 12px 20px; border-radius: var(--radius);
  border: 1px solid var(--border); font-family: monospace; font-size: 20px; font-weight: 700;
  color: var(--primary); letter-spacing: 3px;
}
.calendar-instructions {
  background: var(--bg3); border-radius: var(--radius); padding: 16px 20px; margin-top: 16px;
}
.calendar-instructions h4 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.calendar-instructions ol { padding-left: 20px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.calendar-instructions code {
  background: var(--border); padding: 2px 7px; border-radius: 4px; font-family: monospace; font-size: 13px;
}

/* ---- INFO GRID ---- */
.info-grid { display: grid; gap: 20px; }
.info-item { text-align: center; }
.info-icon  { font-size: 32px; margin-bottom: 10px; }
.info-title { font-weight: 600; margin-bottom: 4px; }
.info-desc  { font-size: 13px; color: var(--text-muted); }

/* ---- SCREENING ---- */
.screen-icon { font-size: 56px; margin-bottom: 16px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.status-dot.active { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ---- MIC INSTRUCTIONS ---- */
.mic-steps { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.mic-step-group {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
}
.mic-step-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 15px; }
.mic-browser-icon { font-size: 20px; }
.mic-step-list { padding-left: 20px; font-size: 14px; color: var(--text-muted);
                  display: flex; flex-direction: column; gap: 5px; }
.mic-step-list strong { color: var(--text); }

/* ---- UTILITY ---- */
.hidden       { display: none !important; }
.center       { text-align: center; }
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 13px; }
.mt-sm        { margin-top: 8px; }
.mt-md        { margin-top: 16px; }
.mt-lg        { margin-top: 28px; }
.loading      { text-align: center; color: var(--text-muted); padding: 24px; }
.action-row   { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.flags-section { margin-top: 20px; }
.flags-section h4 { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.summary-box  { background: var(--bg3); border-radius: var(--radius); padding: 14px; margin-top: 16px; }
.summary-box h4 { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.empty-state  { text-align: center; padding: 60px 24px; }
.empty-state.small { padding: 24px; }
.empty-icon   { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; }
.empty-state p  { color: var(--text-muted); margin-bottom: 20px; }
.search-input { padding: 7px 14px; background: var(--bg3); border: 1px solid var(--border);
                border-radius: var(--radius); color: var(--text); font-size: 13px; width: 220px; }
.search-input:focus { outline: none; border-color: var(--primary); }
