/* ESTILOS FLAT UI CHAT 2015! */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Open Sans', Arial, Helvetica, sans-serif;
}

body {
  background-color: #f4f6f9;
  color: #333333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* NAVBAR PRINCIPAL */
.main-navbar {
  background-color: #1565c0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  padding: 10px 0;
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-size: 22px;
}

.logo-text strong {
  color: #ffeb3b;
}

.nav-links {
  display: flex;
  gap: 10px;
}

.nav-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ESTRUCTURA GENERAL */
.page-wrapper {
  max-width: 1100px;
  width: 100%;
  margin: 20px auto;
  padding: 0 15px;
  flex: 1;
}

/* LANDING LAYOUT */
.landing-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
}

.hero-header h1 {
  font-size: 26px;
  color: #2c3e50;
  margin-bottom: 8px;
  font-weight: 600;
}

.hero-subtitle {
  color: #666666;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}

/* TARJETAS FLAT */
.card {
  background: #ffffff;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
  margin-bottom: 20px;
}

.card-header-blue {
  background-color: #1976d2;
  color: #ffffff;
  font-weight: bold;
  padding: 12px 16px;
  font-size: 16px;
}

.card-body {
  padding: 20px;
}

/* FORMULARIO DE INGRESO (2015 STYLE) */
.input-group-2015 {
  display: flex;
  gap: 10px;
}

.input-icon-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  font-size: 16px;
  color: #888;
}

