/* IN4MATION Call Sheet CMS — Shared Stylesheet */

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

/* ── Design Tokens ───────────────────────────────────────────────────────── */
:root {
  --font-display: 'Poppins', sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --accent:       #27AAE1;
  --border:       #D2D2D7;
  --border-light: #E8E8ED;
  --surface:      #FFFFFF;
  --danger:       #FF3B30;
  --success:      #34C759;
  --warning:      #FF9500;

  /* Dashboard darker tones */
  --nav-bg:     #141416;
  --nav-text:   #F5F5F7;
  --nav-muted:  #6E6E73;
  --nav-hover:  rgba(255,255,255,0.07);
  --nav-active: rgba(39,170,225,0.15);
  --page-bg:    #EBEBF0;
  --ink:        #1D1D1F;
  --ink-2:      #3D3D3F;
  --ink-3:      #6E6E73;
  --ink-4:      #AEAEB2;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
body {
  font-family: var(--font-body);
  background: var(--page-bg);
  color: var(--ink);
  min-height: 100vh;
}

/* ── App Layout: top-nav | sidebar | main | tagboard ─────────────────────── */
.app-layout {
  display: grid;
  grid-template-rows: 52px 1fr;
  grid-template-columns: 224px 1fr 280px;
  height: 100vh;
  overflow: hidden;
}

/* ── Top Navigation ──────────────────────────────────────────────────────── */
.top-nav {
  grid-column: 1 / -1;
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}

.nav-logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 17px;
  letter-spacing: -0.5px;
  color: var(--nav-text);
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--nav-muted);
}

.nav-sep {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.1);
}

.nav-spacer { flex: 1; }

.nav-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(255,255,255,0.07);
  color: var(--nav-text);
  font-size: 13px;
  font-weight: 700;
}

.presence-dots {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 4px;
}

.presence-dot {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--nav-muted);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--nav-muted);
  flex-shrink: 0;
}

.dot.online { background: var(--success); }

.nav-btn-logout {
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--nav-muted);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-body);
}
.nav-btn-logout:hover { color: var(--nav-text); border-color: rgba(255,255,255,0.3); }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  background: #FFFFFF;
  border-right: none;
  box-shadow: 8px 0 16px rgba(0,0,0,0.10);
  overflow-y: auto;
  padding: 20px 0;
  grid-row: 2;
}

.sidebar-section-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 0 16px;
  margin-bottom: 6px;
  margin-top: 20px;
}
.sidebar-section-label:first-child { margin-top: 0; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-3);
  border-left: 2px solid transparent;
  transition: all 0.15s;
  user-select: none;
}
.sidebar-item:hover { color: var(--ink); background: rgba(0,0,0,0.04); }
.sidebar-item.active {
  color: var(--accent);
  background: rgba(39,170,225,0.08);
  border-left-color: var(--accent);
}

.sidebar-count {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  background: rgba(0,0,0,0.07);
  color: var(--ink-4);
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-new-btn {
  margin: 16px 12px 0;
  display: block;
  width: calc(100% - 24px);
  padding: 9px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.15s;
}
.sidebar-new-btn:hover { opacity: 0.88; }

/* ── Main Content Area ───────────────────────────────────────────────────── */
.main-content {
  overflow-y: auto;
  padding: 28px;
  background: var(--page-bg);
  grid-row: 2;
  border-left: 1px solid rgba(0,0,0,0.09);
  border-right: 1px solid rgba(0,0,0,0.09);
}

.page-heading {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 24px;
  color: var(--ink);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-heading-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Sheets Grid ─────────────────────────────────────────────────────────── */
.sheets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

/* ── Sheet Card — Pixiset-style ──────────────────────────────────────────── */
.sheet-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  cursor: default;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.06);
  transition: transform 0.18s, box-shadow 0.18s;
  border: 1.5px solid var(--border-light);
  position: relative;
}
.sheet-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.14);
}
.sheet-card.active-card { border-color: var(--accent); }

/* Cover image area */
.sheet-card-cover {
  position: relative;
  width: 100%;
  height: 162px;
  background: linear-gradient(145deg, #1a1a22 0%, #26263a 60%, #1e2a3a 100%);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  flex-shrink: 0;
}
.sheet-card-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.08) 0%, rgba(0,0,0,0.38) 100%);
}
.sheet-card-cover-logo {
  position: absolute;
  bottom: 10px;
  right: 12px;
  width: 36px;
  height: auto;
  opacity: 0.45;
  z-index: 2;
  filter: brightness(10);
}
.sheet-card-cover-badge {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 2;
}

/* Card body */
.sheet-card-body {
  padding: 14px 16px 10px;
}

.sheet-card-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 4px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-card-meta {
  font-size: 11px;
  color: var(--ink-4);
  margin-bottom: 10px;
  line-height: 1.55;
}

.sheet-card-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

