/* 🎭 Modern Group Cards Fresh Styles */

/* SOLUCIÓN AGRESIVA PARA DROPDOWN VISIBILITY */
* {
    /* overflow-x: hidden !important; */
    /* overflow-y: visible !important; */
}

.navbar-fresh, 
.navbar-fresh .container,
.navbar-fresh .navbar-nav,
.navbar-fresh .nav-item,
.navbar-fresh .dropdown {
    overflow: visible !important;
    position: relative !important;
}

.navbar-fresh .dropdown-menu,
.navbar-fresh .dropdown-menu-fresh {
    position: fixed !important; /* Cambiar a fixed para que siempre sea visible */
    top: 70px !important; /* Posición fija desde arriba */
    right: 20px !important; /* Posición fija desde la derecha */
    z-index: 99999 !important;
    display: none !important;
}

.navbar-fresh .dropdown-menu.show,
.navbar-fresh .dropdown-menu-fresh.show {
    display: block !important;
    position: fixed !important;
    top: 70px !important;
    right: 20px !important;
}

/* Prevenir scroll horizontal */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

.container, .container-fluid {
    max-width: 100%;
    overflow-x: hidden;
    padding-left: 20px;
    padding-right: 20px;
    /* Permitir que el dropdown se muestre fuera del contenedor */
    overflow-y: visible;
}

/* Asegurar que la navbar y dropdowns no sean cortados */
.navbar, .navbar-nav, .nav-item.dropdown {
    overflow: visible !important;
}

/* Estilos específicos para dropdown del usuario */
.navbar .dropdown-menu {
    overflow: visible !important;
    clip: none !important;
    z-index: 1050 !important;
}

/* Contenedor de las tarjetas */
.row .col-md-6.col-lg-4 {
    padding-left: 15px;
    padding-right: 15px;
    margin-bottom: 2rem;
    /* Asegurar que las transformaciones hover no causen overflow */
    overflow: visible;
    contain: layout;
}

/* Asegurar espaciado uniforme en el contenedor principal */
.row {
    margin-left: 0; /* Eliminar margen negativo que causa scroll horizontal */
    margin-right: 0; /* Eliminar margen negativo que causa scroll horizontal */
    width: 100%;
    max-width: 100%;
    overflow: visible; /* Permitir que elementos como dropdowns se muestren */
}

.modern-group-card {
    background: #fafbff; /* Fondo ligeramente azulado para destacar del fondo blanco */
    border-radius: 20px;
    border: 2px solid transparent;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    margin: 0 !important; /* Eliminar cualquier margen que pueda agregar Bootstrap */
    width: 100% !important; /* Asegurar que tome todo el ancho disponible */
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.08); /* Sombra sutil para más contraste */
}

.modern-group-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #f5576c);
    opacity: 0;
    transition: all 0.3s ease;
}

.modern-group-card:hover {
    transform: translateY(-6px) scale(1.01); /* Reducir el scale para evitar overflow */
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.15), 0 8px 16px rgba(118, 75, 162, 0.1);
    border-color: rgba(102, 126, 234, 0.2);
}

.modern-group-card:hover::before {
    opacity: 1;
}

.modern-group-header {
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.08) 0%, 
        rgba(118, 75, 162, 0.05) 50%,
        rgba(240, 147, 251, 0.03) 100%);
    padding: 1.75rem;
    border-radius: 20px 20px 0 0;
    position: relative;
}

.group-info {
    flex: 1;
}

.group-privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 0.4rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.group-privacy-badge i {
    font-size: 0.9rem;
}

.group-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--fresh-text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
    background: linear-gradient(135deg, #2d3748, #4a5568);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #667eea;
    background: rgba(102, 126, 234, 0.08);
    padding: 0.3rem 0.7rem;
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.15);
}

