/* Workspace — shared left nav for app.html, thread.html */

/* ── Layout shell ─────────────────────────────────────────── */

.ws-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Nav rail ─────────────────────────────────────────────── */

.ws-nav {
  width: 240px;
  flex-shrink: 0;
  height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
  z-index: 10;
  transition: width 0.2s ease;
}

.ws-nav.collapsed { width: 60px; }

/* ── Firm header ──────────────────────────────────────────── */

.ws-firm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}

.ws-firm-body {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

/* Small circular mark shown in both states; full name shown only when expanded */
.ws-firm-mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  font-style: italic;
  color: var(--navy);
  flex-shrink: 0;
}

.ws-firm-info {
  min-width: 0;
  transition: opacity 0.15s;
}

.ws-firm-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.ws-firm-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

.ws-firm-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* Admin portal icon button in firm header */
.ws-admin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.ws-admin-btn:hover {
  background: var(--cream);
  color: var(--navy);
}

/* Collapse / expand toggle */
.ws-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}

.ws-collapse-btn:hover {
  background: var(--cream);
  color: var(--navy);
}

.ws-collapse-btn svg {
  transition: transform 0.2s ease;
}

.ws-nav.collapsed .ws-collapse-btn svg { transform: rotate(180deg); }

/* ── Collapsed hiding rules ───────────────────────────────── */

.ws-nav.collapsed .ws-firm-info { display: none; }
.ws-nav.collapsed .ws-section { display: none; }
.ws-nav.collapsed .ws-item-label { display: none; }
.ws-nav.collapsed .ws-footer-user { display: none; }
.ws-nav.collapsed .ws-footer-link span { display: none; }
.ws-nav.collapsed .ws-new-thread span { display: none; }
.ws-nav.collapsed .ws-thread-del { display: none; }
.ws-nav.collapsed .ws-admin-btn { display: none; }

.ws-nav.collapsed .ws-item {
  padding: 9px 0;
  justify-content: center;
  border-left-color: transparent !important;
}

.ws-nav.collapsed .ws-home {
  padding: 9px 0;
  justify-content: center;
  border-left-color: transparent !important;
}

.ws-nav.collapsed .ws-new-thread {
  padding: 9px 0;
  justify-content: center;
  width: 100%;
  margin: 0;
}

.ws-nav.collapsed .ws-footer-link {
  padding: 9px 0;
  justify-content: center;
}

.ws-nav.collapsed .ws-thread-row {
  border-left: none;
}

/* ── Nav body ─────────────────────────────────────────────── */

.ws-nav-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.ws-nav-body::-webkit-scrollbar { width: 3px; }
.ws-nav-body::-webkit-scrollbar-track { background: transparent; }
.ws-nav-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Home link ────────────────────────────────────────────── */

.ws-home {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  border-left: 3px solid transparent;
}

.ws-home:hover,
.ws-home.active {
  background: var(--cream);
  color: var(--navy);
}

.ws-home.active { border-left-color: var(--navy); }

.ws-home svg { flex-shrink: 0; opacity: 0.6; }

/* ── Section labels ───────────────────────────────────────── */

.ws-section {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 16px 4px;
  user-select: none;
}

/* ── Nav items ────────────────────────────────────────────── */

.ws-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  border-left: 3px solid transparent;
  min-width: 0;
  font-family: 'DM Sans', sans-serif;
}

.ws-item:hover {
  background: var(--cream);
  color: var(--navy);
}

.ws-item.active {
  background: var(--cream);
  color: var(--navy);
  border-left-color: var(--navy);
  font-weight: 500;
}

/* Small avatar (22px) */
.ws-avatar {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: var(--navy-light);
  color: var(--cream);
  font-size: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
  overflow: hidden;
  letter-spacing: 0.03em;
}

.ws-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 5px;
  display: block;
}

.ws-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* ── Thread row ───────────────────────────────────────────── */

.ws-thread-row {
  display: flex;
  align-items: center;
  border-left: 3px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}

.ws-thread-row:hover { background: var(--cream); }
.ws-thread-row.active {
  background: var(--cream);
  border-left-color: var(--navy);
}

.ws-thread-row .ws-item {
  flex: 1;
  min-width: 0;
  border-left: none;
  padding-left: 13px;
}

.ws-thread-row .ws-item:hover { background: none; }
.ws-thread-row.active .ws-item { color: var(--navy); font-weight: 500; }

.ws-thread-del {
  flex-shrink: 0;
  padding: 5px 10px 5px 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s;
  display: flex;
  align-items: center;
  border-radius: 4px;
}

.ws-thread-row:hover .ws-thread-del { opacity: 1; }
.ws-thread-del:hover { color: #c0392b; }

/* ── New Thread button ────────────────────────────────────── */

.ws-new-thread {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  color: var(--text-muted);
  font-size: 12px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.1s, color 0.1s;
  border-left: 3px solid transparent;
}

.ws-new-thread:hover {
  background: var(--cream);
  color: var(--navy);
}

.ws-new-thread svg { flex-shrink: 0; }

/* ── Footer ───────────────────────────────────────────────── */

.ws-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 6px 0 8px;
}

.ws-footer-user {
  padding: 6px 16px 8px;
}

.ws-footer-user-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-footer-user-email {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.ws-footer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  color: var(--text-muted);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  background: none;
  border: none;
  font-family: 'DM Sans', sans-serif;
  width: 100%;
  text-align: left;
  border-left: 3px solid transparent;
}

.ws-footer-link:hover {
  background: var(--cream);
  color: var(--navy);
}

.ws-footer-link svg { flex-shrink: 0; opacity: 0.6; }

/* ── New Thread Modal ─────────────────────────────────────── */

.ws-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,39,68,0.55);
  backdrop-filter: blur(3px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ws-modal {
  background: #fff;
  border-top: 3px solid var(--navy);
  padding: 28px 32px 24px;
  width: 420px;
  max-width: 92vw;
  border-radius: 2px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.22);
}

.ws-modal h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 20px;
}

.ws-modal-field { margin-bottom: 14px; }

.ws-modal-field label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.ws-modal-field input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.ws-modal-field input[type="text"]:focus { border-color: var(--navy); }

.ws-emp-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
}

.ws-emp-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}

.ws-emp-option:hover { background: var(--cream); }
.ws-emp-option.sel { background: var(--cream-dark); }

.ws-emp-option-av {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--navy);
  color: var(--cream);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  overflow: hidden;
  flex-shrink: 0;
}

.ws-emp-option-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.ws-emp-option-info { flex: 1; min-width: 0; }
.ws-emp-option-name { font-size: 13px; font-weight: 500; color: var(--text); }
.ws-emp-option-role { font-size: 11px; color: var(--text-muted); }

.ws-emp-option-chk {
  color: var(--navy);
  flex-shrink: 0;
  display: none;
}

.ws-emp-option.sel .ws-emp-option-chk { display: block; }

.ws-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

.ws-modal-cancel {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  color: var(--text-muted);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background 0.1s;
}

.ws-modal-cancel:hover { background: var(--cream); }

.ws-modal-create {
  padding: 8px 16px;
  border: none;
  border-radius: 3px;
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background 0.15s;
}

.ws-modal-create:hover { background: var(--navy-mid); }

/* ── Skeleton ─────────────────────────────────────────────── */

.ws-skel {
  height: 16px;
  border-radius: 3px;
  background: rgba(0,0,0,0.05);
  margin: 4px 16px;
  animation: wsFade 1.4s ease-in-out infinite alternate;
}

@keyframes wsFade {
  from { opacity: 0.5; }
  to { opacity: 1; }
}
