/* ===================================================
   Foro Comunidad — Forum Styles
   =================================================== */

:root {
  --fc-bg:          #0f1117;
  --fc-sidebar-bg:  #16181f;
  --fc-surface:     #1e2130;
  --fc-surface-2:   #252840;
  --fc-border:      rgba(255,255,255,.07);
  --fc-accent:      #6c63ff;
  --fc-accent-h:    #5a52e0;
  --fc-accent-glow: rgba(108,99,255,.25);
  --fc-text:        #e4e6f0;
  --fc-text-muted:  #8b8fa8;
  --fc-danger:      #e05252;
  --fc-success:     #4caf87;
  --fc-font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --fc-radius:      10px;
  --fc-radius-sm:   6px;
  --fc-sidebar-w:   260px;
  --fc-transition:  .18s ease;
}

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

#fc-forum {
  display: flex;
  height: 80vh;
  min-height: 500px;
  max-height: 900px;
  border-radius: var(--fc-radius);
  overflow: hidden;
  background: var(--fc-bg);
  font-family: var(--fc-font);
  color: var(--fc-text);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  border: 1px solid var(--fc-border);
}

/* ── Sidebar ─────────────────────────────────────── */

.fc-sidebar {
  width: var(--fc-sidebar-w);
  flex-shrink: 0;
  background: var(--fc-sidebar-bg);
  border-right: 1px solid var(--fc-border);
  display: flex;
  flex-direction: column;
  transition: width var(--fc-transition);
  overflow: hidden;
}

.fc-sidebar.fc-sidebar-collapsed {
  width: 0;
}

.fc-sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 14px 14px;
  border-bottom: 1px solid var(--fc-border);
}

.fc-logo   { font-size: 22px; }
.fc-title  { font-weight: 700; font-size: 15px; letter-spacing: .3px; flex: 1; }

.fc-sidebar-toggle {
  background: none; border: none; color: var(--fc-text-muted);
  cursor: pointer; font-size: 18px; padding: 2px 6px; border-radius: 4px;
  transition: color var(--fc-transition);
}
.fc-sidebar-toggle:hover { color: var(--fc-text); }

/* Channel tree */
.fc-channel-tree {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--fc-border) transparent;
}

.fc-ch-group { margin-bottom: 18px; }
.fc-ch-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  color: var(--fc-text-muted); text-transform: uppercase;
  padding: 4px 8px; margin-bottom: 4px;
}

.fc-ch-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: var(--fc-radius-sm);
  cursor: pointer;
  transition: background var(--fc-transition);
  position: relative;
}
.fc-ch-item:hover { background: var(--fc-surface); }
.fc-ch-item.fc-active {
  background: var(--fc-accent-glow);
  color: #fff;
}
.fc-ch-item.fc-active .fc-ch-item-name { color: #fff; font-weight: 600; }

.fc-ch-item-icon { font-size: 14px; flex-shrink: 0; }
.fc-ch-item-name { font-size: 13.5px; color: var(--fc-text-muted); flex: 1; }

.fc-ch-sub-list { margin-left: 22px; margin-bottom: 6px; }
.fc-ch-sub-list .fc-ch-item { padding: 5px 10px; }
.fc-ch-sub-list .fc-ch-item-name { font-size: 13px; }

.fc-ch-toggle {
  font-size: 10px; color: var(--fc-text-muted);
  transition: transform var(--fc-transition);
}
.fc-ch-item.fc-expanded .fc-ch-toggle { transform: rotate(90deg); }

.fc-sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--fc-border);
}

/* ── Main ─────────────────────────────────────────── */

.fc-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--fc-bg);
}

/* Empty state */
.fc-empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--fc-text-muted); gap: 12px;
}
.fc-empty-icon { font-size: 48px; }
.fc-empty-state p { font-size: 14px; }

/* Channel view */
.fc-channel-view {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

.fc-channel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--fc-border);
  background: var(--fc-sidebar-bg);
  flex-shrink: 0;
}
.fc-channel-info { display: flex; align-items: center; gap: 12px; }
.fc-channel-icon { font-size: 24px; }
.fc-channel-name { margin: 0; font-size: 16px; font-weight: 700; }
.fc-channel-desc { margin: 0; font-size: 12px; color: var(--fc-text-muted); }
.fc-channel-actions { display: flex; gap: 8px; }

/* Messages */
.fc-messages-wrap {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 0;
  scrollbar-width: thin; scrollbar-color: var(--fc-border) transparent;
}

