/* =========================================
   1. RESET Y ESTILOS GLOBALES
   ========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { background-color: #000000; color: white; height: 100vh; overflow: hidden; }
a { text-decoration: none; color: inherit; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }
img { display: block; max-width: 100%; height: auto; }

/* =========================================
   2. ESTRUCTURA APP (HOME)
   ========================================= */
.app-layout { display: flex; width: 100%; height: 100vh; max-width: 1300px; margin: 0 auto; align-items: flex-start; }
.sidebar-left { width: 275px; height: 100vh; padding: 20px; border-right: 1px solid #2F3336; display: flex; flex-direction: column; }
.logo-img { display: block; margin: 0 auto 20px auto; max-width: 120px; width: auto; height: auto; }
.nav-item { display: flex; align-items: center; padding: 12px 15px; margin-bottom: 5px; border-radius: 30px; font-size: 19px; font-weight: 500; cursor: pointer; transition: background 0.2s; color: white; }
.nav-item:hover { background-color: #181818; }
.nav-item.seller-only { color: #eab308; }
.nav-item.active { font-weight: 700; }
.icon-img { width: 24px; height: 24px; object-fit: contain; margin-right: 15px; display: block; }
.avatar-small { width: 28px !important; height: 28px !important; min-width: 28px; min-height: 28px; border-radius: 50%; object-fit: cover; overflow: hidden; flex-shrink: 0; margin-right: 15px; }

/* FEED */
.main-feed { flex: 1; height: 100vh; border-right: 1px solid #2F3336; max-width: 600px; overflow-y: auto; }
.feed-header { position: sticky; top: 0; background-color: rgba(0,0,0,0.8); backdrop-filter: blur(10px); z-index: 10; border-bottom: 1px solid #2F3336; }
.feed-tabs { display: flex; }
.tab { flex: 1; text-align: center; padding: 15px 0; font-weight: 600; color: #71767B; cursor: pointer; position: relative; }
.tab:hover { background-color: #181818; }
.tab.active { color: white; border-bottom: 4px solid #4354D0; }

.create-post-box { padding: 15px; border-bottom: 1px solid #2F3336; display: flex; gap: 10px; }
.avatar-circle { width: 40px !important; height: 40px !important; min-width: 40px; border-radius: 50%; background-color: #333; object-fit: cover; flex-shrink: 0; }
.input-post-wrapper { flex: 1; background-color: #1A1D21; border-radius: 12px; padding: 10px; }
.input-post-title { font-weight: bold; font-size: 14px; margin-bottom: 4px; color: white; }
.input-post { width: 100%; background: transparent; border: none; color: white; outline: none; margin-top: 5px; }
.post-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }
.action-icon { width: 22px; height: 22px; cursor: pointer; opacity: 0.8; }

.post-card { padding: 15px; border-bottom: 1px solid #2F3336; display: flex; gap: 10px; cursor: pointer; }
.post-card:hover { background-color: #080808; }
.post-content { flex: 1; }
.post-header { display: flex; gap: 5px; font-size: 15px; margin-bottom: 5px; }
.user-name { font-weight: bold; }
.post-time { color: #71767B; }
.post-image-placeholder { width: 100%; height: auto; background-color: transparent; border-radius: 12px; margin: 10px 0; }
.post-footer-actions { display: flex; justify-content: flex-start; gap: 40px; margin-top: 10px; color: #71767B; }
.footer-action { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.footer-icon { width: 18px; height: 18px; filter: invert(0.6); } 
.footer-action:hover .footer-icon { filter: invert(1); }

/* --- NUEVO: Estilo para el icono de Mini Perfil (Tarjeta) --- */
.icon-card-profile {
   width: 16px;
   height: 16px;
   margin: 0 6px;
   cursor: pointer;
   vertical-align: middle;
   opacity: 0.7;
   transition: transform 0.2s, opacity 0.2s;
   filter: invert(1); /* Blanco en fondo oscuro */
}
.icon-card-profile:hover {
   opacity: 1;
   transform: scale(1.2);
}

/* SIDEBAR DERECHA */
.sidebar-right { width: 350px; height: 100vh; padding: 20px; overflow-y: auto; }

/* 1. Tarjeta con Borde Gradiente */
.profile-card {
   background-color: #0b0c0e; 
   border-radius: 16px;
   position: relative;
   margin-bottom: 20px;
   --card-gradient: linear-gradient(to bottom, #000000, #000000);
   z-index: 1; 
}

/* Pseudo-elemento: Este es el "Borde" mágico */
.profile-card::before {
   content: "";
   position: absolute;
   top: -2px; left: -2px; right: -2px; bottom: -2px;
   z-index: -1; 
   background: var(--card-gradient);
   border-radius: 18px; 
}

/* 2. Banner con soporte para Videos */
.profile-banner { 
   height: 120px; 
   background-color: #202225; 
   position: relative; 
   background-size: cover;
   background-position: center;
   background-repeat: no-repeat;
   border-radius: 16px 16px 0 0;
   overflow: hidden; 
   transition: background 0.5s ease;
}

/* Clase para el video de portada en Sidebar/Home */
.banner-video {
   position: absolute;
   top: 0; left: 0;
   width: 100%; height: 100%;
   object-fit: cover; 
   z-index: 0; 
   border-radius: 16px 16px 0 0;
}

/* Clase para el video de portada en Editor (Preview) */
.banner-video-element {
   width: 100%;
   height: 100%;
   object-fit: cover;
   position: absolute;
   top: 0; left: 0;
   border-radius: 16px 16px 0 0;
   z-index: 0;
}

.banner-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 5px; z-index: 10; }
.circle-btn { width: 30px; height: 30px; background: rgba(0,0,0,0.6); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }

.profile-info-container { padding: 15px; position: relative; }

/* 3. Ajuste de bordes del Avatar */
.profile-avatar-large { 
   width: 80px !important; 
   height: 80px !important; 
   min-width: 80px; 
   border-radius: 50%; 
   border: 6px solid #0b0c0e; 
   background-color: #333; 
   object-fit: cover; 
   position: absolute; 
   top: -50px; left: 15px; 
   z-index: 5; 
}

.status-indicator { 
   width: 18px; height: 18px; 
   background-color: #22C55E; 
   border: 3px solid #0b0c0e; 
   border-radius: 50%; 
   position: absolute; bottom: 2px; right: 2px; 
   z-index: 6; 
}

.profile-details { margin-top: 45px; }
.p-name { font-weight: 800; font-size: 18px; display: block; color: white; }
.p-role { color: #4354D0; font-weight: bold; font-size: 14px; margin: 5px 0; }
.p-description { font-size: 14px; color: #ccc; line-height: 1.4; }

/* =========================================
   3. ESTILOS LOGIN Y REGISTRO
   ========================================= */
.main-container { display: flex; width: 100%; height: 100vh; }
.visual-side { display: none; }
.login-side { width: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 20px; height: 100vh; position: relative; }
.login-wrapper { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 20px; }
.auth-box { padding: 20px; text-align: center; border-radius: 8px; display: flex; flex-direction: column; align-items: center; }
.auth-form { width: 100%; }
.signup-box { text-align: center; font-size: 14px; color: #dbdbdb; padding: 20px; border: 1px solid #363636; border-radius: 4px; background-color: transparent; }
body.registration-page { overflow-y: auto; }
.registration-page .main-container { flex-direction: column; justify-content: center; align-items: center; padding-top: 50px; padding-bottom: 50px; height: auto; min-height: 100vh; }
.registration-page .auth-box { background: #000; border: 1px solid #363636; padding: 40px; width: 100%; max-width: 380px; margin-bottom: 10px; }
.input-field { width: 100%; background: #1A1D21; border: 1px solid #363636; color: white; padding: 14px; margin-bottom: 12px; border-radius: 6px; outline: none; }
.input-field:focus { border-color: #737373; }
.btn-primary { width: 100%; background: #4354D0; color: white; border: none; padding: 12px; border-radius: 8px; font-weight: bold; cursor: pointer; margin-top: 10px; }
.btn-primary:hover { background: #3644aa; }
.divider { display: flex; align-items: center; margin: 20px 0; color: #8e8e8e; font-size: 12px; width: 100%; }
.divider .line { flex: 1; height: 1px; background: #363636; }
.divider .text { padding: 0 10px; }
.footer { width: 100%; text-align: center; font-size: 11px; color: #737373; margin-top: 40px; }
.footer ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; padding: 0; margin-bottom: 10px; }
.footer a { color: #737373; font-weight: normal; }
@media (min-width: 850px) {
   .visual-side { display: block; flex: 1; }
   .login-side { flex: 0 0 450px; border-left: 1px solid #1A1D21; }
   .login-wrapper .auth-box { background: #000; border: 1px solid #363636; padding: 40px; }
}

/* =========================================
   4. MODO MÓVIL (GENERAL)
   ========================================= */
@media (max-width: 768px) {
   .sidebar-right { display: none !important; }
   .sidebar-left { width: 75px; padding: 20px 10px; align-items: center; border-right: 1px solid #2F3336; }
   .logo-img { width: 40px; margin-bottom: 30px; }
   .nav-text { display: none; }
   .nav-item { justify-content: center; padding: 15px 0; width: 50px; height: 50px; border-radius: 50%; }
   .icon-img, .avatar-small { margin-right: 0; width: 28px; height: 28px; }
   .main-feed { max-width: none; width: calc(100% - 75px); border-right: none; }
}

/* =========================================
   5. EDICIÓN PERFIL
   ========================================= */
.edit-layout { display: flex; max-width: 1200px; margin: 40px auto; gap: 40px; padding: 20px; height: 90vh; }
.preview-section { flex: 1; display: flex; flex-direction: column; gap: 20px; align-items: center; position: sticky; top: 20px; }
.preview-label { color: #fff; font-size: 18px; font-weight: bold; margin-bottom: 10px; }
.edit-form-section { flex: 1; background-color: #000; border: 1px solid #2F3336; border-radius: 16px; padding: 30px; overflow-y: auto; }
.edit-form-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.edit-group { margin-bottom: 25px; }
.edit-label { display: block; color: #fff; font-size: 16px; margin-bottom: 8px; font-weight: 500; }
.edit-row { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #2F3336; padding-bottom: 8px; cursor: pointer; }
.edit-value { color: #71767B; font-size: 15px; background: transparent; border: none; width: 100%; outline: none; }
.edit-icon-pen { width: 20px; height: 20px; opacity: 0.7; cursor: pointer; }
.edit-avatar-preview { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; background-color: #333; }
.edit-banner-preview { width: 100px; height: 60px; background-color: #4354D0; border-radius: 8px; object-fit: cover; }

/* RESPONSIVE EDITAR PERFIL */
@media (max-width: 768px) {
   body { overflow-y: auto !important; height: auto !important; }
   .edit-layout { flex-direction: column; height: auto; margin: 0; padding: 15px; padding-bottom: 100px; }
   .preview-section { position: relative; top: 0; width: 100%; margin-bottom: 20px; }
   .edit-form-section { overflow: visible; padding: 15px; border: none; }
   .btn-save-floating {
       position: fixed; bottom: 20px; right: 20px;
       background-color: #4354D0; color: white; padding: 15px 30px; border-radius: 50px; font-weight: bold;
       box-shadow: 0 4px 15px rgba(67, 84, 208, 0.5); z-index: 1000; text-align: center; text-decoration: none;
       display: flex; align-items: center; justify-content: center;
   }
}

/* =========================================
   6. MODALES Y REACCIONES
   ========================================= */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); z-index: 2000; display: none; justify-content: center; align-items: center; }
.emoji-picker-menu { position: absolute; background-color: #1A1D21; border: 1px solid #2F3336; border-radius: 8px; padding: 10px; display: none; grid-template-columns: repeat(6, 1fr); gap: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.5); z-index: 1500; max-height: 250px; overflow-y: auto; }
.emoji-btn { font-size: 22px; cursor: pointer; background: transparent; border: none; padding: 5px; border-radius: 4px; transition: background 0.2s; }
.reactions-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; margin-bottom: 8px; width: 100%; height: auto; min-height: 24px; overflow: visible; }
.reaction-pill { background: #2b2d31; border: 1px solid transparent; border-radius: 8px; padding: 2px 8px; font-size: 14px; color: #dbdee1; display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 500; max-width: fit-content; }
.reaction-pill:hover { border-color: #4354D0; background: #36373d; }
.comments-modal-box { background-color: #242526; width: 100%; max-width: 600px; height: 80vh; border-radius: 12px; display: flex; flex-direction: column; box-shadow: 0 0 25px rgba(0,0,0,0.9); position: relative; }
.modal-header { padding: 15px; border-bottom: 1px solid #3E4042; text-align: center; font-size: 18px; font-weight: bold; color: #E4E6EB; position: relative; }
.close-modal { position: absolute; right: 15px; top: 15px; background: #3E4042; border-radius: 50%; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; color: #E4E6EB; }
.modal-body { flex: 1; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 15px; }
.comment-bubble-row { display: flex; gap: 10px; }
.comment-content { background-color: #3A3B3C; padding: 8px 12px; border-radius: 18px; max-width: 85%; }
.c-user { font-weight: bold; font-size: 13px; color: #E4E6EB; display: block; }
.c-text { font-size: 14px; color: #E4E6EB; display: block; margin-top: 2px; }
.modal-footer { padding: 15px; border-top: 1px solid #3E4042; display: flex; align-items: center; gap: 10px; background-color: #242526; border-radius: 0 0 12px 12px; }
.comment-input { flex: 1; background: #3A3B3C; border: none; border-radius: 20px; padding: 10px 15px; color: #E4E6EB; outline: none; font-size: 15px; }
.send-btn-icon { width: 24px; height: 24px; cursor: pointer; filter: invert(0.8); transition: transform 0.2s; }
.shared-post-container { border: 1px solid #2F3336; border-radius: 12px; padding: 12px; margin-top: 10px; background-color: #16181c; }
.shared-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; font-weight: bold; color: #fff; }
.shared-media { width: 100%; border-radius: 8px; margin-top: 8px; }

/* =========================================
   7. ESTILOS DE PÁGINA DE PERFIL (FINAL - ESTILO X/TWITTER)
   ========================================= */
.profile-header-container { position: relative; border-bottom: 1px solid #2F3336; background-color: #000; }
.profile-banner-hero { width: 100%; height: 220px; min-height: 220px; background-color: #333; object-fit: cover; display: block; }
.profile-hero-info { padding: 0 20px 15px 20px; position: relative; display: flex; flex-direction: column; }
.profile-avatar-hero { width: 130px; height: 130px; min-width: 130px; min-height: 130px; border-radius: 50%; border: 4px solid #000; background-color: #333; object-fit: cover; display: block; margin-top: -75px; z-index: 2; position: relative; }
.profile-hero-actions { display: flex; justify-content: flex-end; margin-top: -50px; margin-bottom: 10px; height: 40px; z-index: 5; }
.btn-edit-profile { background: transparent; border: 1px solid #536471; color: #eff3f4; font-weight: 700; padding: 0 16px; height: 36px; border-radius: 9999px; cursor: pointer; transition: 0.2s; font-size: 15px; }
.btn-edit-profile:hover { background: rgba(239, 243, 244, 0.1); }
.hero-name { font-size: 20px; font-weight: 800; color: #e7e9ea; margin-top: 5px; line-height: 1.3; }
.hero-role { color: #71767B; font-size: 15px; margin-bottom: 12px; font-weight: 400; }
.hero-bio { font-size: 15px; color: #e7e9ea; margin-bottom: 15px; line-height: 1.5; white-space: pre-wrap; }
.hero-stats { display: flex; gap: 20px; color: #71767B; font-size: 14px; }
.hero-stats span { color: #e7e9ea; font-weight: 700; margin-right: 4px; }

/* =========================================
   8. ESTILOS PÁGINA DE LAZOS (Escritorio Base)
   ========================================= */
.lazos-container { padding: 20px; max-width: 800px; margin: 0 auto; }
.section-title { font-size: 20px; font-weight: 800; margin-bottom: 15px; color: #e7e9ea; border-bottom: 1px solid #2F3336; padding-bottom: 10px; }

/* Tarjeta de Solicitud */
.request-card { display: flex; align-items: center; background-color: #16181c; border: 1px solid #2F3336; border-radius: 12px; padding: 15px; margin-bottom: 10px; }
.request-info { flex: 1; margin-left: 15px; }
.btn-accept { background-color: #22C55E; color: black; border: none; padding: 8px 16px; border-radius: 20px; font-weight: bold; cursor: pointer; margin-right: 10px; }
.btn-icon-action { background: transparent; border: 1px solid #333; border-radius: 50%; width: 35px; height: 35px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.2s; }
.btn-icon-action:hover { background: rgba(255,255,255,0.1); }
.btn-icon-action img { width: 18px; height: 18px; filter: invert(1); }

/* Grid de Amigos */
.friends-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; margin-top: 20px; }
.friend-card { background-color: #0b0c0e; border: 1px solid #2F3336; border-radius: 12px; padding: 15px; text-align: center; display: flex; flex-direction: column; align-items: center; position: relative; }
.friend-card:hover { border-color: #4354D0; }
.friend-avatar { width: 70px; height: 70px; border-radius: 50%; object-fit: cover; margin-bottom: 10px; border: 2px solid #333; }
.friend-name { font-weight: bold; color: white; font-size: 15px; margin-bottom: 5px; text-decoration: none; }
.friend-name:hover { text-decoration: underline; }
.friend-actions { display: flex; gap: 8px; margin-top: 10px; }
.empty-message { color: #71767B; text-align: center; padding: 20px; font-style: italic; }

/* =========================================
   9. BOTONES DE LAZO (PERFIL)
   ========================================= */
.btn-lazo { padding: 8px 16px; border-radius: 20px; font-weight: bold; cursor: pointer; border: none; font-size: 14px; transition: 0.2s; display: flex; align-items: center; gap: 5px; z-index: 10; }
.btn-lazo-add { background-color: #e7e9ea; color: #000; }
.btn-lazo-add:hover { background-color: #d7dbdc; }
.btn-lazo-pending { background-color: #333; color: #ccc; border: 1px solid #555; }
.btn-lazo-friends { background-color: transparent; border: 1px solid #22C55E; color: #22C55E; }
.btn-lazo-friends:hover { background-color: rgba(34, 197, 94, 0.1); border-color: #ef4444; color: #ef4444; }
.btn-lazo-friends:hover::after { content: " (Romper)"; font-size: 10px; }
.btn-lazo-accept { background-color: #22C55E; color: #000; }
.btn-lazo-accept:hover { background-color: #1ea852; }

/* =========================================
   10. ESTILOS RESPONSIVE PARA LAZOS (MÓVIL)
   ========================================= */
@media (max-width: 768px) {
   .lazos-container { padding: 15px 10px; max-width: 100%; box-sizing: border-box; }
   
   /* Solicitudes */
   .request-card { flex-direction: row; padding: 10px; align-items: center; width: 100%; box-sizing: border-box; }
   .request-card .avatar-circle { width: 40px !important; height: 40px !important; min-width: 40px; }
   .request-info { margin-left: 10px; flex: 1; overflow: hidden; }
   .request-info .friend-name { font-size: 14px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
   
   /* Botones compactos */
   .btn-accept { padding: 6px 12px; font-size: 12px; }
   .btn-icon-action { width: 30px; height: 30px; }

   /* Grid de Amigos */
   .friends-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%; }
   .friend-card { padding: 10px; width: 100%; box-sizing: border-box; }
   .friend-avatar { width: 60px; height: 60px; }
   .friend-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
}

/* =========================================
   11. GALERÍA MASONRY (PINTEREST STYLE)
   ========================================= */
#user-feed-container.modo-galeria {
   column-count: 3;
   column-gap: 12px;
   padding: 10px 0;
   width: 100%;
}

@media (max-width: 768px) {
   #user-feed-container.modo-galeria { column-count: 2; }
}

/* Ocultar posts sin imagen en la pestaña Galería */
#user-feed-container.modo-galeria .post-card:not(.has-media) {
   display: none !important;
}

/* Ocultar posts de "Solo Galería" en el feed normal */
#user-feed-container:not(.modo-galeria) .post-card.solo-galeria {
   display: none !important;
}

/* Transformar la tarjeta en bloque */
#user-feed-container.modo-galeria .post-card {
   display: inline-block !important; 
   width: 100%;
   margin: 0 0 12px 0 !important;
   padding: 0 !important;
   border: none !important;
   background: transparent !important;
   break-inside: avoid;
   page-break-inside: avoid;
}

/* Ocultar elementos sobrantes */
#user-feed-container.modo-galeria .post-card > a,
#user-feed-container.modo-galeria .post-header,
#user-feed-container.modo-galeria .post-text,
#user-feed-container.modo-galeria .shared-post-container,
#user-feed-container.modo-galeria .reactions-row,
#user-feed-container.modo-galeria .post-footer-actions {
   display: none !important;
}

#user-feed-container.modo-galeria .post-content {
   display: block !important;
   width: 100% !important;
   margin: 0 !important;
   padding: 0 !important;
}

/* Mantener tamaño natural de las fotos */
#user-feed-container.modo-galeria .post-image-placeholder {
   margin: 0 !important;
   padding: 0 !important;
   background: transparent !important;
}

#user-feed-container.modo-galeria .post-image-placeholder img,
#user-feed-container.modo-galeria .post-image-placeholder video {
   width: 100% !important;
   height: auto !important; 
   border-radius: 12px !important;
   display: block !important;
   margin: 0 !important;
}