.fc-app{font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif}
.fc-layout{display:flex;gap:12px;min-height:520px}
.fc-left{width:320px;max-width:40vw;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden;background:#fff}
.fc-left-head{display:flex;align-items:center;justify-content:space-between;padding:12px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb}
.fc-title{font-weight:700}
.fc-threads{max-height:640px;overflow:auto}
.fc-thread{display:flex;justify-content:space-between;gap:10px;padding:10px 12px;border-bottom:1px solid #f1f5f9;cursor:pointer}
.fc-thread:hover{background:#f8fafc}
.fc-thread.active{background:#eef2ff}
.fc-thread-title{font-weight:600;line-height:1.2}
.fc-badge{display:inline-block;min-width:22px;text-align:center;padding:2px 8px;border-radius:999px;background:#111827;color:#fff;font-size:12px}
.fc-right{flex:1;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden;background:#fff;display:flex;flex-direction:column}
.fc-header{padding:12px 14px;border-bottom:1px solid #e5e7eb;background:#f9fafb}
.fc-header-title{font-weight:700}
.fc-readers{margin-top:4px;font-size:12px;color:#6b7280}
.fc-messages{flex:1;overflow:auto;padding:14px;display:flex;flex-direction:column;gap:10px;background:#ffffff}
.fc-msg{max-width:78%;border:1px solid #e5e7eb;border-radius:12px;padding:10px 12px;background:#f8fafc}
.fc-msg.mine{margin-left:auto;background:#eef2ff;border-color:#c7d2fe}
.fc-msg-meta{font-size:12px;color:#6b7280;margin-bottom:6px}
.fc-msg-text{white-space:normal;word-break:break-word}
.fc-compose{display:flex;gap:10px;padding:12px;border-top:1px solid #e5e7eb;background:#fff}
.fc-input{flex:1;border:1px solid #d1d5db;border-radius:10px;padding:10px;resize:none}
.fc-btn{border:1px solid #d1d5db;border-radius:10px;padding:8px 10px;background:#111827;color:#fff;cursor:pointer;font-weight:600}
.fc-btn:hover{opacity:.92}
.fc-btn-secondary{background:#fff;color:#111827}
.fc-btn-small{padding:6px 8px;font-size:13px}
.fc-send{min-width:92px}
.fc-status{padding:8px 12px;font-size:13px;color:#374151;background:#fff}
.fc-status-error{color:#b91c1c}
.fc-empty,.fc-muted{padding:12px;color:#6b7280}
.fc-box{border:1px solid #e5e7eb;border-radius:12px;padding:12px;background:#fff}
.fc-loading{padding:12px}
.fc-modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.35);display:flex;align-items:center;justify-content:center;z-index:99999;padding:16px}
.fc-modal{width:min(720px,96vw);background:#fff;border-radius:14px;border:1px solid #e5e7eb;padding:14px}
.fc-modal h3{margin:0 0 10px 0}
.fc-label{display:block;margin-top:10px;margin-bottom:6px;font-weight:700}
.fc-text{width:100%;border:1px solid #d1d5db;border-radius:10px;padding:10px}
.fc-row{display:flex;gap:10px;align-items:center;margin-top:8px}
.fc-results{margin-top:10px;border:1px solid #e5e7eb;border-radius:12px;max-height:180px;overflow:auto}
.fc-result{display:flex;justify-content:space-between;gap:10px;padding:10px 12px;border-bottom:1px solid #f1f5f9}
.fc-userlist{margin-top:8px;border:1px solid #e5e7eb;border-radius:12px;max-height:160px;overflow:auto}
.fc-userrow{display:flex;justify-content:space-between;gap:10px;padding:10px 12px;border-bottom:1px solid #f1f5f9}
.fc-modal-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:12px}
@media (max-width: 900px){
  .fc-layout{flex-direction:column}
  .fc-left{width:100%;max-width:none}
}

.fc-attach{white-space:nowrap}
.fc-attach-img{max-width:260px;max-height:260px;border-radius:10px;border:1px solid #e5e7eb;cursor:pointer;display:block;margin-bottom:6px}
.fc-msg-body{margin-top:4px}

.fc-participants{margin-top:4px;font-size:12px;color:#374151}

.fc-embeds{display:flex;flex-direction:column;gap:8px;margin-top:8px}
.fc-embed-img{max-width:260px;max-height:260px;border-radius:10px;border:1px solid #e5e7eb;cursor:pointer}

.fc-thread-main{display:flex;flex-direction:column;gap:2px;min-width:0}
.fc-thread-sub{font-size:12px;color:#6b7280;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.fc-back{display:none;align-items:center;border:0;background:transparent;font-size:14px;cursor:pointer;padding:6px 0}

/* Mobile: show list first, then chat */
@media (max-width: 899px){
  .fc-layout{height:75vh;min-height:520px}
  .fc-right{display:none}
  .fc-layout.fc-show-chat .fc-left{display:none}
  .fc-layout.fc-show-chat .fc-right{display:flex;flex-direction:column;height:100%}
  .fc-layout.fc-show-chat .fc-back{display:inline-flex}
}

/* Desktop: 2 kolonner */
@media (min-width: 900px){
  .fc-layout{display:grid;grid-template-columns:340px 1fr;height:70vh;min-height:520px}
  .fc-left{border-right:1px solid #e5e7eb}
  .fc-back{display:none !important}
}

/* Auth UI */
.fc-auth-box{max-width:420px;margin:40px auto;padding:18px 18px 16px;border:1px solid #e5e7eb;border-radius:16px;background:#fff;box-shadow:0 6px 20px rgba(0,0,0,0.06)}
.fc-auth-box h3{margin:0 0 8px;font-size:20px}
.fc-auth-input{width:100%;padding:12px 12px;margin:10px 0;border:1px solid #d1d5db;border-radius:12px;font-size:16px}
.fc-auth-remember{display:flex;gap:10px;align-items:center;margin:8px 0 12px;font-size:14px;color:#374151}
.fc-auth-btn{width:100%;padding:12px;border-radius:12px}
.fc-auth-msg{min-height:18px;margin:4px 0 8px;font-size:14px;color:#374151}
.fc-auth-msg.fc-err{color:#b91c1c}

/* Embeds */
.fc-embeds{display:flex;flex-direction:column;gap:8px;margin-top:8px}
.fc-embed-img{max-width:260px;max-height:260px;border-radius:10px;border:1px solid #e5e7eb;cursor:pointer}
.fc-embed-iframe{width:260px;max-width:100%;height:260px;border-radius:10px;border:1px solid #e5e7eb}

/* Participants panel (frontend) */
.fc-header{position:relative}
.fc-participants{position:absolute;top:100%;left:10px;right:10px;display:none;z-index:9999}
.fc-participants.open{display:block}
.fc-part-panel{background:#fff;border:1px solid #e5e7eb;border-radius:14px;box-shadow:0 10px 30px rgba(0,0,0,0.10);padding:12px}
.fc-part-panel-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.fc-part-panel-title{font-weight:600}
.fc-part-list{display:flex;flex-direction:column;gap:8px;max-height:260px;overflow:auto;padding-right:4px}
.fc-part-row{display:flex;align-items:center;justify-content:space-between;gap:10px}
.fc-part-name{font-size:14px}
.fc-part-add{margin-top:12px;border-top:1px solid #e5e7eb;padding-top:10px}
.fc-part-add-title{font-size:13px;color:#374151;margin-bottom:6px}
.fc-part-add-row{display:flex;gap:8px}
.fc-part-select{flex:1;padding:10px;border:1px solid #d1d5db;border-radius:12px}

/* Header layout (back on top, participants under) */
.fc-header{display:flex;flex-direction:column;gap:8px}
.fc-header-top{display:flex;align-items:center;gap:10px}
.fc-header-actions{display:flex;align-items:center}
.fc-participants{display:none}
.fc-participants.open{display:block}
@media (max-width: 899px){
  .fc-input{min-height:110px;font-size:16px}
}


/* --- Chat height / dynamic message area --- */
.fc-layout{height:88vh;max-height:85vh}
.fc-left,.fc-right{height:85vh;max-height:85vh}
.fc-left{display:flex;flex-direction:column}
.fc-threads{flex:1;max-height:none}
.fc-right{display:flex;flex-direction:column}
.fc-messages{flex:1;min-height:0}
/* Make composer comfortable on mobile */
@media (max-width: 899px){
  .fc-compose{padding:12px}
  .fc-input{min-height:120px}
}


/* --- Composer: bigger input + stacked actions (mobile-friendly) --- */
.fc-compose{
  display:flex;
  align-items:stretch;
  gap:12px;
}

.fc-input{
  flex:1;
  resize:none;
  min-height:84px;
  line-height:1.35;
}

.fc-compose-actions{
  display:flex;
  flex-direction:column;
  gap:10px;
  justify-content:flex-end;
}

.fc-iconbtn{
  width:56px;
  height:56px;
  border-radius:16px;
  border:1px solid #d1d5db;
  background:#fff;
  font-size:26px;
  font-weight:700;
  line-height:1;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}

.fc-iconbtn.fc-send{
  border:0;
  background:#0f172a;
  color:#fff;
}

@media (max-width: 899px){
  .fc-compose{gap:10px}
  .fc-iconbtn{width:60px;height:60px;border-radius:18px;font-size:28px}
  .fc-input{min-height:120px;font-size:16px}
}

.fc-attach.fc-btn, .fc-send.fc-btn{display:none}

/* --- Lightbox (fullscreen images + browse within thread) --- */
.fc-lightbox-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.92);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:999999;
  padding:18px;
}
.fc-lightbox-img{
  max-width:100%;
  max-height:100%;
  object-fit:contain;
  border-radius:10px;
}
.fc-lightbox-close,
.fc-lightbox-prev,
.fc-lightbox-next{
  position:absolute;
  border:0;
  background:rgba(255,255,255,.10);
  color:#fff;
  cursor:pointer;
  border-radius:999px;
  width:48px;
  height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:28px;
  line-height:1;
  user-select:none;
}
.fc-lightbox-close{top:16px; right:16px; font-size:32px}
.fc-lightbox-prev{left:16px}
.fc-lightbox-next{right:16px}
.fc-lightbox-counter{
  position:absolute;
  bottom:16px;
  left:50%;
  transform:translateX(-50%);
  color:#fff;
  font-size:13px;
  background:rgba(255,255,255,.10);
  padding:6px 10px;
  border-radius:999px;
}
@media (max-width: 899px){
  .fc-lightbox-close{top:10px; right:10px}
  .fc-lightbox-prev{left:10px}
  .fc-lightbox-next{right:10px}
}