.btn-modern-options {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(102, 126, 234, 0.15);
    color: var(--fresh-text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-modern-options:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.modern-dropdown {
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.modern-dropdown .dropdown-item {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.modern-dropdown .dropdown-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateX(4px);
}

.modern-group-body {
    padding: 1.75rem;
}

.group-description {
    color: var(--fresh-text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.modern-stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.modern-stat-item {
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.05) 0%, 
        rgba(118, 75, 162, 0.03) 100%);
    padding: 1rem;
    border-radius: 15px;
    border: 1px solid rgba(102, 126, 234, 0.08);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    min-width: 0;
    overflow: hidden;
    flex: 1;
    min-width: 120px; /* Ancho mínimo para evitar que se compriman demasiado */
}

.modern-stat-item:hover {
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.08) 0%, 
        rgba(118, 75, 162, 0.05) 100%);
    transform: translateY(-2px);
}

.stat-icon {
    width: 32px; /* Reducir tamaño del ícono */
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem; /* Reducir tamaño del ícono */
    color: white;
    flex-shrink: 0;
}

.modern-stat-item:first-child .stat-icon {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.modern-stat-item:last-child .stat-icon {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

.stat-content {
    flex: 1;
    min-width: 0; /* Permitir que el contenido se comprima */
    overflow: hidden; /* Ocultar desbordamiento */
}

.stat-number {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--fresh-text-primary);
    line-height: 1;
    margin-bottom: 0.2rem;
    white-space: nowrap;
}

/* Solución específica para eliminar flechas solo en grupos */
.modern-group-card .stat-number,
.modern-group-card .stat-label {
    list-style: none !important;
    text-decoration: none !important;
}

.modern-group-card .stat-number::before,
.modern-group-card .stat-number::after,
.modern-group-card .stat-label::before,
.modern-group-card .stat-label::after {
    content: none !important;
    display: none !important;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--fresh-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* Asegurar que los dropdowns funcionen correctamente */
.modern-group-card .dropdown {
    position: relative;
    z-index: 1000;
}

.modern-group-card .dropdown-menu {
    position: absolute;
    z-index: 1001;
    display: none;
    min-width: 200px;
    background: white;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
    right: 0;
    left: auto;
    margin-top: 0.5rem;
}

.modern-group-card .dropdown-menu.show {
    display: block !important;
}

/* Restaurar funcionalidad del botón dropdown */
.btn-modern-options {
    position: relative;
    z-index: 999;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(102, 126, 234, 0.15);
    color: var(--fresh-text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-modern-options:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

/* Asegurar que el dropdown toggle funcione */
.modern-group-card .dropdown-toggle {
    cursor: pointer;
    border: none !important;
    outline: none !important;
    background: rgba(255, 255, 255, 0.7) !important;
    color: var(--fresh-text-secondary) !important;
}

.modern-group-card .dropdown-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3) !important;
}

.modern-group-card .dropdown-toggle::after {
    display: none !important;
}

/* Forzar visibilidad del dropdown */
.modern-group-card .dropdown.show .dropdown-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Asegurar que el contenedor permita dropdowns */
.modern-group-card,
.modern-group-header,
.col-md-6,
.col-lg-4 {
    /* overflow: visible !important; */
    position: relative;
    z-index: auto;
}

/* Estilos para los elementos del dropdown */
.modern-dropdown {
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: white;
    min-width: 200px;
}

.modern-dropdown .dropdown-item {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #333;
    text-decoration: none;
}

.modern-dropdown .dropdown-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateX(4px);
    color: #667eea;
}

.group-actions {
    text-align: center;
}

.btn-modern-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 0.9rem 2rem;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.25);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn-modern-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-modern-primary:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(102, 126, 234, 0.35);
}

.btn-modern-primary:hover::before {
    left: 100%;
}

.btn-modern-primary i {
    transition: transform 0.3s ease;
}

.btn-modern-primary:hover i {
    transform: translateX(4px);
}

.modern-group-footer {
    background: linear-gradient(135deg, 
        rgba(248, 250, 252, 0.8) 0%, 
        rgba(241, 245, 249, 0.6) 100%);
    padding: 1rem 1.75rem;
    border-radius: 0 0 20px 20px;
    border-top: 1px solid rgba(102, 126, 234, 0.06);
}

.group-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--fresh-text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.group-date i {
    color: #667eea;
    font-size: 0.9rem;
}

/* Responsive para las tarjetas modernas */
@media (max-width: 768px) {
    .row .col-md-6.col-lg-4 {
        padding-left: 10px;
        padding-right: 10px;
        margin-bottom: 1.5rem;
    }
    
    .row {
        margin-left: 0; /* Eliminar margen negativo en tablet */
        margin-right: 0; /* Eliminar margen negativo en tablet */
    }
    
    .modern-group-header {
        padding: 1.5rem;
    }
    
    .modern-group-body {
        padding: 1.5rem;
    }
    
    .group-title {
        font-size: 1.2rem;
    }
    
    .modern-stats-grid {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .modern-stat-item {
        padding: 0.85rem; /* Ajustar padding para móvil */
        flex: none; /* Eliminar flex para que no se estire */
    }
    
    .stat-number {
        font-size: 1.1rem; /* Ajustar tamaño para móvil */
    }
    
    .stat-label {
        font-size: 0.65rem; /* Ajustar tamaño de etiqueta para móvil */
    }
    
    .btn-modern-primary {
        width: 100%;
        justify-content: center;
    }
    
    .modern-group-footer {
        padding: 1rem 1.5rem;
    }
}

@media (max-width: 576px) {
    .row .col-md-6.col-lg-4 {
        padding-left: 8px;
        padding-right: 8px;
        margin-bottom: 1.25rem;
    }
    
    .row {
        margin-left: 0; /* Eliminar margen negativo en móvil */
        margin-right: 0; /* Eliminar margen negativo en móvil */
    }
    
    .modern-group-header,
    .modern-group-body {
        padding: 1.25rem;
    }
    
    .group-privacy-badge,
    .role-badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
    
    .group-title {
        font-size: 1.1rem;
    }
    
    .modern-stat-item {
        padding: 0.75rem;
        gap: 0.4rem;
    }
    
    .stat-icon {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    
    .stat-number {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.6rem;
        letter-spacing: 0.2px;
    }
    
    .modern-group-footer {
        padding: 1rem 1.25rem;
    }
}