/* ===== COMUNIDAD PAGE STYLES ===== */

/* Page Hero Específico para Comunidad */
.comunidad-hero {
    background: linear-gradient(135deg, 
        rgba(212, 175, 55, 0.9) 0%, 
        rgba(255, 158, 31, 0.85) 50%,
        rgba(231, 111, 81, 0.8) 100%);
}

.comunidad-hero .page-hero-background {
    background: url('../images/comunidad-hero.jpg') center/cover;
}

/* Main Content */
.comunidad-main {
    padding: var(--space-lg) 0;
    background: var(--blanco-hueso);
}

/* Search Section */
.search-section {
    margin-bottom: var(--space-lg);
}

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

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

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--gris-medio);
    z-index: 2;
}

.search-input-wrapper input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--gris-claro);
    border-radius: 25px;
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--verde-esmeralda);
    box-shadow: 0 0 0 3px rgba(76, 199, 109, 0.1);
}

.search-clear {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: var(--gris-medio);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.search-clear:hover {
    background: var(--gris-claro);
    color: var(--verde-bosque);
}

.search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gris-claro);
    border-radius: var(--radius-md);
    box-shadow: var(--sombra-intensa);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 0.5rem;
}

/* Comunidad Layout */
.comunidad-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    align-items: start;
}

/* Sidebar */
.comunidad-sidebar {
    position: sticky;
    top: 100px;
}

.sidebar-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--sombra-suave);
    border: 1px solid var(--gris-claro);
}

.sidebar-title {
    color: var(--verde-bosque);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Categorías */
.categorias-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.categoria-btn {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    background: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
    color: var(--gris-oscuro);
}

.categoria-btn:hover {
    background: var(--gris-claro);
    transform: translateX(5px);
}

.categoria-btn.active {
    background: var(--verde-esmeralda);
    color: white;
}

.categoria-btn i {
    width: 16px;
    text-align: center;
}

.categoria-count {
    margin-left: auto;
    background: var(--gris-claro);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.categoria-btn.active .categoria-count {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* Trending */
.trending-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.trending-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    cursor: pointer;
}

.trending-item:hover {
    background: var(--gris-claro);
}

.trending-tag {
    font-weight: 600;
    color: var(--verde-bosque);
}

.trending-count {
    font-size: 0.8rem;
    color: var(--gris-medio);
}

/* Create Post Section */
.create-post-section {
    margin-bottom: 2rem;
}

.create-post-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--sombra-suave);
    border: 1px solid var(--gris-claro);
}

.create-post-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.create-post-header .usuario-avatar {
    width: 45px;
    height: 45px;
    background: var(--gradiente-verde-claro);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.input-trigger {
    flex: 1;
    background: var(--gris-claro);
    padding: 1rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    color: var(--gris-medio);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.input-trigger:hover {
    background: var(--gris-medio);
    color: var(--gris-oscuro);
    border-color: var(--verde-esmeralda);
}

.create-post-actions {
    display: flex;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gris-claro);
}

.post-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.2rem;
    background: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--gris-oscuro);
    font-weight: 500;
}

.post-action-btn:hover {
    background: var(--gris-claro);
    transform: translateY(-2px);
}

/* Posts Section */
.posts-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--sombra-suave);
    border: 1px solid var(--gris-claro);
}

.posts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gris-claro);
}

.posts-title {
    color: var(--verde-bosque);
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gris-claro);
    border-radius: var(--radius-md);
    background: white;
    font-family: inherit;
}

/* Posts Container */
.posts-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.posts-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--gris-medio);
}

.posts-loading i {
    font-size: 2rem;
    color: var(--verde-esmeralda);
}

.posts-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gris-medio);
}

.posts-empty i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--gris-claro);
}

.posts-empty h3 {
    color: var(--gris-oscuro);
    margin-bottom: 0.5rem;
}

/* Post Card (se cargará dinámicamente) */
.post-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--sombra-suave);
    border: 1px solid var(--gris-claro);
    transition: all 0.3s ease;
}