.fc-messages { display: flex; flex-direction: column; gap: 4px; }

.fc-msg {
  display: flex; gap: 10px; padding: 8px 10px;
  border-radius: var(--fc-radius-sm);
  transition: background var(--fc-transition);
  position: relative;
}
.fc-msg:hover { background: var(--fc-surface); }

.fc-msg-avatar img {
  width: 36px; height: 36px; border-radius: 50%;
  flex-shrink: 0; object-fit: cover;
}

.fc-msg-body { flex: 1; min-width: 0; }
.fc-msg-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.fc-msg-author { font-weight: 600; font-size: 14px; }
.fc-msg-time { font-size: 11px; color: var(--fc-text-muted); }

.fc-msg-text {
  font-size: 14px; line-height: 1.55; color: var(--fc-text);
  word-break: break-word; white-space: pre-wrap;
}

.fc-msg-photos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fc-msg-photo {
  width: 140px; height: 110px; object-fit: cover;
  border-radius: var(--fc-radius-sm); cursor: zoom-in;
  border: 1px solid var(--fc-border);
  transition: transform var(--fc-transition);
}
.fc-msg-photo:hover { transform: scale(1.03); }

.fc-msg-actions {
  position: absolute; top: 4px; right: 8px;
  display: none; gap: 4px;
  background: var(--fc-surface-2);
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius-sm); padding: 2px 4px;
}
.fc-msg:hover .fc-msg-actions { display: flex; }

.fc-msg-action-btn {
  background: none; border: none; cursor: pointer;
  font-size: 12px; padding: 3px 6px; border-radius: 4px;
  color: var(--fc-text-muted); transition: all var(--fc-transition);
}
.fc-msg-action-btn:hover { background: var(--fc-border); color: var(--fc-text); }
.fc-msg-action-btn.fc-danger:hover { color: var(--fc-danger); }

/* Replies */
.fc-replies-toggle {
  font-size: 12px; color: var(--fc-accent); cursor: pointer;
  margin-top: 5px; background: none; border: none; padding: 0;
}
.fc-replies-toggle:hover { text-decoration: underline; }

.fc-replies {
  margin-left: 46px; border-left: 2px solid var(--fc-border);
  padding-left: 12px; margin-top: 6px;
  display: flex; flex-direction: column; gap: 4px;
}

.fc-reply {
  display: flex; gap: 8px; padding: 5px 6px;
  border-radius: var(--fc-radius-sm);
  transition: background var(--fc-transition);
  position: relative;
}
.fc-reply:hover { background: var(--fc-surface); }
.fc-reply .fc-msg-avatar img { width: 28px; height: 28px; }
.fc-reply .fc-msg-author { font-size: 13px; }
.fc-reply .fc-msg-text { font-size: 13px; }

/* Edit inline */
.fc-edit-form { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.fc-edit-form textarea {
  background: var(--fc-surface-2); border: 1px solid var(--fc-accent);
  color: var(--fc-text); border-radius: var(--fc-radius-sm);
  padding: 8px; font-size: 14px; resize: vertical; min-height: 60px;
  font-family: var(--fc-font); outline: none;
}
.fc-edit-actions { display: flex; gap: 6px; }

/* Pagination */
.fc-pagination {
  display: flex; justify-content: center; gap: 6px;
  padding: 12px 0 4px; flex-shrink: 0;
}
.fc-page-btn {
  background: var(--fc-surface); border: 1px solid var(--fc-border);
  color: var(--fc-text); border-radius: var(--fc-radius-sm);
  padding: 5px 12px; cursor: pointer; font-size: 13px;
  transition: all var(--fc-transition);
}
.fc-page-btn:hover, .fc-page-btn.fc-active {
  background: var(--fc-accent); border-color: var(--fc-accent); color: #fff;
}

/* ── Compose ─────────────────────────────────────── */

.fc-compose {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--fc-border);
  background: var(--fc-sidebar-bg);
  flex-shrink: 0;
}

.fc-compose-avatar img { width: 36px; height: 36px; border-radius: 50%; margin-top: 4px; }

.fc-compose-body { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.fc-reply-label {
  font-size: 12px; color: var(--fc-accent); display: flex; align-items: center; gap: 6px;
}
.fc-cancel-reply {
  background: none; border: none; color: var(--fc-text-muted); cursor: pointer; font-size: 12px;
}

#fc-compose-text {
  width: 100%; background: var(--fc-surface);
  border: 1px solid var(--fc-border); color: var(--fc-text);
  border-radius: var(--fc-radius-sm); padding: 9px 12px;
  font-size: 14px; font-family: var(--fc-font);
  resize: none; outline: none; transition: border-color var(--fc-transition);
  box-sizing: border-box;
}
#fc-compose-text:focus { border-color: var(--fc-accent); }

