/* ===== RESET ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: #e9f2ff;
  color: #0f172a;
}

/* ===== LAYOUT GENERAL ===== */

.app {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR PRINCIPAL ===== */

.sidebar {
  width: 230px;
  background: #ffffff;
  box-shadow: 6px 0 30px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  padding: 16px 14px 16px;
  border-radius: 0 24px 24px 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.sidebar-logo img {
  max-width: 140px;
  height: auto;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  border-radius: 999px;
  border: none;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: #1f2933;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease,
    transform 0.05s ease;
}

.nav-item--simple {
  justify-content: flex-start;
  gap: 8px;
}

.nav-item--active {
  background: #1455e6;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(20, 85, 230, 0.5);
  transform: translateY(-1px);
}

.nav-item--group {
  background: rgba(20, 85, 230, 0.06);
  color: #1455e6;
}

.nav-item--group:hover {
  background: rgba(20, 85, 230, 0.12);
}

.nav-chevron {
  font-size: 11px;
  opacity: 0.7;
}

/* Submenú community */

.nav-sub {
  margin-left: 8px;
  margin-top: 4px;
  display: grid;
  gap: 4px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.18s ease;
}

.nav-sub--open {
  max-height: 240px;
}

.nav-sub-item {
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 999px;
  color: #4b5563;
  text-decoration: none;
  background: transparent;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-sub-item:hover {
  background: rgba(20, 85, 230, 0.08);
  color: #111827;
}

.nav-sub-item--active {
  background: #1455e6;
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(20, 85, 230, 0.4);
}

/* Footer sidebar */

.sidebar-footer {
  margin-top: 12px;
  border-top: 1px solid #e5e7eb;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-mini {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1455e6, #1d5fff);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

.user-tag {
  font-size: 11px;
  color: #9ca3af;
}

.logout-btn {
  align-self: flex-start;
  padding: 6px 10px;
  border-radius: 999px;
  border: none;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
  cursor: pointer;
}

/* ===== BARRA DE SECCIONES (GENERAL / CARRERAS / PROYECTOS / EVENTOS) ===== */

.sections-bar {
  width: 90px;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.section-pill {
  border-radius: 999px;
  border: none;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease,
    transform 0.05s ease;
}

.section-pill:hover {
  background: rgba(148, 163, 184, 0.18);
}

.section-pill--active {
  background: #1455e6;
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(20, 85, 230, 0.55);
  transform: translateY(-1px);
}

/* ===== BARRA DE CARRERAS (COMUNIDADES) ===== */

.communities-bar {
  width: 80px;
  padding: 16px 10px;
  display: none; /* por defecto oculta, solo en Carreras */
  flex-direction: column;
  align-items: center;
}

.communities-bar--visible {
  display: flex;
}

.communities-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.community-icon {
  position: relative;
  cursor: pointer;
}

.community-avatar {
  width: 48px;
  height: 48px;
  border-radius: 20px;
  background: #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid transparent;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.15);
  transition: transform 0.12s ease, box-shadow 0.12s ease,
    border-color 0.12s ease, background 0.12s ease;
}

.community-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.community-icon--active .community-avatar {
  border-color: #1455e6;
  background: #eff6ff;
  box-shadow: 0 14px 30px rgba(20, 85, 230, 0.7);
}

.community-icon:hover .community-avatar {
  transform: translateY(-2px) scale(1.03);
  border-color: #1455e6;
  background: #eff6ff;
  box-shadow: 0 14px 30px rgba(20, 85, 230, 0.7);
}

/* Tooltip con nombre de carrera */

.tooltip {
  position: absolute;
  left: 60px;
  top: 50%;
  transform: translateY(-50%) translateX(4px);
  background: #0f172a;
  color: #ffffff;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.6);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.tooltip::after {
  content: "";
  position: absolute;
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent #0f172a transparent transparent;
}

.community-icon:hover .tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ===== MAIN / FORO ===== */

.main {
  flex: 1;
  padding: 18px 22px 22px 0;
  display: flex;
  flex-direction: column;
}

.forum-header {
  margin-bottom: 10px;
}

.forum-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.forum-title h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.forum-tag {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(20, 85, 230, 0.08);
  color: #1455e6;
  font-weight: 600;
}

.forum-subcopy {
  margin-top: 4px;
  font-size: 13px;
  color: #6b7280;
}

/* Selector de ciudad */

.city-filter {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.city-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
}

.city-pill {
  border-radius: 999px;
  border: none;
  padding: 5px 12px;
  font-size: 12px;
  background: rgba(148, 163, 184, 0.12);
  color: #374151;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease,
    transform 0.05s ease;
}

.city-pill:hover {
  background: rgba(148, 163, 184, 0.18);
}

.city-pill--active {
  background: #ffffff;
  color: #1455e6;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
  transform: translateY(-1px);
}

/* ===== BODY FORO ===== */

.forum-body {
  flex: 1;
  display: flex;
  gap: 14px;
  margin-top: 6px;
}

/* Columna amigos */

.friends-column {
  width: 270px;
  display: flex;
}

.friends-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 12px 12px 10px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  width: 100%;
}

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

.friends-title {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}

.friends-search {
  position: relative;
  margin-bottom: 10px;
}

.friends-search input {
  width: 100%;
  padding: 8px 30px 8px 28px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  font-size: 13px;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease,
    background 0.12s ease;
}

.friends-search input:focus {
  border-color: #1455e6;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(20, 85, 230, 0.18);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.7;
}

.friends-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.friend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 8px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.05s ease,
    box-shadow 0.12s ease;
}

.friend-item:hover {
  background: rgba(148, 163, 184, 0.12);
}

.friend-item--active {
  background: #1455e6;
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(20, 85, 230, 0.45);
  transform: translateY(-1px);
}

.friend-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.friend-item--active .friend-avatar {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.friend-info {
  display: flex;
  flex-direction: column;
}

.friend-name {
  font-size: 13px;
  font-weight: 600;
}

.friend-detail {
  font-size: 11px;
  color: #9ca3af;
}

.friend-item--active .friend-detail {
  color: rgba(209, 213, 219, 0.95);
}

/* Columna chat */

.chat-column {
  flex: 1;
  display: flex;
}

.chat-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 12px 14px 10px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  width: 100%;
}

.chat-header {
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 8px;
}

.chat-channel-name {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
}

.chat-channel-meta {
  font-size: 11px;
  color: #9ca3af;
}

/* Mensajes */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  display: flex;
  gap: 8px;
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}

.message-body {
  flex: 1;
}

.message-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
}

.message-user {
  font-weight: 600;
  color: #111827;
}

.message-time {
  color: #9ca3af;
}

.message-text {
  margin: 2px 0 0;
  font-size: 13px;
  color: #374151;
}

/* Input de chat */

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 6px;
  border-radius: 999px;
  transition: background 0.12s ease;
}