.post-card:hover {
    box-shadow: var(--sombra-media);
    transform: translateY(-2px);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.usuario-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.usuario-info strong {
    color: var(--verde-bosque);
    font-size: 1rem;
}

.categoria {
    background: var(--gradiente-verde-claro);
    color: white;
    padding: 0.3rem 1rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.fecha {
    color: var(--gris-medio);
    font-size: 0.9rem;
}

.post-content p {
    color: var(--gris-oscuro);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.post-imagen {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin: 1rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.post-actions {
    display: flex;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gris-claro);
}

.btn-like, .btn-comment {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gris-medio);
}

.btn-like:hover, .btn-comment:hover {
    background: var(--gris-claro);
    transform: translateY(-2px);
}

.btn-like.liked {
    color: #e74c3c;
    background: #ffeaea;
}

/* Comentarios */
.comentarios {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gris-claro);
    display: none;
    animation: slideInUp 0.3s ease-out;
}

.comentarios.mostrar {
    display: block;
}

.comentario {
    background: var(--blanco-hueso);
    padding: 1rem 1.2rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.95rem;
    border-left: 4px solid var(--verde-esmeralda);
}

.comentario strong {
    color: var(--verde-bosque);
}

.form-comentario {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.2rem;
}

.form-comentario input {
    flex: 1;
    padding: 1rem;
    border: 2px solid var(--gris-claro);
    border-radius: 25px;
    background: white;
    transition: all 0.3s ease;
}

.form-comentario input:focus {
    outline: none;
    border-color: var(--verde-esmeralda);
    box-shadow: 0 0 0 3px rgba(76, 199, 109, 0.1);
}

.form-comentario button {
    background: var(--gradiente-verde-claro);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.form-comentario button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 199, 109, 0.4);
}

/* Responsive */
@media (max-width: 1024px) {
    .comunidad-layout {
        grid-template-columns: 250px 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .comunidad-layout {
        grid-template-columns: 1fr;
    }
    
    .comunidad-sidebar {
        position: static;
        order: 2;
    }
    
    .comunidad-content {
        order: 1;
    }
    
    .posts-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .create-post-actions {
        flex-wrap: wrap;
    }
    
    .post-action-btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .posts-section {
        padding: 1.5rem;
    }
    
    .create-post-card {
        padding: 1rem;
    }
    
    .sidebar-section {
        padding: 1rem;
    }
    
    .post-actions {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .btn-like, .btn-comment {
        justify-content: center;
    }
}

/* 🔧 ESTILOS ADICIONALES PARA CLOUDINARY */

/* Contador de caracteres */
.textarea-container {
    position: relative;
}

.contador-caracteres {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 12px;
    color: #666;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 10px;
}

/* Botón quitar foto */
.btn-remover-foto {
    background: #ff4757;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 10px;
}

.btn-remover-foto:hover {
    background: #ff3742;
}

/* Vista previa mejorada */
.vista-previa {
    position: relative;
    margin: 10px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 2px dashed #ddd;
}

.vista-previa img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
}

.btn-remover-preview {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 71, 87, 0.9);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Estados de carga mejorados */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notificaciones */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

.notification.success {
    background: #2ed573;
}

.notification.error {
    background: #ff4757;
}

.notification.info {
    background: #3742fa;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ESTILOS PARA SISTEMA DE COMENTARIOS */

.comentarios-section {
    border-top: 1px solid #eee;
    margin-top: 15px;
    padding-top: 15px;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    margin: 0 -15px -15px -15px;
    padding: 15px;
}

.comentarios-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.comentario-item {
    background: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid #e9ecef;
    position: relative;
}

.comentario-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.comentario-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    font-weight: bold;
    margin-right: 8px;
}

.comentario-info {
    flex: 1;
}

.comentario-info strong {
    font-size: 13px;
    color: #333;
}

.comentario-fecha {
    font-size: 11px;
    color: #666;
    margin-left: 8px;
}

.comentario-texto p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    color: #444;
}

.btn-eliminar-comentario {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #ff4757;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-eliminar-comentario:hover {
    opacity: 1;
    background: rgba(255, 71, 87, 0.1);
}

.comentario-form {
    margin-top: 15px;
}

.comentario-input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.comentario-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.comentario-input:focus {
    border-color: #667eea;
}

.btn-comentario-enviar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.btn-comentario-enviar:hover {
    transform: scale(1.05);
}

.btn-comentario-enviar:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.comentarios-loading,
.comentarios-vacio,
.comentarios-error {
    text-align: center;
    padding: 20px;
    color: #666;
}

.comentarios-vacio i,
.comentarios-error i {
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.comentarios-vacio p {
    margin: 0 0 4px 0;
    font-weight: 500;
}

.comentarios-vacio span {
    font-size: 12px;
    opacity: 0.7;
}

/* Mejoras para los contadores */
.comment-count {
    margin-left: 4px;
    font-size: 12px;
}

.like-count {
    margin-left: 4px;
    font-size: 12px;
}

/* Scroll personalizado para comentarios */
.comentarios-list::-webkit-scrollbar {
    width: 4px;
}

.comentarios-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.comentarios-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.comentarios-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}