.input-icon-wrapper input {
  width: 100%;
  padding: 12px 12px 12px 38px;
  border: 1px solid #cccccc;
  border-radius: 4px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.input-icon-wrapper input:focus {
  border-color: #1976d2;
}

.btn-cta-green {
  background-color: #4caf50;
  color: #ffffff;
  border: none;
  padding: 0 24px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-cta-green:hover {
  background-color: #43a047;
}

.error-msg {
  color: #d32f2f;
  font-size: 13px;
  margin-top: 10px;
}

/* CANALES SECUNDARIOS */
.community-banner {
  margin: 25px 0 15px 0;
}

.community-banner h3 {
  font-size: 18px;
  color: #333;
}

.community-banner p {
  font-size: 13px;
  color: #666;
}

.rooms-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.room-card {
  display: flex;
  padding: 12px;
  cursor: pointer;
  transition: transform 0.2s;
}

.room-card:hover {
  transform: translateY(-2px);
}

.room-thumb {
  width: 50px;
  height: 50px;
  background: #e3f2fd;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-right: 12px;
}

.room-info h4 {
  font-size: 15px;
  color: #1565c0;
}

.room-info p {
  font-size: 12px;
  color: #777;
  margin-top: 4px;
}

/* BARRA LATERAL LANDING */
.category-widget {
  background: #ffffff;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  overflow: hidden;
}

.widget-header {
  background: #1976d2;
  color: #ffffff;
  padding: 10px 14px;
  font-weight: bold;
  font-size: 14px;
}

.widget-list {
  list-style: none;
}

.widget-list li {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
  color: #444;
  cursor: pointer;
  transition: background 0.2s;
}

.widget-list li:hover {
  background: #f5f5f5;
  color: #1976d2;
}

/* APLICACIÓN DE CHAT */
.chat-app-container {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: 1fr 35px;
  height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 6px;
  border: 1px solid #d0d0d0;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.chat-sidebar {
  background: #fafafa;
  border-right: 1px solid #e0e0e0;
  display: flex;
  transition: width 0.2s;
}

.chat-sidebar.right {
  border-right: none;
  border-left: 1px solid #e0e0e0;
}

.chat-sidebar.collapsed .sidebar-inner {
  display: none;
}

.sidebar-inner {
  width: 200px;
  padding: 10px;
}

.sidebar-title {
  font-size: 13px;
  font-weight: bold;
  color: #555;
  padding-bottom: 6px;
  border-bottom: 2px solid #1976d2;
  margin-bottom: 8px;
}

.chat-list {
  list-style: none;
}

.chat-list li {
  padding: 8px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 4px;
}

.chat-list li:hover {
  background: #e3f2fd;
  color: #1565c0;
}

.chat-main-area {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-topbar {
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-room-name {
  font-weight: bold;
  color: #1565c0;
}

.btn-videocall {
  background: #2196f3;
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.messages-container {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #ffffff;
}

.message-item {
  font-size: 14px;
  line-height: 1.4;
  background: #f8f9fa;
  padding: 8px 12px;
  border-radius: 6px;
  max-width: 80%;
  align-self: flex-start;
  border: 1px solid #e9ecef;
}

.message-item .sender {
  font-weight: bold;
  color: #1976d2;
  cursor: pointer;
}

.message-item .system {
  color: #777777;
  font-style: italic;
  font-size: 12px;
}

.media-preview {
  max-width: 250px;
  max-height: 200px;
  border-radius: 4px;
  margin-top: 6px;
  display: block;
}

.chat-input-bar {
  display: flex;
  padding: 10px;
  background: #f5f5f5;
  border-top: 1px solid #e0e0e0;
  gap: 8px;
}

.chat-input-bar input[type="text"] {
  flex: 1;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  outline: none;
}

.btn-attach, .btn-send {
  background: #1976d2;
  color: white;
  border: none;
  padding: 0 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.btn-send {
  background: #4caf50;
}

.chat-bottom-bar {
  grid-column: 1 / -1;
  background: #eceff1;
  border-top: 1px solid #cfd8dc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  font-size: 12px;
}

.bottom-actions button {
  background: #ffffff;
  border: 1px solid #b0bec5;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  margin-left: 4px;
}

.toggle-btn {
  background: #e0e0e0;
  border: none;
  padding: 6px;
  cursor: pointer;
}

.center-text {
  text-align: center;
}

.btn-secondary {
  background: #757575;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  margin-top: 12px;
  cursor: pointer;
}

/* MEDIAS QUERIES / RESPONSIVE */
@media (max-width: 768px) {
  .landing-layout {
    grid-template-columns: 1fr;
  }
  .landing-sidebar {
    display: none;
  }
  .input-group-2015 {
    flex-direction: column;
  }
  .btn-cta-green {
    padding: 12px;
  }
}

/* VALIDACIÓN DE ENTRADA EN TIEMPO REAL */
.input-icon-wrapper input.input-invalid {
  border-color: #d32f2f !important;
  box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.2) !important;
}

.error-msg {
  color: #d32f2f;
  font-size: 13px;
  margin-top: 6px;
  font-weight: 600;
  min-height: 18px;
}

/* BOTONES DE NAVEGACIÓN Y PRIVADOS */
.btn-back-global {
  background: #1565c0;
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  margin-left: 10px;
  cursor: pointer;
}

.unread-badge {
  background: #d32f2f;
  color: white;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
}

.topbar-left {
  display: flex;
  align-items: center;
}

/* MODAL VIDEOLLAMADA */
.video-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.video-modal-content {
  background: white;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  max-width: 650px;
  width: 90%;
}

.video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 15px 0;
}

.video-grid video {
  width: 100%;
  height: 200px;
  background: #000;
  border-radius: 6px;
  object-fit: cover;
}

.btn-danger {
  background: #d32f2f !important;
}

.video-grid video {
width: 100%;
height: 200px;
background: #000;
border-radius: 6px;
object-fit: cover;
}

.btn-danger {
background: #d32f2f !important;
}

/* BANNER DE ADVERTENCIA DE CONEXIÓN Y ANIMACIÓN PARPADEANTE */
.connection-banner {
background-color: #fff3cd;
color: #856404;
border-bottom: 2px solid #ffeba2;
padding: 8px 16px;
font-size: 13px;
font-weight: 600;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
width: 100%;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
z-index: 100;
}

.blinking-icon {
display: inline-block;
font-weight: bold;
font-size: 16px;
animation: blink-animation 0.9s infinite alternate;
}

@keyframes blink-animation {
0% {
opacity: 0.15;
transform: scale(0.85);
}
100% {
opacity: 1;
transform: scale(1.15);
}
}