/* ============================================
   DASHBOARD CON WIDGETS MOVIBLES
   ============================================ */

.dashboard-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    border-radius: 16px;
    color: white;
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.3);
}

.btn-reset-layout {
    background: transparent;
    color: white;
    border: none;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    width: 32px;
    height: 32px;
}

.btn-reset-layout:hover {
    background: rgba(255, 255, 255, 0.15);
    opacity: 1;
    transform: rotate(180deg);
}

.btn-reset-layout:active {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(180deg) scale(0.95);
}

/* Grid de Widgets */
.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 0 20px 20px;
}

/* Responsive para móvil */
@media (max-width: 768px) {
    .widgets-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0 10px 10px;
    }
    
    .dashboard-header {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .dashboard-header h1 {
        font-size: 1.5rem;
    }
}

/* Widget Base */
.widget {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    border: 2px solid transparent;
    position: relative;
}

.widget:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(236, 72, 153, 0.2);
    border-color: rgba(236, 72, 153, 0.3);
}

.widget.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    cursor: grabbing !important;
}

.widget.drag-over {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
    transform: scale(1.02);
}

/* Tamaños de Widgets */
.widget-small {
    grid-column: span 1;
    min-height: 300px;
    height: auto;
}

.widget-medium {
    grid-column: span 1;
    min-height: 500px;
    height: auto;
}

.widget-large {
    grid-column: span 2;
    min-height: 500px;
    height: auto;
}

.widget-full {
    grid-column: 1 / -1; /* Ocupa todo el ancho */
    min-height: 600px;
    height: auto;
}

/* En pantallas grandes, medium puede ocupar más espacio */
@media (min-width: 1200px) {
    .widgets-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .widget-small {
        grid-column: span 1;
    }
    
    .widget-medium {
        grid-column: span 1;
    }
    
    .widget-large {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .widget-small,
    .widget-medium,
    .widget-large,
    .widget-full {
        grid-column: span 1;
        min-height: auto;
    }
}

/* Header del Widget */
.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(236, 72, 153, 0.2);
}

.widget-title {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.widget-actions {
    display: flex;
    gap: 8px;
}

.widget-btn {
    background: rgba(236, 72, 153, 0.15);
    border: 1px solid rgba(236, 72, 153, 0.3);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-btn:hover {
    background: rgba(236, 72, 153, 0.3);
    transform: scale(1.1);
    border-color: rgba(236, 72, 153, 0.5);
}

.widget-drag-handle {
    cursor: grab;
    font-weight: 900;
    font-size: 1.2rem;
    background: rgba(251, 191, 36, 0.2) !important;
    border-color: rgba(251, 191, 36, 0.4) !important;
}

.widget-drag-handle:hover {
    background: rgba(251, 191, 36, 0.3) !important;
    border-color: rgba(251, 191, 36, 0.6) !important;
}

.widget-drag-handle:active {
    cursor: grabbing;
    background: rgba(251, 191, 36, 0.4) !important;
}

/* Contenido del Widget */
.widget-content {
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

/* Resize Handles */
.widget-resize-handle {
    position: absolute;
    transition: all 0.3s;
    user-select: none;
    z-index: 10;
}

/* Handle esquina (diagonal) */
.widget-resize-corner {
    bottom: 0;
    right: 0;
    width: 30px;
    height: 30px;
    cursor: nwse-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: rgba(251, 191, 36, 0.6);
    background: linear-gradient(135deg, transparent 50%, rgba(251, 191, 36, 0.1) 50%);
    border-radius: 0 0 16px 0;
}

.widget-resize-corner:hover {
    color: rgba(251, 191, 36, 1);
    background: linear-gradient(135deg, transparent 50%, rgba(251, 191, 36, 0.2) 50%);
}

/* Handle derecho (solo ancho) */
.widget-resize-right {
    top: 50%;
    right: 0;
    width: 8px;
    height: 60px;
    transform: translateY(-50%);
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: rgba(251, 191, 36, 0.5);
    background: rgba(251, 191, 36, 0.1);
    border-radius: 4px 0 0 4px;
}

.widget-resize-right:hover {
    color: rgba(251, 191, 36, 1);
    background: rgba(251, 191, 36, 0.2);
    width: 10px;
}

/* Handle inferior (solo altura) */
.widget-resize-bottom {
    bottom: 0;
    left: 50%;
    width: 60px;
    height: 8px;
    transform: translateX(-50%);
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: rgba(251, 191, 36, 0.5);
    background: rgba(251, 191, 36, 0.1);
    border-radius: 4px 4px 0 0;
}

.widget-resize-bottom:hover {
    color: rgba(251, 191, 36, 1);
    background: rgba(251, 191, 36, 0.2);
    height: 10px;
}

.widget.resizing {
    opacity: 0.8;
    transition: none;
}

.widget.resizing .widget-resize-handle {
    color: #fbbf24;
    background: linear-gradient(135deg, transparent 50%, rgba(251, 191, 36, 0.3) 50%);
}

.widget-loading,
.widget-error,
.widget-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.widget-error {
    color: #ef4444;
}

/* Widget de Estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-radius: 12px;
    transition: all 0.3s;
}

.stat-item:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Widget de Visitas - Tarjetas */
.visits-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
}

/* Ajustar grid según tamaño del widget */
.widget-small .visits-cards {
    min-height: 200px;
    max-height: 250px;
}

.widget-medium .visits-cards {
    min-height: 400px;
    max-height: 450px;
}

.widget-large .visits-cards {
    min-height: 400px;
    max-height: 500px;
}

.widget-full .visits-cards {
    min-height: 500px;
    max-height: 600px;
}

.visit-card {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.visit-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 8px 20px rgba(236, 72, 153, 0.3);
}

.visit-card-header {
    padding: 15px 15px 0;
    text-align: center;
}

.visit-card-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.visit-card-body {
    padding: 12px 15px 15px;
    text-align: center;
}

.visit-card-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.visit-card-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.visit-card-time {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
}

/* Widget de Seguidores - Tarjetas */
.followers-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
}

/* Ajustar grid según tamaño del widget */
.widget-small .followers-cards {
    grid-template-columns: repeat(2, 1fr);
    min-height: 200px;
    max-height: 250px;
}

.widget-medium .followers-cards {
    grid-template-columns: repeat(2, 1fr);
    min-height: 400px;
    max-height: 450px;
}

.widget-large .followers-cards {
    grid-template-columns: repeat(3, 1fr);
    min-height: 400px;
    max-height: 500px;
}

.widget-full .followers-cards {
    grid-template-columns: repeat(4, 1fr);
    min-height: 500px;
    max-height: 600px;
}

.follower-card-new {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.follower-card-new:hover {
    transform: translateY(-5px);
    border-color: #10b981;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.follower-card-header {
    position: relative;
    padding: 12px 12px 0;
    text-align: center;
}

.follower-card-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #10b981;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.follower-card-body {
    padding: 10px 12px 12px;
    text-align: center;
}

.follower-card-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.follower-card-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.follower-card-badge {
    font-size: 0.75rem;
    color: #10b981;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.15);
    padding: 3px 8px;
    border-radius: 12px;
    display: inline-block;
}

/* Widget de Siguiendo - Tarjetas */
.following-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
}