.fc-compose-toolbar { display: flex; align-items: center; gap: 8px; }

.fc-attach-btn {
  font-size: 20px; cursor: pointer; padding: 2px 6px;
  border-radius: var(--fc-radius-sm); transition: background var(--fc-transition);
  user-select: none;
}
.fc-attach-btn:hover { background: var(--fc-surface); }

.fc-photo-preview { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.fc-photo-preview-item {
  position: relative; width: 50px; height: 50px;
}
.fc-photo-preview-item img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 4px; border: 1px solid var(--fc-border);
}
.fc-photo-preview-remove {
  position: absolute; top: -4px; right: -4px;
  background: var(--fc-danger); color: #fff; border: none;
  border-radius: 50%; width: 16px; height: 16px; font-size: 10px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

.fc-login-prompt {
  padding: 14px 20px; text-align: center;
  border-top: 1px solid var(--fc-border);
}

/* ── Buttons ─────────────────────────────────────── */

.fc-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: var(--fc-radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all var(--fc-transition);
  font-family: var(--fc-font); white-space: nowrap;
}
.fc-btn-primary   { background: var(--fc-accent);  color: #fff; }
.fc-btn-primary:hover { background: var(--fc-accent-h); }
.fc-btn-ghost     { background: transparent; border-color: var(--fc-border); color: var(--fc-text-muted); }
.fc-btn-ghost:hover { background: var(--fc-surface); color: var(--fc-text); }
.fc-btn-danger    { background: transparent; border-color: var(--fc-danger); color: var(--fc-danger); }
.fc-btn-danger:hover { background: var(--fc-danger); color: #fff; }
.fc-btn-sm        { padding: 4px 10px; font-size: 12px; }

/* ── Modal ────────────────────────────────────────── */

.fc-modal-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
}
.fc-modal {
  background: var(--fc-surface); border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius); width: 90%; max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.fc-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--fc-border);
}
.fc-modal-header h3 { margin: 0; font-size: 16px; }
.fc-modal-close {
  background: none; border: none; color: var(--fc-text-muted);
  font-size: 18px; cursor: pointer; border-radius: 4px; padding: 2px 6px;
}
.fc-modal-body {
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.fc-modal-body label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--fc-text-muted); }
.fc-modal-body input,
.fc-modal-body select,
.fc-modal-body textarea {
  background: var(--fc-surface-2); border: 1px solid var(--fc-border);
  color: var(--fc-text); border-radius: var(--fc-radius-sm);
  padding: 8px 10px; font-size: 14px; outline: none;
  font-family: var(--fc-font); transition: border-color var(--fc-transition);
}
.fc-modal-body input:focus,
.fc-modal-body select:focus { border-color: var(--fc-accent); }
.fc-modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--fc-border);
}

/* ── Lightbox ─────────────────────────────────────── */

.fc-lightbox { position: fixed; inset: 0; z-index: 999999; display: flex; align-items: center; justify-content: center; }
.fc-lightbox-bg { position: absolute; inset: 0; background: rgba(0,0,0,.88); cursor: zoom-out; }
.fc-lightbox-img {
  position: relative; max-width: 90vw; max-height: 90vh;
  object-fit: contain; border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0,0,0,.8);
}

/* ── Loading / states ─────────────────────────────── */

.fc-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; color: var(--fc-text-muted); gap: 10px;
}
.fc-spinner {
  width: 18px; height: 18px; border: 2px solid var(--fc-border);
  border-top-color: var(--fc-accent); border-radius: 50%;
  animation: fc-spin .7s linear infinite;
}
@keyframes fc-spin { to { transform: rotate(360deg); } }

.fc-no-messages {
  text-align: center; color: var(--fc-text-muted);
  padding: 50px 20px; font-size: 14px;
}

/* ── Responsive ───────────────────────────────────── */

@media (max-width: 640px) {
  #fc-forum { height: 90vh; }
  .fc-sidebar { width: 220px; position: absolute; z-index: 10; height: 100%; }
  .fc-sidebar.fc-sidebar-collapsed { width: 0; }
  .fc-channel-header .fc-channel-actions { display: none; }
}

@media (max-width: 480px) {
  .fc-msg-photos .fc-msg-photo { width: 100px; height: 80px; }
}