.icon-btn:hover {
  background: rgba(148, 163, 184, 0.18);
}

.chat-input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  font-size: 13px;
  outline: none;
  background: #f9fafb;
  transition: border-color 0.12s ease, box-shadow 0.12s ease,
    background 0.12s ease;
}

.chat-input:focus {
  border-color: #1455e6;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(20, 85, 230, 0.18);
}

/* Botón primario */

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  border: none;
  outline: none;
  background: linear-gradient(135deg, #1455e6, #1d5fff);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(20, 85, 230, 0.55);
  transition: transform 0.08s ease, box-shadow 0.12s ease,
    filter 0.12s ease;
}

.primary-btn--small {
  padding-inline: 14px;
}

.primary-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 18px 40px rgba(20, 85, 230, 0.7);
}

.primary-btn:active {
  transform: translateY(0);
  box-shadow: 0 10px 22px rgba(20, 85, 230, 0.45);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 1024px) {
  .sidebar {
    width: 210px;
  }

  .sections-bar {
    width: 80px;
  }

  .communities-bar {
    width: 70px;
  }

  .friends-column {
    width: 240px;
  }
}

@media (max-width: 860px) {
  .sidebar {
    display: none;
  }

  .sections-bar {
    display: none;
  }

  .communities-bar {
    display: none !important;
  }

  .main {
    padding: 16px;
  }

  .forum-body {
    flex-direction: column;
  }

  .friends-column {
    width: 100%;
  }
}