/* Ajustar grid según tamaño del widget */
.widget-small .following-cards {
    grid-template-columns: repeat(2, 1fr);
    min-height: 200px;
    max-height: 250px;
}

.widget-medium .following-cards {
    grid-template-columns: repeat(2, 1fr);
    min-height: 400px;
    max-height: 450px;
}

.widget-large .following-cards {
    grid-template-columns: repeat(3, 1fr);
    min-height: 400px;
    max-height: 500px;
}

.widget-full .following-cards {
    grid-template-columns: repeat(4, 1fr);
    min-height: 500px;
    max-height: 600px;
}

.following-card-new {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(251, 191, 36, 0.1) 100%);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.following-card-new:hover {
    transform: translateY(-5px);
    border-color: #f59e0b;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3);
}

.following-card-header {
    padding: 12px 12px 0;
    text-align: center;
}

.following-card-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #f59e0b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.following-card-body {
    padding: 10px 12px 12px;
    text-align: center;
}

.following-card-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.following-card-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.following-card-badge {
    font-size: 0.75rem;
    color: #f59e0b;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.15);
    padding: 3px 8px;
    border-radius: 12px;
    display: inline-block;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .widgets-grid {
        grid-template-columns: 1fr;
        padding: 0 10px 10px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .followers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Widget de Perfiles Sugeridos */
.suggestions-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-height: 500px;
    overflow-y: auto;
}

/* Ajustar grid según tamaño del widget */
.widget-small .suggestions-cards {
    grid-template-columns: repeat(2, 1fr);
    min-height: 200px;
    max-height: 250px;
}

.widget-medium .suggestions-cards {
    grid-template-columns: repeat(2, 1fr);
    min-height: 400px;
    max-height: 450px;
}

.widget-large .suggestions-cards {
    grid-template-columns: repeat(3, 1fr);
    min-height: 400px;
    max-height: 500px;
}

.widget-full .suggestions-cards {
    grid-template-columns: repeat(4, 1fr);
    min-height: 500px;
    max-height: 600px;
}

.suggestion-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
    border: 2px solid transparent;
    cursor: pointer;
}

.suggestion-card:hover {
    transform: translateY(-3px);
    border-color: #8b5cf6;
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.3);
}

.suggestion-card-header {
    padding: 15px 15px 0;
    text-align: center;
}

.suggestion-card-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #8b5cf6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
}

.suggestion-card:hover .suggestion-card-avatar {
    transform: scale(1.1);
    border-color: #a78bfa;
}

.suggestion-card-body {
    padding: 12px 15px 15px;
    text-align: center;
}

.suggestion-card-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-card-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-tipo-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    background: transparent;
    border: 2px solid #ec4899;
    color: #ec4899;
}

/* Responsive para sugerencias */
@media (max-width: 768px) {
    .suggestions-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .suggestions-cards {
        grid-template-columns: 1fr;
    }
}


/* Asegurar que todas las imágenes de avatar sean perfectamente circulares */
.visit-card-avatar,
.follower-card-avatar,
.following-card-avatar,
.suggestion-card-avatar {
    width: 70px !important;
    height: 70px !important;
    border-radius: 50% !important;
    object-fit: cover;
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    display: block;
    flex-shrink: 0;
}

/* Avatar más grande para visitas */
.visit-card-avatar {
    width: 80px !important;
    height: 80px !important;
}

/* Asegurar que el contenedor también sea circular */
.visit-card-header,
.follower-card-header,
.following-card-header,
.suggestion-card-header {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Fondo para imágenes por defecto */
.visit-card-avatar[src*="defaultperfiles"],
.follower-card-avatar[src*="defaultperfiles"],
.following-card-avatar[src*="defaultperfiles"],
.suggestion-card-avatar[src*="defaultperfiles"] {
    background: #f3f4f6;
}
