/*
 * rightcortex.css
 * Shared design system for all Cortex modules
 * Claytan Ceramic (Australia) Pty Ltd — Internal Platform
 * Updated: May 2026
 */

/* ── DESIGN TOKENS ──────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:       #07090c;
  --card:     #0d1216;
  --card2:    #080e14;

  /* Borders */
  --border:   #1a2530;
  --border2:  #111820;

  /* Brand */
  --cyan:     #00d4ff;

  /* Text */
  --text:     #e8eef2;
  --silver:   #9eadb5;
  --muted:    #5a6a75;
  --dim:      #3a4a55;

  /* Semantic */
  --red:      #ff4d4d;
  --orange:   #ff8c42;
  --green:    #00ff87;
  --gold:     #ffaa00;
  --purple:   #a78bfa;

  /* Module colours */
  --compass:    #00cc6a;
  --atlas:      #4da6ff;
  --voyage:     #ffaa00;
  --horizon:    #a78bfa;
  --lighthouse: #ffd700;
  --inbox:      #a78bfa;

  /* Typography */
  --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* Radius */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;
  --r-xl:  16px;
  --r-pill: 999px;
}

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

/* ── BASE TYPOGRAPHY ─────────────────────────────────────────── */
html, body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Type scale */
h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.2; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.25; }
h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.2px; }
h4 { font-size: 15px; font-weight: 600; }
h5 { font-size: 13px; font-weight: 600; }
h6 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

p  { font-size: 15px; line-height: 1.6; color: var(--silver); }
small { font-size: 12px; color: var(--muted); }

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

/* ── FORM ELEMENTS ───────────────────────────────────────────── */
input, select, textarea, button {
  font-family: var(--font);
  font-size: 14px;
}

input, select, textarea {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  padding: 9px 12px;
  width: 100%;
  transition: border-color 0.15s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--cyan);
}

input::placeholder, textarea::placeholder {
  color: var(--dim);
}

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  transition: all 0.15s;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 9px 18px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--cyan);
  color: #07090c;
  border-color: var(--cyan);
  font-weight: 700;
}
.btn-primary:hover { background: #00aacc; }

.btn-ghost {
  background: none;
  color: var(--muted);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--silver); }

.btn-danger {
  background: none;
  color: var(--red);
  border-color: var(--red);
}
.btn-danger:hover { background: #ff4d4d22; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-cyan    { background: #00d4ff22; color: var(--cyan);   border-color: #00d4ff44; }
.badge-green   { background: #00ff8722; color: var(--green);  border-color: #00ff8744; }
.badge-red     { background: #ff4d4d22; color: var(--red);    border-color: #ff4d4d44; }
.badge-orange  { background: #ff8c4222; color: var(--orange); border-color: #ff8c4244; }
.badge-purple  { background: #a78bfa22; color: var(--purple); border-color: #a78bfa44; }
.badge-muted   { background: var(--card2); color: var(--muted); border-color: var(--border); }

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
}

.card-sm { padding: var(--sp-3); border-radius: var(--r-md); }
.card-lg { padding: var(--sp-5); border-radius: var(--r-xl); }

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-overlay, .modal-ov {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: var(--sp-4);
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--sp-5);
  position: relative;
}

.modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  gap: var(--sp-3);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }

.modal-body  { margin-bottom: var(--sp-4); }
.modal-footer {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

/* ── TOAST ───────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 16px;
  font-size: 13px;
  color: var(--text);
  z-index: 200;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.25s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
#shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

#sidebar {
  width: 200px;
  min-width: 200px;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

.sb-logo {
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--border);
}

.sb-logo-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--cyan);
  letter-spacing: -0.5px;
}

.sb-logo-sub {
  font-size: 9px;
  color: var(--dim);
  letter-spacing: 0.1em;
  margin-top: 1px;
}

.sb-section {
  padding: 14px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  margin: 1px 6px;
  color: var(--silver);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: calc(100% - 12px);
  text-align: left;
  line-height: 1.4;
}

.sb-item:hover { background: var(--card2); color: var(--text); }
.sb-item.active { background: #0a1929; color: var(--cyan); font-weight: 500; }

.sb-count {
  margin-left: auto;
  font-size: 10px;
  background: #1a2530;
  padding: 1px 7px;
  border-radius: 10px;
  color: var(--silver);
}

/* ── HEADER ──────────────────────────────────────────────────── */
#header {
  height: 52px;
  min-height: 52px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
}

/* ── CONTENT AREA ────────────────────────────────────────────── */
#mainArea {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

#content {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ── LIST ROWS ───────────────────────────────────────────────── */
.list-wrap { padding: 16px; }

.page-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.page-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.4;
}

.list-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.15s;
}
.list-row:hover { border-color: var(--muted); }

.sec-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 16px 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 14px;
}

.empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ── AVATAR ──────────────────────────────────────────────────── */
.av {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}

.av-sm { width: 18px; height: 18px; font-size: 8px; }
.av-lg { width: 32px; height: 32px; font-size: 12px; }

/* ── FORM LAYOUT ─────────────────────────────────────────────── */
.form-row  { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── DIVIDER ─────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-4) 0;
}

/* ── WORDMARK ────────────────────────────────────────────────── */
.wm-light { font-weight: 300; color: #8aa0ae; }
.wm-bold  { font-weight: 800; color: var(--cyan); }

/* ── SCROLLBAR ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── UTILITY ─────────────────────────────────────────────────── */
.text-cyan   { color: var(--cyan); }
.text-muted  { color: var(--muted); }
.text-silver { color: var(--silver); }
.text-red    { color: var(--red); }
.text-green  { color: var(--green); }
.text-orange { color: var(--orange); }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

.fs-10 { font-size: 10px; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-15 { font-size: 15px; }
.fs-16 { font-size: 16px; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only  { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
