/* ============================================================
   MedCrypto — Stylesheet
   Aesthetic: Clinical dark, monospace data, clean borders
   Fonts: DM Mono (data/labels) + DM Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500;600&display=swap');

/* --- Variables --- */
:root {
  --bg:        #0d1117;
  --bg-card:   #161b22;
  --bg-input:  #1c2128;
  --border:    #30363d;
  --border-hi: #58a6ff;
  --text:      #e6edf3;
  --text-muted:#8b949e;
  --text-dim:  #484f58;
  --accent:    #58a6ff;
  --accent-dim:#1f3a5f;
  --green:     #3fb950;
  --green-dim: #0f2b14;
  --red:       #f85149;
  --amber:     #d29922;
  --mine-bg:   #1a3a5c;
  --mine-border:#58a6ff;
  --their-bg:  #1c2128;
  --their-border:#30363d;
  --radius:    8px;
  --radius-lg: 12px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

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

/* --- Layout containers --- */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Navbar --- */
.navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar-brand {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  color: var(--accent);
  letter-spacing: .03em;
}
.navbar-brand span { color: var(--text-muted); }
.navbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.role-badge {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--border-hi);
}
.role-badge.dokter { background: #0f2b14; color: var(--green); border-color: var(--green); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-decoration: none;
}
.btn:hover { background: #2d333b; border-color: var(--text-muted); text-decoration: none; color: var(--text); }
.btn-primary { background: var(--accent-dim); border-color: var(--border-hi); color: var(--accent); }
.btn-primary:hover { background: #163356; color: var(--accent); }
.btn-danger  { background: #2d1010; border-color: var(--red); color: var(--red); }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
label {
  display: block;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
input[type="text"], input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
input:focus { border-color: var(--accent); }
.form-error {
  font-size: 13px;
  color: var(--red);
  margin-top: 12px;
  padding: 10px 14px;
  background: #2d1010;
  border: 1px solid var(--red);
  border-radius: var(--radius);
}

/* --- Login page --- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
}
.login-logo {
  font-family: 'DM Mono', monospace;
  font-size: 20px;
  color: var(--accent);
  margin-bottom: 4px;
}
.login-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.demo-hint {
  margin-top: 20px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.8;
}

/* --- Dashboard --- */
.page-header {
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.page-title {
  font-size: 20px;
  font-weight: 500;
}
.page-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}
.consult-list { display: flex; flex-direction: column; gap: 12px; }
.consult-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color .15s;
}
.consult-card:hover { border-color: var(--accent); }
.consult-info {}
.consult-id {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.consult-partner {
  font-weight: 500;
  font-size: 15px;
}
.consult-enc {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--green);
  margin-top: 3px;
}

/* --- Chat room --- */
.chat-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 49px); /* navbar height */
}
.chat-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chat-header-info {}
.chat-partner { font-weight: 500; font-size: 15px; }
.chat-consult-id {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
}
.crypto-status {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
}
.status-info    { background: var(--accent-dim); color: var(--accent); }
.status-success { background: var(--green-dim);  color: var(--green); border: 1px solid var(--green); }
.status-danger  { background: #2d1010; color: var(--red); border: 1px solid var(--red); }

#messages-box {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#messages-box::-webkit-scrollbar { width: 4px; }
#messages-box::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.msg-bubble {
  max-width: 68%;
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid;
}
.msg-bubble.mine {
  align-self: flex-end;
  background: var(--mine-bg);
  border-color: var(--mine-border);
}
.msg-bubble.theirs {
  align-self: flex-start;
  background: var(--their-bg);
  border-color: var(--their-border);
}
.bubble-sender {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.bubble-text {
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.bubble-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  justify-content: flex-end;
}
.bubble-time {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
}
.bubble-cipher {
  font-size: 11px;
  cursor: help;
  opacity: .7;
}

.chat-input-area {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}
#msg-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  resize: none;
  transition: border-color .15s;
}
#msg-input:focus { border-color: var(--accent); }
#send-btn {
  padding: 10px 20px;
  background: var(--accent-dim);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  color: var(--accent);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
#send-btn:hover { background: #163356; }

/* --- Misc --- */
.empty-state {
  text-align: center;
  padding: 48px 0;
  color: var(--text-muted);
  font-size: 14px;
}