/* Row 1: secondary actions — Delete, Duplicate, Share/Publish, Unpublish */
.card-sec-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* Row 2: primary Open → button — full width */
.card-open-btn {
  width: 100%;
  text-align: center;
  justify-content: center;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Badge ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-draft     { background: rgba(255,149,0,0.12); color: var(--warning); }
.badge-published { background: rgba(52,199,89,0.12);  color: var(--success); }
.badge-active    { background: rgba(39,170,225,0.12); color: var(--accent); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
  line-height: 1;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.88; }
.btn-secondary { background: #F2F2F7; color: var(--ink-2); }
.btn-secondary:hover { background: #E5E5EA; }
.btn-danger    { background: rgba(0,0,0,0.05); color: var(--ink-4); border: 1px solid rgba(0,0,0,0.08); }
.btn-danger:hover { background: rgba(255,59,48,0.1); color: var(--danger); border-color: rgba(255,59,48,0.2); }
.btn-ghost     { background: transparent; color: var(--ink-3); }
.btn-ghost:hover { background: rgba(0,0,0,0.05); }
.btn-sm  { padding: 5px 10px; font-size: 11px; border-radius: 6px; }
.btn-xs  { padding: 4px 8px;  font-size: 10px; border-radius: 5px; }

/* ── Tag Board (right panel) ─────────────────────────────────────────────── */
.tagboard {
  background: #505060;
  border-left: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  grid-row: 2;
}

.tagboard-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 13px;
  color: var(--nav-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.tagboard-team {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.team-member {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--nav-muted);
  transition: color 0.2s;
}
.team-member .dot { width: 6px; height: 6px; }
.team-member.is-online { color: var(--nav-text); }

.messages-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0,0,0,0.18);
}

/* ── iChat-style bubbles ─────────────────────────────────────────────────── */
.msg-item {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}
.msg-item.from-me   { align-self: flex-end;   align-items: flex-end; }
.msg-item.from-other { align-self: flex-start; align-items: flex-start; }

.msg-sender {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: rgba(255,255,255,0.45);
  margin-bottom: 3px;
  padding: 0 5px;
}

.msg-bubble {
  padding: 8px 13px;
  line-height: 1.45;
  font-size: 12.5px;
  word-break: break-word;
  white-space: pre-wrap;
}
/* outgoing — blue iChat bubble */
.msg-item.from-me .msg-bubble {
  background: linear-gradient(160deg, #34B4EC 0%, #1E96D0 100%);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 2px 6px rgba(30,150,208,0.35);
}
/* incoming — frosted grey bubble */
.msg-item.from-other .msg-bubble {
  background: rgba(255,255,255,0.13);
  color: rgba(255,255,255,0.92);
  border-radius: 18px 18px 18px 4px;
  border: 1px solid rgba(255,255,255,0.1);
}

.msg-ts {
  font-size: 9px;
  color: rgba(255,255,255,0.45);
  padding: 3px 5px 0;
}

/* ── iChat-style input bar ───────────────────────────────────────────────── */
.tagboard-input-area {
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.12);
}

.tagboard-inp {
  flex: 1;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 8px 14px;
  color: var(--nav-text);
  font-size: 12.5px;
  font-family: var(--font-body);
  outline: none;
  resize: none;
  line-height: 1.4;
  transition: background 0.15s, border-color 0.15s;
}
.tagboard-inp::placeholder { color: rgba(255,255,255,0.3); }
.tagboard-inp:focus {
  background: rgba(255,255,255,0.14);
  border-color: var(--accent);
}

.tagboard-send {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(39,170,225,0.4);
}
.tagboard-send:hover { opacity: 0.88; transform: scale(1.07); }

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  gap: 10px;
  text-align: center;
}
.empty-icon  { font-size: 36px; margin-bottom: 4px; }
.empty-title { font-family: var(--font-display); font-weight: 900; font-size: 16px; color: var(--ink); }
.empty-sub   { font-size: 13px; color: var(--ink-3); line-height: 1.5; }

/* ── Modals ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 17px;
  color: var(--ink);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-4);
  font-size: 20px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-close:hover { color: var(--ink); background: #F2F2F7; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  margin-top: 20px;
}
.modal-footer.space-between { justify-content: space-between; }

/* ── Form Fields ─────────────────────────────────────────────────────────── */
.field        { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 5px;
}

.field-inp,
.field-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
  font-family: var(--font-body);
  background: #fff;
}
.field-inp:focus,
.field-select:focus { border-color: var(--accent); }
.field-inp.lg { font-family: var(--font-display); font-size: 15px; font-weight: 700; }
textarea.field-inp { resize: none; min-height: 72px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Toggle/checkbox row */
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1.5px solid var(--border-light);
  margin-bottom: 8px;
  transition: border-color 0.15s;
}
.check-row:hover { border-color: var(--accent); }
.check-row input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.check-row-label { font-size: 13px; font-weight: 700; color: var(--ink); }
.check-row-sub   { font-size: 11px; color: var(--ink-3); }

/* Link/URL display box */
.link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F5F5F7;
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  margin-top: 12px;
}
.link-text {
  flex: 1;
  font-size: 11px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: monospace;
}

/* ── Toast Notifications ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  max-width: 320px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.hide { opacity: 0; transform: translateY(8px); }
.toast-success { background: #1A3A27; color: #fff; }
.toast-error   { background: #3A1A1A; color: #fff; }
.toast-info    { background: #1A2A3A; color: #fff; }

.toast-icon { font-size: 14px; font-weight: 700; }

/* ── Utility Classes ─────────────────────────────────────────────────────── */
.hidden         { display: none !important; }
.flex           { display: flex; }
.items-center   { align-items: center; }
.gap-8          { gap: 8px; }
.gap-12         { gap: 12px; }
.mb-16          { margin-bottom: 16px; }
.mb-20          { margin-bottom: 20px; }
.text-sm        { font-size: 13px; }
.text-xs        { font-size: 11px; }
.text-muted     { color: var(--ink-3); }
.font-bold      { font-weight: 700; }
.w-full         { width: 100%; }

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 16px;
}
.breadcrumb-link {
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
}
.breadcrumb-link:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--ink-4); }

/* ── Scrollbar styling (dark panels) ────────────────────────────────────── */
.sidebar::-webkit-scrollbar,
.messages-list::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track,
.messages-list::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb,
.messages-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }

/* ── Search input override ───────────────────────────────────────────────── */
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ── Loading spinner ── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.loading-spin {
  animation: spin 1.2s linear infinite;
  opacity: 0.7;
}
