/* ============================================================
   CARBOTURA ENGINEERING PORTAL — comments.css
   Comment drawer · FAB · Trade secret blocks · Thread styles
   ============================================================ */

/* ── Floating Action Button ────────────────────────────────── */
#comment-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 200;
}

.fab-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--c-navy);
  border: 2px solid var(--c-emerald);
  color: var(--c-white);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.fab-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0,182,122,0.3);
  border-color: var(--c-emerald);
  background: var(--c-navy-mid);
}

.fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--c-red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--c-white);
}

/* ── Section comment trigger button ────────────────────────── */
.section-comment-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.75rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--c-gray-200);
  color: var(--c-gray-300);
  font-size: 0.75rem;
  cursor: pointer;
  vertical-align: middle;
  transition: 150ms ease;
  opacity: 0;
}

.section-heading-1:hover .section-comment-btn,
.section-heading-2:hover .section-comment-btn,
.section-heading-3:hover .section-comment-btn,
.section-comment-btn:hover {
  opacity: 1;
  background: var(--c-emerald-pale);
  border-color: var(--c-emerald);
  color: var(--c-emerald-dim);
}

/* ── Comment Drawer ────────────────────────────────────────── */
#comment-drawer {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease;
}

#comment-drawer.open {
  pointer-events: all;
  opacity: 1;
}

.cmt-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 31, 53, 0.5);
  backdrop-filter: blur(2px);
}

.cmt-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(480px, 100vw);
  height: 100%;
  background: var(--c-white);
  box-shadow: -8px 0 32px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

#comment-drawer.open .cmt-drawer-panel {
  transform: translateX(0);
}

.cmt-drawer-header {
  background: var(--c-navy);
  color: var(--c-white);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 2px solid var(--c-emerald);
  flex-shrink: 0;
}

.cmt-drawer-title {
  font-size: 1rem;
  font-weight: 700;
}

.cmt-drawer-doc {
  font-size: 0.7rem;
  color: var(--c-emerald);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.cmt-drawer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cmt-btn-close {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--c-gray-300);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 150ms ease;
}

.cmt-btn-close:hover {
  background: rgba(255,255,255,0.1);
  color: var(--c-white);
}

/* ── Tabs ──────────────────────────────────────────────────── */
.cmt-tabs {
  display: flex;
  background: var(--c-gray-50);
  border-bottom: 1px solid var(--c-gray-200);
  flex-shrink: 0;
}

.cmt-tab {
  flex: 1;
  padding: 0.65rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--c-gray-400);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: 150ms ease;
  font-family: var(--font-sans);
}

.cmt-tab:hover { color: var(--c-navy); }

.cmt-tab.active {
  color: var(--c-navy);
  border-bottom-color: var(--c-emerald);
  background: var(--c-white);
}

/* ── Tab Content ───────────────────────────────────────────── */
.cmt-tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

.cmt-tab-content.active { display: block; }

/* ── Form fields ───────────────────────────────────────────── */
.cmt-field {
  margin-bottom: 0.875rem;
}

.cmt-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--c-gray-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}

.cmt-field input,
.cmt-field textarea,
.cmt-field select {
  width: 100%;
  border: 1px solid var(--c-gray-200);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  color: var(--c-text);
  background: var(--c-white);
  transition: 150ms ease;
  outline: none;
  box-sizing: border-box;
}

.cmt-field input:focus,
.cmt-field textarea:focus,
.cmt-field select:focus {
  border-color: var(--c-emerald);
  box-shadow: 0 0 0 3px rgba(0,182,122,0.1);
}

.cmt-field textarea { resize: vertical; min-height: 100px; }

.cmt-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* ── Buttons ───────────────────────────────────────────────── */
.cmt-btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: 150ms ease;
  border: 1px solid transparent;
}

.cmt-btn-primary {
  background: var(--c-emerald);
  color: var(--c-white);
  border-color: var(--c-emerald);
}

.cmt-btn-primary:hover { background: var(--c-emerald-dim); }
.cmt-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.cmt-btn-export {
  background: var(--c-navy-mid);
  color: var(--c-emerald);
  border-color: rgba(0,182,122,0.3);
  font-size: 0.72rem;
}

.cmt-btn-export:hover {
  background: var(--c-navy-light);
  border-color: var(--c-emerald);
}

.cmt-submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
}

.cmt-status {
  font-size: 0.8rem;
  flex: 1;
}

.cmt-status--success { color: var(--c-emerald-dim); }
.cmt-status--error   { color: var(--c-red); }

.cmt-btn-small {
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  background: var(--c-gray-50);
  border: 1px solid var(--c-gray-200);
  color: var(--c-gray-600);
  transition: 150ms ease;
}

.cmt-btn-small:hover {
  background: var(--c-navy);
  color: var(--c-white);
  border-color: var(--c-navy);
}

/* ── Thread list ───────────────────────────────────────────── */
.cmt-threads-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.cmt-loading, .cmt-empty {
  text-align: center;
  color: var(--c-gray-400);
  font-size: 0.875rem;
  padding: 2rem;
}

.cmt-thread {
  background: var(--c-white);
  border: 1px solid var(--c-gray-200);
  border-radius: 8px;
  padding: 0.875rem;
  border-left: 3px solid var(--c-navy);
}

.cmt-thread-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.cmt-thread-type {
  font-size: 0.72rem;
  font-weight: 700;
}

.cmt-thread-section {
  font-size: 0.75rem;
  color: var(--c-rk-blue);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.cmt-thread-text {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--c-text);
  margin-bottom: 0.5rem;
}

.cmt-thread-meta {
  font-size: 0.72rem;
  color: var(--c-gray-400);
  margin-bottom: 0.4rem;
}

.cmt-thread-id {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--c-gray-300);
}

.cmt-thread-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.cmt-priority-high   { background: var(--c-red);     color: #fff; font-size:.65rem; font-weight:700; padding:1px 5px; border-radius:3px; }
.cmt-priority-medium { background: var(--c-amber);   color: var(--c-navy); font-size:.65rem; font-weight:700; padding:1px 5px; border-radius:3px; }
.cmt-priority-low    { background: var(--c-gray-200); color: var(--c-gray-600); font-size:.65rem; font-weight:700; padding:1px 5px; border-radius:3px; }

.cmt-status-open         { color: var(--c-amber); font-size:.65rem; font-weight:700; }
.cmt-status-in-progress  { color: var(--c-rk-blue); font-size:.65rem; font-weight:700; }
.cmt-status-resolved     { color: var(--c-emerald-dim); font-size:.65rem; font-weight:700; }
.cmt-status-approved     { color: var(--c-emerald-dim); font-size:.65rem; font-weight:700; }

.cmt-reply {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--c-gray-50);
  border-left: 2px solid var(--c-emerald);
  border-radius: 0 4px 4px 0;
}

.cmt-reply-text {
  font-size: 0.82rem;
  line-height: 1.5;
  margin-bottom: 0.25rem;
}

.cmt-reply-meta {
  font-size: 0.68rem;
  color: var(--c-gray-400);
}

/* ── Trade Secret Blocks ───────────────────────────────────── */
[data-tier="ts"] {
  position: relative;
}

.ts-visible {
  border: 1px solid rgba(0,182,122,0.2);
  border-radius: 4px;
  padding: 0.75rem;
  margin: 0.25rem 0;
  background: rgba(0,182,122,0.02);
}

.ts-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--c-emerald-dim);
  background: var(--c-emerald-pale);
  border: 1px solid rgba(0,182,122,0.2);
  border-radius: 3px;
  padding: 2px 6px;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ts-badge span {
  font-family: var(--font-mono);
  font-size: 0.6rem;
}

.ts-redacted-block {
  margin: 0.5rem 0;
}

.ts-redaction-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--c-navy);
  border: 1px solid rgba(255,255,255,0.1);
  border-left: 4px solid var(--c-red);
  border-radius: 6px;
  padding: 0.875rem 1rem;
  color: var(--c-gray-300);
}

.ts-lock {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.ts-redaction-bar div {
  flex: 1;
}

.ts-redaction-bar strong {
  display: block;
  font-size: 0.78rem;
  color: var(--c-white);
  font-family: var(--font-mono);
  margin-bottom: 0.2rem;
}

.ts-redaction-bar span {
  font-size: 0.75rem;
  color: var(--c-gray-400);
}

.ts-request-btn {
  flex-shrink: 0;
  padding: 0.35rem 0.75rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  color: var(--c-gray-300);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  transition: 150ms ease;
  white-space: nowrap;
}

.ts-request-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--c-white);
  border-color: var(--c-emerald);
}

/* ── Tier indicator badge in topbar ────────────────────────── */
.portal-tier-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid;
}

.portal-tier-0 { background: var(--c-emerald-pale); color: var(--c-emerald-dim); border-color: var(--c-emerald); }
.portal-tier-1 { background: #EBF5FB; color: var(--c-rk-blue); border-color: var(--c-rk-blue); }
.portal-tier-2 { background: var(--c-amber-pale); color: #92650a; border-color: var(--c-amber); }
